I am working on my Bachelor project and plan to use a Teensy 3.2 to read 12 capacitive sensors. How would I start if I wanted to read and process the data in VVVV?
Thats my rough idea of what has to be done:
1.) Setting up an arduino program that sends the sensor data to a serial port
2.) Enable VVVV to read that serial port
Am I missing something? Can this be more complicated than I expect, because of e.g. compatibility issues? I am completely new to arduino and everything outside of vvvv, so I’m also looking for an estimation regarding the difficulty of this task.
re 1) this could probably simply be firmata, a generic program that you upload that then can be remote-controlled from a vvvv patch
re 2) in the helpbrowser search for “firmata” for help on how to communicate with a device running firmata
let us know if you have any more specific questions.
Thanks for the hint @joreg. I am going to look into this option. For now that answers my question. I’ll be able to do a praxis test in ~2weeks when I have the teensy.
Edit: This is what ChatGPT got me
#include <CapacitiveSensor.h>
CapacitiveSensor sensors[] = {
CapacitiveSensor(2, 3), // pins 2 and 3 are connected to sensor 1
CapacitiveSensor(4, 5), // pins 4 and 5 are connected to sensor 2
CapacitiveSensor(6, 7), // pins 6 and 7 are connected to sensor 3
// add more sensor pins here as needed
};
void setup() {
Serial.begin(9600); // initialize serial communication at 9600 bits per second
}
void loop() {
for (int i = 0; i < 12; i++) {
long sensorValue = sensors[i].capacitiveSensor(30); // measure capacitance of sensor with a sensitivity of 30
Serial.print("Sensor “);
Serial.print(i);
Serial.print(”: ");
Serial.println(sensorValue); // send sensor value to VVVV via serial communication
}
delay(10); // wait for 10 milliseconds before measuring again
}
//libs and objects needed #include “ArduinoJson.h”
StaticJsonDocument<1024> JsonOut;
and on your loop do something like
void loop(){
ReadAndPrintValues();
delay(500);
}
The function that does all:
void ReadAndPrintValues(){
JsonOut.clear(); // clear the json object old data
// do a loop to read all values and store it on the json object
for (size_t i = 0; i < 16; i++) {
Vcc[i] = capacitiveSensor(i)
JsonOut[“Vcc”][i] = Vcc[i];
}
// create a string object to send to the seriial port
String JsonOut = “”;
// put all json data on the string object
serializeJson(JsonOutMux, JsonOut);
//see all the data
Serial.println(JsonOut);
}
by doing this, from gamma you can use all the workfow to decode json objects