MyoBridge - Direct Myo <-> Ardiuno Communication


by mechatronics

MyoBridge - Direct Myo <-> Ardiuno Communication

Hello everybody;

I am trying to send EMG data from Arduino to Matlab Simulink via UDP protocol. I wrote this code but the data sending with delay. Do you have any idea? Thanks

#include <MyoBridge.h>
#include <SoftwareSerial.h>
#include <SPI.h>
#include <EthernetV2_0.h>
#include <EthernetUdpV2_0.h>

SoftwareSerial bridgeSerial(2,5);

MyoBridge bridge(bridgeSerial);

//define the interface: Dreamer MEGA X2 PORT
#define SS 10 //Gadgeteer PIN 6
#define nRST 8 //Gadgeteer PIN 4
#define nPWDN 9 //Gadgeteer PIN 5
#define nINT 3 //Gadgeteer PIN 3

byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,0,12);
unsigned int port = 5678;

IPAddress Remip(192,168,0,11);
unsigned int Remport = 5678;


EthernetUDP Udp;
byte message[] = {0,0,0,0,0,0,0,0};

//declare a function to handle EMG data
void handleEMGData(int8_t data[8]) {

//the EMG data is 8bit signed integers. Just print them out:
Serial.print(data[0]);
message[0]=abs(data[0]);
Serial.print(" ");

Serial.print(data[1]);
message[1]=abs(data[1]);
Serial.print(" ");

Serial.print(data[2]);
message[2]=abs(data[2]);
Serial.print(" ");

Serial.print(data[3]);
message[3]=abs(data[3]);
Serial.print(" ");

Serial.print(data[4]);
message[4]=abs(data[4]);
Serial.print(" ");

Serial.print(data[5]);
message[5]=abs(data[5]);
Serial.print(" ");

Serial.print(data[6]);
message[6]=abs(data[6]);
Serial.print(" ");

Serial.print(data[7]);
message[7]=abs(data[7]);
Serial.print(" ");
Serial.print("\n");
}
void setup() {

pinMode(SS,OUTPUT); //Define the interfave :Dreamer MEGA X2 PORT Gadgeteer PIN 6 use SS
pinMode(nRST,OUTPUT);
pinMode(nPWDN,OUTPUT);
pinMode(nINT,INPUT);
digitalWrite(nPWDN,LOW); //enable power

digitalWrite(nRST,LOW); //Reset W5200
delay(10);
digitalWrite(nRST,HIGH);
delay(200); // wait W5200 work

//initialize both serial connections
Serial.begin(115200);
bridgeSerial.begin(115200);

//wait until MyoBridge has found Myo and is connected. Make sure Myo is not connected to anything else and not in standby!
Serial.println("Searching for Myo...");
bridge.begin();
Serial.println("connected!");

//set the function that handles EMG data
bridge.setEMGDataCallBack(handleEMGData);
//tell the Myo we want the filtered EMG data
bridge.setEMGMode(EMG_MODE_SEND);
//disable sleep mode, so we get continous data even when not synced
bridge.disableSleep();

// start the Ethernet connection and the server:
Serial.begin(115200);
Ethernet.begin(mac,ip);
Udp.begin(port);
}


void loop() {
bridge.update();
Udp.beginPacket(Remip, Remport);
Udp.write(message,8);
Udp.endPacket();
}

Last edit: Jan. 29, 2017 01:04 PM

by Fernhew

MyoBridge - Direct Myo <-> Ardiuno Communication

hello, hope you all are good.
Thank you all for the post and step by step tutorials. successfully burn the firmware.
after uploading the PrintFirmwareInfo example on my UNO board i am unable to connect with MYO.
does not proceed ahead after
“Searching for MYO….”
please help ,
Thank you
by larosh12

MyoBridge - Direct Myo <-> Ardiuno Communication

Hi,
I was able to flash the firmware on the module using arduino . Set the connections but currently the serial monitor
is stuck on “Searching for myo… ”.


on the myo band <Currently my myo's logo is flashing blue > .
by gjwlals111

MyoBridge - Direct Myo <-> Ardiuno Communication

Hello, I tried to use MyoBridge, But the Serial Moniter didn't work after “Searching for myo…”.
So, I need some help to yours.
I used HM-10 Bluetooth module CC2541 and CC Loader.
Because the file MyoBridge_CC2541 is .hex file, Then, I converted .bin file using hex2bin program.
During using CC Loader, the program occur “warning” because .bin file's block size was not 256kb.
I'm not sure the root cause whether warning or not.

Plz, Help me, my head is broken……

Last edit: Feb. 19, 2017 06:58 AM

by Pinzgauer16

MyoBridge - Direct Myo <-> Ardiuno Communication

Hello @ all

in that case, pls send me an e-mail. i have the CC2541.bin file available for the HM10 or HM11 Modul. Booth work correct.
The original CC2541.bin file is 137kB.
Thats the reason for your warning!
I also started a project in the year 2016, here you can find the current status with date Jan, 2017
here is the link


pinsolitsch83@gmail.com

kind regards
Peter

Last edit: Feb. 20, 2017 03:43 AM

by AreilR

MyoBridge - Direct Myo <-> Ardiuno Communication

Hello, I'm new here.
I'm trying to flash the myobridge firmware to an Itead blebee module. But i'm not sure i'm doing this right.
When I execute CCLoader.exe nothing happens. I downloaded it from the link I found here. Can someone please guide me through this?
Thank you.
by gjwlals111

MyoBridge - Direct Myo <-> Ardiuno Communication

@AreilR

by AreilR
Hello, I'm new here.I'm trying to flash the myobridge firmware to an Itead blebee module. But i'm not sure i'm doing this right.When I execute CCLoader.exe nothing happens. I downloaded it from the link I found here. Can someone please guide me through this?Thank you.

Hello, i don't understand your question correctly….
But, maybe i think you cannot run the CCLoader.exe, right?
The usage is you should run command prompt(cmd), and you should command that :
your_ccloader_path\CCLoader.exe <COM Number> <C:\your_binfile_path\firmware.bin> <0 or 1 (0:Arduino Uno, 1:Arduino Leonardo)>
The example :
C:\user\desktop\CCloader.exe 5 C:\user\desktop\CC2541.bin 0
by Pinzgauer16

MyoBridge - Direct Myo <-> Ardiuno Communication

hello,

you should open it in the terminal window -> cmd

if you simple double klick the download -> it doesnt work!
is it that you want to know?

kind regards Peter
by AreilR

MyoBridge - Direct Myo <-> Ardiuno Communication

Yes, that´s what I was missing, thank you for yout soon answers.
by AreilR

MyoBridge - Direct Myo <-> Ardiuno Communication

Hi.
I've read that many of you don't recommend using voltage dividers on the set up to flash the firmware into the ble module.
If I do it that way and the process is not succesfull, will I be able to try again using a different method (say a logic level converter) with the same module? or will it damage the module?
Thanks to all.
Moderator control