How to send x2 sensor data from Arduino → TouchDesigner

hello

Q. Is there any way I can send x2 (or more) real-time pulse sensor data from Arduino to Touch Designer?

It’s my first post, recently I am trying to connect the x2 pulse sensor to the Arduino and send the real-time pulse data to the Touch designer via Serial DAT. It worked well with x1 pulse sensor on Arduino and I could see real-time pulse sensor data appearing on Serial DAT. However, when 2nd pulse sensor was attached there was a random alphabet appearing on the serial DAT monitor but no essential data was transmitted on the Touch Designer.

What I am trying to achieve is to send x2 pulse sensor data from Arduino to Touch Designer but so far I haven’t solved it by myself.

< Below are what I tried so far (& failed) >
(1) Attach x2 pulse sensor with x1 Arduino UNO, send data to TouchDesigner via USB modem and insert serial DAT. *Result: Serial DAT displayed random alphabets and no essential data was seen on the TD.

(2) Attach x1 pulse sensor on each Arduino UNO, connected on PC via a USB modem. Before opening on serial DAT, realized the second type C port on my mac was for battery only (it’s a shame since this is such a basic).

(3) Use firmata instead serial DAT, later learned firmata is for regulating Arduino from Touch Designer.

Material:
Pulse sensor (http s:// pulsesensor. com /)
Arduino UNO, Arduino R3
USB Modem
M1 MacBook Pro

I know this is very basic but I only used both Touch Designer and Arduino for two weeks so any advice is appreciated.

Thank you for your time & support!

Hello,

I never use firmata, not very reliable and not easy to maintain.
I wrote a general arduino and TD system alowing 53 digital and 6 analog input
You can use it, just change the number of input to suit your needs, mine is made to use the 53 Mega’s inputs. A little bit too much for Uno!
There is some comment in the code but not many.

void setup() {
  //start serial connection
  Serial.begin(9600);
  //configure pins 2 as input and enable the internal pull-up resistor
  for (int i = 2 ; i <= 53; i++){
  pinMode(i, INPUT_PULLUP);
  }
}

void loop() {
  //read the pushbutton value into a variable
  String sendVal = "v";
  for (int i = 2 ; i <= 53; i++){
  sendVal += digitalRead(i);
  }
  //print out the value of the pushbutton
  Serial.println(sendVal);
  //read analog into variable and print it
  /*
  String A = "A";
  A += analogRead(A0);
  Serial.println(A);
  String B = "B";
  B += analogRead(A1);
  Serial.println(B);
  String C = "C";
  C += analogRead(A2);
  Serial.println(C);
  String D = "D";
  D += analogRead(A3);
  Serial.println(D);
  String E = "E";
  E += analogRead(A4);
  Serial.println(E);
  String F = "F";
  F += analogRead(A5);
  Serial.println(F);
  */
  delay(10);
}

arduinoReceipt.toe (4.7 KB)

Hello

Thank you very much for the code example. My knowledge of writing Arduino sketch is still beginner, so I’m trying to adjusting it to fit my sensor & pin numbers. There was no example of transmitting multiple sensors data to Touch Designer, so your example was very helpful. Again, thank you so much for your reply!