How to connect Arduino with Touchdesigner
How to connect Arduino with Touchdesigner
TouchDesigner is a node based visual programming language for real time interactive multimedia content, developed by the Toronto-based company Derivative.
It is very easy to connect Arduino with TouchDesigner and therefore you can use signals from Arduino to create real-time generative arts easily.
TouchDesigner is available for Mac and Windows. Download the latest version of TouchDesigner from here. More details about installation here.
TouchDesginer License Key
There is a free NON-COMMERCIAL license for personal use or learning and not for paying projects. This license includes all basic operations of TouchDesigner and is sufficient for beginners learning purposes. More details about Keying here.
After installation and keying, TouchDesigner should be ready to go!
Setting up Arduino
Firmata is a large piece of Arduino code that, when uploaded to the Arduino, allows users to control the Arduino directly from a computer without writing new code in the Arduino IDE.
To find the Firmata code, select
StandardFirmata. You should now see the code.
Select the Arduino board and port you, then upload the code and keep the Arduino connected to your computer.
- LED to pin 10 with 220Ω resistor
- Potentionmeter to pin A0
Setting up TouchDesigner
TouchDesigner has built-in functionality that allows us to easily interface with the Arduino using Firmata.
- Open the Palette inside TD.
- Find the
- Click and drag the “firmata” item onto the network editor.
This should create a COMP called “firmata”. This COMP, and its parameters, will be our tool for interfacing with the Arduino. The parameters section has three tabs that we need to work with: firmata, Pin Modes, and Pin Values.
Understanding the Firmata COMP
Parameters of Firmata tab
- Select the port that your Arduino is connected to. This is the same Port that you selected in the Arduino IDE when you uploaded Firmata.
- Turn the Active button to on
- Turn Report Analog Pins and Report Digital Pins to on
Pin Modes tab
This is where we set the functionality of each pin. We can choose if we want a pin to be
PWM(8 bit) or
Input(1 bit): This is our “digital read” functionality. we use this to read from physical buttons or switches
Pullup(1 bit): This is a modified version of “digital read” in which the pin is “ON” by default. This is a preferred way of working with physical buttons, as it requires less physical wiring.
Output(1 bit): This is our “digital write” functionality. We use this to turn the pin ON and OFF
PWM(8 bit): This is our “analog write” functionality. We use this to control the brightness of LEDs or the speed of small DC motors.
Servo(14 bit): Ideally you can control Servo Motors from this, but documentation is sparse and untested.
Pin Values tab
This is where we can directly control the Arduino Pins. In order to make this work, we need to make sure the pin we want to control has been set to either
Output(1 bit) or
PWM(8 bit) in the Pin Modes tab. We can then use our CHOP references to control the value of a pin by referencing a channel on a CHOP in our network.
The firmata COMP has two outputs that we will use to extract data from the Arduino. There are several outputs on this COMP, two of them are green and the rest are purple. The green color means that they should connect to a CHOP and the purple color means the output should connect to a DAT. We want to see the data in CHOP form. Connect a
Null CHOP to the first (top) green output (renamed as analogIn) and another
Null CHOP to the second green output (renamed as digitalIn).
The first green output tells us the values coming in off of the Analog Pins and the second green output tells us the values coming in off of the Digital Pins that have been set to Input(1 bit).
Setting up the panel
How to make/use a reference
Hold and Drag the referencing data, usually a CHOP channel and Drop to the parameters you want to control.
Then select CHOP reference.
More about referencing.
First, setting up a network for controlling the LED (write).
- LFO CHOP
- Math CHOP - set the range 0 to 1 (map the slider value to 0-1)
- Null CHOP - rename this null CHOP to
- In the firmata COMP’s panel, go to the Pin Modes tab and change Pin 10 to
- Go to the Pin Values tab and make a reference to the single channel in the ledPin CHOP.
Now, you should see the LED turning on and off.
Second, setting up a network for getting signals from the potentiometer (read).
- connect a Null CHOP to the top output of the firmata COMP (show us our incoming analog values)
- Create a circle TOP
- In the circle TOP’s panel, use a reference to the first channel (aka AO pin of Arduino) of the output CHOP to change the radius of the circle.
Now, if you turn the potentionmeter, you should see the size of the circle changing.
You should have something like this at the end.
If you have trouble setting up the network, you can download the td_firmata.toe file here. Find more details about this tutorial here.