Sending Data from IMU on Arduino to show in Serial through Processing

edited July 2014 in Arduino


I have a question about Bluetooth communication from Arduino to the computer to deliver realtime data shown in Processing. Below is my code. It works perfectly when the Arduino is hooked up to the computer via a USB (outputs all of the numbers that I want to see), but instead outputs null whenever I connect through Bluetooth instead. To my understanding, Bluetooth should act just like the USB and I shouldn't have to change much besides which COM port I open Serial to. Does anyone have any advice on how I can get this to communicate successfully with Bluetooth and read in the IMU data that I want? Thanks! :)

    //import class to set up serial connection with wiring board
    import processing.serial.*;

    Serial port;

    float data;

    void setup() {
      //set up window
      size(200, 250);
      color baseColor = color(102, 102, 102);
      currentcolor = baseColor;
      // List all the available serial ports in the output pane. 
      //port = new Serial(this, Serial.list()[1], 115200);
      String portName = "COM10";
      port = new Serial(this, portName, 115200);

    void draw() {
      if (port.available() > 0) {
        String data = port.readStringUntil('\n');
      else {


  • You need to know the baud rate of your Bluetooth module. It's probably not 115200.

  • The baud rate does work for receiving data (ie. I can send commands over to the board via Bluetooth). It just can't transfer data, as in it won't deliver realtime data and will only output null for some reason. Any other potential fixes? :O Thank you for the suggestion though!

Sign In or Register to comment.