December 08, 2022, 07:45:25 am

Serial Data from EMG Shield

Started by TiltSwitch, June 17, 2013, 08:38:08 pm

Previous topic - Next topic

TiltSwitch

I have the Demo sketch loaded to the OLIMEXINO-STM32 with one EMG shield on it. When I can get ElectricGuru to run it shows muscle activities, but when I monitor the serial port I get data that looks like this:

¥Z ÄË#+¥Z òÒ53PT¥Z
ÐÚôõ÷ñ¥Z´Ð   ÷ì¥ZÉÈ
ø¥Z÷Î;>_b¥ZæÛýçø¥Z³Ôó
é¥ZÀÍü õ¥ZäÍAEki¥ZëÙ   óþ¥ZµÓå
â¥Z½Ì ô ð¥ZÔÌ<<e_¥ZáØ ¥Z®ØýþÝ¥ZÈÍ
úë¥ZäÈ67WN¥ZúÕ"++¥Z½Ô÷ø


Can you offer me any advice as to settings I may have wrong or how to read this data? Thanks in advance.

LubOlimex

Probably the baud rate isn't correct. What bauds have you tried?

Best regards,
Lub/OLIMEX
Technical support and documentation manager at Olimex

TiltSwitch

Tried Several, currently set to 57600 baud. With current settings serial data looks like

¥Zþ,

¥Zžˆö-   ¥ZŸ ï!û î¥Z ù¥Z¡
þ2 ¥Z¢˜ÿ:¥Z£ñ&ýð¥Z¤ý*#   
÷¥Z¥ö¥Z¦¼    ¥Z§Œðøô¥Z¨ó$ô¥Z©

þ$¥ZªÞ&&¥Z«úüþ¥Z¬é$þ,¥Z­ý4   ¥Z®Ô- ¥Z¯qêü)¥Z°Çõ(ÿ¥Z±
û3¥Z²ø*,¥Z³‡ÿ!
¥Z´ªü"ùö¥Zµ


Any suggestions about what settings I should use? Thanks for your help.

LubOlimex

Hey TilitSwitch,

Yes, 57600 is the correct baud but the data format is not the standard UART packet. That is why the data seems coded it follows http://openeeg.sourceforge.net/doc/modeeg/firmware/modeeg-p2.c. You will need to write a packet decryptor and translator to receive meaningful characters.

There is such decryptor in every software suggested (ElecGuru, BrainBay, etc).

Best regards,
Lub/OLIMEX
Technical support and documentation manager at Olimex

olimex

Quote from: TiltSwitch on June 19, 2013, 08:37:10 pm
Tried Several, currently set to 57600 baud. With current settings serial data looks like

¥Zþ,

¥Zžˆö-   ¥ZŸ ï!û î¥Z ù¥Z¡
þ2 ¥Z¢˜ÿ:¥Z£ñ&ýð¥Z¤ý*#   
÷¥Z¥ö¥Z¦¼    ¥Z§Œðøô¥Z¨ó$ô¥Z©

þ$¥ZªÞ&&¥Z«úüþ¥Z¬é$þ,¥Z­ý4   ¥Z®Ô- ¥Z¯qêü)¥Z°Çõ(ÿ¥Z±
û3¥Z²ø*,¥Z³‡ÿ!
¥Z´ªü"ùö¥Zµ


Any suggestions about what settings I should use? Thanks for your help.


you should not see ASCII symbols as these are ADC readings in 0-255 range

TiltSwitch

I appreciate your responses, I think I am going at this the wrong way. What I really need is to monitor the analog data for two shields which would represent flexion and extension of the wrist. Can I simply read the values of the Analog pins (A0 and A1) and use a processing program to make decisions based on the data? I tried using

/*
  AnalogReadSerial
  Reads an analog input on pin 0, prints the result to the serial monitor.
  Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.

This example code is in the public domain.
*/

// the setup routine runs once when you press reset:
void setup() {
  // initialize serial communication at 57600 bits per second:
  Serial.begin(57600);
}

// the loop routine runs over and over again forever:
void loop() {
  // read the input on analog pin 0:
  int sensorValue = analogRead(A0);
  // print out the value you read:
  Serial.println(sensorValue);
  delay(1000);        // delay in between reads for stability
}


To read the Analog Pin and I get data but I get no change in the data when muscles are flexing under the electrodes.
Thank you for your help.

olimex

the shields have jumpers which have to be selected correctly to may connect to different analog inputs
make sure you have connected your shields correctly