top of page
Search
  • Dror Margalit

Arduino to Touchdesigner

By Mary Mark and Dror Margalit


Over Zoom, from two different locations, we met to transfer information from an Arduino to a server. We connected the Arduino to WiFi, set up a server, and voila: Mary could send data to a remote server and it showed up on Dror's screen. From there, the possibilities are endless, connecting data from the real world and sending it anywhere.

An image of the potentiometer in Touchdesigner

Our end goal for this application was to connect the Arudino to Touchdesigner through WiFi and control visuals remotely.


Server

First, we set up a Node.JS server to receive JSON-formatted data using Express and BodyParser (as shown in this example). The data we wanted to receive was a sensor value and its number of in the sequence of the values. To achieve that we created a "post" function for the incoming data.


app.post('/adddata', (req, res) => {
    const { sensorCount, sensorValue } = req.body;
        if (sensorCount && sensorValue) {
        data.push({ sensorCount, sensorValue });
                res.json({ ok: true, data });
           }
        })

Then, we added two "get" functions:


one for presenting all of the data

app.get('/getdata', (_, res) => {
    res.json({ ok: true, data})
});

and one for extracting only the data from a particular incoming sensor value

app.get('/data/:sensorCount', (req, res) => {
    const { sensorCount } = req.params;
    const count = data.filter((count) => count.sensorCount === sensorCount)[0];
        res.json({ ok: true, count})
    });


Arduino

Once the server was up and running it was time to set up the Arduino. We used the "DweetPost" example from the ArduinoHttpClient library to send data formatted as JSON to the server.

Get all data

Access a particular data point

Touchdesigner

In Touchdesigner, we accessed the data from the server ready to control visuals remotely.

The incoming data is presented on line 9


The Arduino and server code can be found here: https://github.com/DrorMargalit/ArduinoToTouchdesigner




References:


Recent Posts

Peer-to-peer nose interaction

By Joann Myung and Dror Margalit In this project, we attempted to increase our online presence and create a feeling of proximity. Using PoseNet, we made users control their position on the screen base

bottom of page