Hi
like so many other people, I'm trying to read NMEA data from an EM-406a GPS unit. However, this question isn't about my project, it's about the serial connection requirements.
I know the unit is working as I can connect it via a USB connection to my computer. I have also verified that my sketch (below) works when I use another Arduino to transmit data. However, when I connect the GPS unit to my Arduino I don't get anything. the TX wire from the gps unit seems to be at around +3.5V whereas the Arduino TX pin seems to be at +5v: Is this what the problem is? This seems to be a very popular GPS unit for Arduino projects so I guess not but I've exhausted the other (obvious) possibilities. Do I have a problem with the board itself?
More detail:
I am using: MacOS 10.5.8, IDE version 0021 (have also tried 0022) and two Arduino Duemilanove boards (have tried both). The EM-406a unit is connected to the Arduino: Red wire ->+5v, Black wires(2) ->GND, green wire ->D9, white wire ->D8 (RGW are pins 234 on the unit respectively). The connection is a breakout from the USB cable so I'm fairly certain that the wires are intact.
I'm using NewSoftSerial to receive the data using this sketch:
#include <NewSoftSerial.h>
NewSoftSerial nss(9, 8 );
int rxpin=0; //hardware serial works
void setup(){
nss.begin(4800);
Serial.begin(4800);
pinMode(rxpin,INPUT);
}
void loop(){
if (nss.available()){Serial.print(nss.read(), BYTE);} // check NSS input
if (Serial.available()){Serial.println(Serial.read(),BYTE);} // check hardware serial input
}
To check that the sketch and receiving board are working, I have written a second sketch so that the other Arduino transmits an NMEA string from pin 1 at 2Hz. Both pins 9 and 0 receive the data from this fine.
Thanks mrtaylor. I've seen that post but "NewSoftSerial nss(9, 8,true);" returns "error: no matching function for call to 'NewSoftSerial::NewSoftSerial(int, int, int)' " - I'm using version 10 of NSS if that makes a difference?
Also - I'm not getting garbled data, I'm just not getting anything from the GPS unit - although I do if I connect the second Arduino to the same pin.
New twist - tinyGPS test_with_gps_device works perfectly when I hook up my Garmin Etrex. The interesting thing is that I had to connect it so that the Garmin earth wire went to pin 2 and the Garmin TX wire when to Ground. I've tried re-creating this with the EM-406a module with no success.
the TX wire from the gps unit seems to be at around +3.5V whereas the Arduino TX pin seems to be at +5v
The EM-406a uses 2.85V logic so I'm surprised you're getting 3.5 volts. Best guess is the Rx pin from the GPS is being fed 5V (way too high) from the Arduino and it is affecting the GPS. Remove the power, pull the Rx pin off and turn it back on and see if it works.
Hey wayneft,
No joy I'm afraid - I measured that voltage when the RX wire wasn't connected to the Arduino - I tried connecting it to pin 8 but it doesn't make any difference. When the GPS is connected via a USB cable and working (Ubuntu MM, TangoGPS), I still read around 3.2-3.5v between ground and TX - maybe I've got a shonky Voltmeter I've ordered a GPS shield etc. from SparkFun so finger's crossed that isn't a waste of money ("accidentally" bought some other toys too)! I hope that using a shield rather than a hacked together cable will solve the problem - will update post with results.
For now I've got my sketch working with the Garmin unit and it's happily spitting out lat / long or OSGB Easting and Northing so at least I know the board and sketch are ok.