Skip to main content

Sending data between TouchDesigner and Arduino

Just like most other creative coding languages and platforms, TouchDesigner allows you to connect an Arduino and hook up sensors, LEDs, servos, etc. to your project.

The makers of TouchDesigner offer a guide about how to do this.
The article includes sample project files and Arduino code.

Although the sample has some annotations to explain how it works, we will explain a little bit more as it might still be confusing ;)

When you open the 'Arduino_sample.tox', you will be greeted with a screen like this:

You can use your mouse to rotate/move/zoom the blobby ball, see values coming in from the Arduino, and click on the grey rectangular button to send values back.

If you click on the little star icon in the bottom right corner of the blobby ball's container panel, it will take it out of interaction mode. You can now zoom all the way in to see the actual sketch inside the container.

This is where the actual TouchDesigner network is. The top section creates a grey button; if you click it, it will send a command to your Arduino (to turn on/off an LED).

The middle section handles incoming data (messages) from the Arduino.
It expects that the Arduino sends its messages in a certain format: i.e. "A1=123 A2=456". These represent two analog sensor values, like for example potentiometers.

The first box (serialin1) does the serial port communication with the Arduino. It can receive any incoming values. In the properties panel on the top right, you will want to make sure that the Port matches the port your Arduino is connected to, and that the Baud Rate (speed) matches that of the Arduino sketch.

The next box (select1) selects just one row (i.e. one line of received data, one message).

The third box (convert1) splits the line up into multiple cells. Have a close look at the "Split cells at" box - it contains a space character (' '), which will make it split the message at each 'space'. The result is two cells: each containing an Arduino pin name and the corresponding sensor value. (e.g. "A1=639")