User Tools

Site Tools



Arduino Interface

The simple arduino interface was added in XTension build 389.

The Arduino driver uses a simple text protocol to talk to get data from and control the ever more popular PIC and Arduino community. I personally use a lot of these things and love them. I have code for the arduino side for parsing responses and will clean that up and post it shortly.

All lines from the arduino must be cr terminated. So as your last print statement use a println();

Any command line without an “=” in it will be treated as a log item and will show up as a log line in the XTension log.

further commands are in the format of theAddress=theValue(13)

supported values for theValue are the text “on” or “off” which cause a non-dimmable unit in XTension to just turn on or off or a float or integer number. The Address value must have a corresponding unit in XTension with that exact string (non-case sensitive) as the units address. It will then receive the data as sent.

for example to turn a unit on you might send from your arduino something like:

println( “pin1=on”);


print( “pin4=”);

println( “off”);

to send a valid line to XTension. For numerical values make sure that dimmable is turned on for the unit in XTension and send something like:

float MyValue = 45.5;

print( “analog1=”);

println( MyValue);

As of build 842 it is possible to send non-numerical data to a unit in XTension too. If you send unitAddress=some string of not numbers then the value there will go instead into the description of the unit. You can then trap it for further processing by creating a handler in the ON script of the named unit like:

on descriptionChanged( newDescription)

and then the new description will be passed to you to do with whatever you choose.

If you do not wish to have XTension send you have local changes from the interface make sure to mark the units there as receive only. If you wish to have control in your arduino from XTension to parse the commands you can undertake to parse those simple commands yourself which is not difficult or send me a note asking me to finalize the arduino example code and get it uploaded to this page.

As a potential gotcha to keep in mind, XTension's address parameters will always be sent in uppercase, even if you created the units with lower case addresses. So keep that in mind when you're writing your Arduino compare code for the incoming address/command.

Arduino's connected via USB/Serial interfaces are supported as well as via xBee radios or TCP interfaces.

I've posted a long winded description of building some remote controlled PWM dimmable LED strip lighting in my sons aquarium over on the blog. Along with the arduino code necessary to do the communication with XTension. arduino, xBee and pwm lighting with XTension

supported_hardware/arduino.txt · Last modified: 2019/03/13 15:51 by James Sentman