Connecting Arduino uno to Surface Electromyography via Bluetooth

Hello all,

I've built a small motor circuit, using the arduino Uno rev3, and am able to cycle it on and off manually and with a timer. My goal is to get the motor to respond to a Bluetooth signal sent by a small SEMG device so that it vibrates when the device reads a certain amplitude.

I know that I will need a Bluetooth module (I'm thinking HC-05). The SEMG device sends out a constant signal. Is there anything that I need to know about the SEMG device in regards to setting it up on the Arduino?

I figure the code will be a fairly simple high/low script based on the signal, but I'm not certain. Any help is greatly appreciated.

Hello
I think you may run a BT tutorial to gain the knowledge.

Great advice. I'm looking for a good one right now!

It will be useful to know the device's Bluetooth protocol. If it is a plain-vanilla SPP device, it should be able to work with an HC-05 and, if it can do that, anything Arduino needs to do will probably be quite straightforward.

Thanks for responding!

It's an LE device and it's automatically discoverable. I've got the UUID and I'm setting up the BT module now.

I'm thinking I can just pair the Arduino via the BLUE shield to the EMG sensor with:

socket = device.createInsecureRfcommSocketToServiceRecord(UUID.fromString("My specific UUID"));

  inputStream = socket.getInputStream();
  outputStream = socket.getOutputStream();

Then to set the parameters:

#define motorPin 13
int data = 0;
void setup() {
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, LOW);
Serial.begin(9600); //default baud rate for bt 38400
}
void loop() {
if(Serial.available() > 0){ // Checks whether data is comming from the serial port
data = Serial.read(); // Reads the data from the serial port

      if (data == '0') {
        digitalWrite(motorPin, LOW); // Turn motor OFF
        Serial.println("motor: OFF"); 
        }
          else if (data == '1000') {
            digitalWrite(motorPin, HIGH);
            Serial.println("motor: ON");
           
          } 

}
}

In that case it is incompatible with the HC-05.

I see. Thank you. Im guessing I need a BLE shield or an HM-10. Im looking now but all of the modules I see are for phone pairing using a specific app. Im just trying to pair using the UUID for my sensor.

Am I in the right ballpark with the code from above?

Thanks again.

Probably.

The modules are not specifically for phone pairing at all. It is just that that is the most common approach, with the phone acting as master. All that means is that the phone app initiates the connection.

In your case Arduino is the master, i.e. IT initiates the connection, and HM-10 is up to that. Indeed this is surely a simple SPP datastream job, and the so-called "fake" CC2541 HM-10 should be fine. The UUID is essentially the same as an HC-05 MAC address, and does not bring its own problems.

I have little experience with BLE, and you will probably get more enlightenment on the Martyn Currey website.

I'll look into that website. Thank you very much!

I'm now able to communicate with the Arduino through Bluetooth via the HM-10!

Now I just need to figure out the code to receive the signal from my BLE SEMG device and then to set the parameters for my motor. I'm getting there!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.