Test serial with bluetooth serial app on phone?


#1

I’m trying to use muse with an arduino (xadow rephone), so I’m trying to experiment with the Muse Communication Protocol. I tried sending it some serial commands via the arduino, but didn’t get anything back, To test it, I tried pairing the muse with an android device, and using a bluetooth serial terminal app to send the ASCII commands, but have still had no luck getting anything back from the muse.

I can pair it with the android phone and use the muse app to use the headband.

I would prefer not to use an android device as part of the final application, which is why I’m going Muse Communication Protocol route.


#2

Get an HC-05 and you can talk direct to the Muse.


#3

Thanks for your response!

Is there anything particularly different about the HC-05 module that differentiates it from other bluetooth modules for Arduino?

I’m working with a xadow rephone, which has Bluetooth built in (here are details if they are pertinent: http://www.seeedstudio.com/wiki/Xadow_GSM%2BBLE).

The rephone uses the LinkitOne bluetooth library and as mentioned, I can connect to the muse headset using the xadow rephone. I just don’t get any information back when I send it any of the serial commands. That’s the part I need to fix - why I’m not getting any response from the headset to serial commands.

I also asked about whether it’s possible to use a bluetooth spp app on an android phone to test the serial commands - I thought doing that would allow me to eliminate potential problems with my code, and just test what I’m getting back from the headset. But although I can use them to connect to the headset, and send ASCII commands, I don’t get anything back.

Are there any pieces of example code using the HC-05 bluetooth module and an arduino to connect to the muse? I’ve checked out the muse sharp project and AtlantsEmbedded but didn’t see anything that I was obviously missing between “connect to the headset” and “start sending it serial commands”.


#4

There’s nothing special about the HC-05, it’s just cheap and I’ve used it successfully myself to talk to Muse.
Before you start, switch into AT mode and pair, then all you need to do to get data streaming is send a few commands.

This should get you started:

SoftwareSerial btSerial(10, 11); // RX, TX Note 3V3 shift needed on D11(BT_RX)

btSerial.begin(19200);
btSerial.write("v 2
");
waitForConnection(); // Wait for 
 from the device so you know it's connected ok.
btSerial.write("r 2
");//Android
btSerial.write("% 12
");//EEG+Acc
btSerial.write("s
");//Start streaming data

Debug with a manual commands using something like this:


void loop() {
    if (btSerial.available()) {
      Serial.write(btSerial.read());
    }
  
    if (Serial.available()) {
      delay(10);
      btSerial.write(Serial.read());
    }
}


#5

Thanks a lot! I’ll try adapting that code to the library I’m using / see if I can use software serial and let you know if I have any luck!


#6

Yay, that got me rolling! Thanks a lot!

I’m now able to stream data from the headset, I just have no idea how to do anything with it - I haven’t worked with binary data in arduino before. If anyone is having luck with that, I would love to see what you’re doing. I’m bashing away at it (currently attempting to put bytes into an array and then … read bits from them?), but any further help / direction / suggested further reading (I am referring to the http://developer.choosemuse.com/protocols/bluetooth-packet-structure docs) would be greatly appreciated.


#7

Yay, that got me rolling!

I’m now able to stream data from the headset, I just have no idea how to do anything with it - I haven’t worked with binary data in arduino before. If anyone is having luck with that, I would love to see what you’re doing. I’m bashing away at it (currently attempting to put bytes into an array and then … read bits from them?), but any further help / direction / suggested further reading (I am referring to the http://developer.choosemuse.com/protocols/bluetooth-packet-structure docs) would be greatly appreciated.