Pages: [1]   Go Down
Author Topic: Wrong data reception on Arduino Mega 2560 UART  (Read 925 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 4
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello to all.... I am interfacing a Heart Rate Sensor from Nonin (the Xpod) and the sensor sends 3 bytes once a second, I receive 3 bytes, but completely wrong, don't know why. I'm doing a passtrough but don't know why... I expect to receive <163><127><127> and I receive <46><64><64>.... do you know why?... I'm working with the Arduino Mega 2560, and using a Hardware UART on it (N°1), the sketch is very simple
Code:
char incoming_char;

void setup{
   Serial.begin(9600);
   Serial1.begin(9600);
}

void loop{
  
    if(Serial1.available()){
      incoming_char()=Serial1.read();
      Serial.print(incoming_char);
      }

}

Any help will be appreciated... Or some example sketch will be very very useful.... Thanks to all....
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 597
Posts: 33314
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

What sort of output has your Heart Rate Sensor. Is it RS232?
If so then you need a level converter chip like a MAX202 to convert the RS232 signal levels into TTL signal levels. The level translation also includes a logic inversion and this is why you are seeing rubbish data.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 4
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

All that Nonin says is "The output is TTL"... that is weird....because the Mega (and all arduino boards) have TTL UART's.... any ideas?. By the way, I have a logic level converter form Sparkfun Electronics...
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 4
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Solved: I disconnected the level shifter on the Xpod evaluation cable and now everything is fine.

Thanks to all!
Logged

Pages: [1]   Go Up
Jump to: