How to see multiple sensors on an Arduino using serial-in watcher?


  • Ok, so I am working on building a wearable sensor that can control media in Isadora. The current hurdle is that the serial in watcher displays the two sensor values as one string of numbers instead of two separate values. I don't know if the issue is in my Arduino code or in the serial in watcher code, maybe both. If anyone could help me solve this it would be greatly appreciated. Relevant pictures and file attached below. 

  • Tech Staff

    @trian_glisain

    Perhaps you want to use 

    Serial.println();

    instead of 

    Serial.print();

    for the data output, that should separate the values (new lines). https://www.arduino.cc/referen...

    Or you could print some type of delimiter between them, so that you can parse them with in Isadroa.


  • @trian_glisain said:

    Ok, so I am working on building a wearable sensor that can control media in Isadora. The current hurdle is that the serial in watcher displays the two sensor values as one string of numbers instead of two separate values. I don't know if the issue is in my Arduino code or in the serial in watcher code, maybe both. If anyone could help me solve this it would be greatly appreciated. Relevant pictures and file attached below. 

    The new Arduino Firmata actor might make this super easy by saving you the trouble of writing your own Arduino code. You can get the alpha version in the top post of this thread. There's a lot of discussion about it in the thread, but you should be able to simply read the documentation (firmata-actor-help.html) included with the plugin.

    Best Wishes,
    Mark

  • Beta Platinum

    @mark said:

    Arduino Firmata actor might make this super easy

     I can confirm that the new Arduino Firmata Actor is the simplest way to read multiple sensors from an Arduino Board into Isadora.

    I have undertaken digital and analog sensor reading tests using Standard Firmata configured Arduino Uno and Arduino Micro boards. The only issue appears to be a known one reflected on the Firmata user forums and relates to the bleeding of data/noise across the analog read pins.

    From my tests with the Arduino Firmata Actor and what I understand from Firmata user forum, if your sensors are using the analog pins you may be better off using the Arduino IDE and ‘serial in watcher’ actor.

    Other than that caveat the Arduino Firmata Actor is super efficient for rapid prototyping in Isadora.

    Best wishes

    Russell


  • Thank you for the replies! I'll give the firmata actor a shot! A follow up question, I am using one of sparkfun's pro micro qwiic connect boards and I wonder if either of you had tried them out and had any issues with the qwiic connect signal. I have an uno as a backup just in case. 

    -Sean


  • @dusx I'm fairly new to code, so I'll look up delimiters and see if I can figure them out. Thanks for the direction!

  • Beta Platinum

    @trian_glisain said:

    sparkfun's pro micro qwiic connect boards

     I have had a quick look at those boards online. You can try one with the Firmata code - if you have time. The Arduino Uno should definitely work with the Firimata actor in Isadora. If the Sparkfun are a newer board the Firmata test application may not recognise them. However, some Sparkfun boards look similar to the Arduino Micro that I have been testing with. The Arduino Micro was not recognised by the Firmata test app but I was still able to use it with the Arduino Fimata Actor in Isadora.

    Best WIshes

    Russell


  • @bonemap Awesome, thank you!


  • @bonemap @mark So, I wasn't able to get firmata working on the sparkfun board, but I have it up and running on my Uno. The sensor I am running uses an I2c connection, but I can't figure out why it won't read. I tried addressing pins 18 and 19 to be pullup inputs or i2c outputs, but no change. Any thoughts? 

  • Beta Platinum

    @trian_glisain

    Hi,

    What type/ model of sensor are you attempting to use? 

    Best wishes

    Russell


  • @bonemap https://learn.sparkfun.com/tut... This is the sensor, I still don't know if firmata will work, but I just got it working with the serial in watcher. Just needed to seperate the values and make them Serial.Println like was suggested above. So the code was this. Then in izzy I just needed a second serial in watcher set to 2. 

    #include <SparkFun_ADS1015_Arduino_Library.h>
    #include <Wire.h>

    ADS1015 fingerSensor;

    void setup() {
      
      Wire.begin();
      Serial.begin(115200);
      
      if (fingerSensor.begin() == false) {
         Serial.println("Device not found. Check wiring.");
         while (1);
      } 
      
      fingerSensor.setGain(ADS1015_CONFIG_PGA_TWOTHIRDS); // Gain of 2/3 to works well with flex glove board voltage swings (default is gain of 2)
    }

    void loop() {  
      int data_1;
      int data_2;
      data_1 = fingerSensor.getAnalogData(0);
      data_2 = fingerSensor.getAnalogData(1);
      Serial.print(1, DEC);
      Serial.println(data_1);
       Serial.print(2, DEC);
      Serial.println(data_2);
     delay(50);
      Serial.println();
    }