Before integrating the GPS with the Arduino Mega, I wanted to test it on my Arduino Duemillanove. I connected the pins on the GPS to my Arduino Duemillanove in the following way:
- Pin 1+5: Ground (I connected this also the the cable shielding)
- Pin 2: +5V
- Pin 3: A4
- Pin 4: Not used
- Pin 5: Not used
- Pin 6 (grey cable): Not used
I then created a small Arduino that simply prints the incoming data to the screen:
#include <SoftwareSerial.h>
SoftwareSerial _gpsSerial(4,5);
void setup()
{
Serial.begin(4800);
_gpsSerial.begin(4800);
}
void loop()
{
if (_gpsSerial.available())
{
Serial.write(_gpsSerial.read());
}
}
I uploaded the program to the Arduino Duemillanove, and started the Arduino Serial Monitor, ensuring that the baudrate was set to 4800 in the monitor window. I placed the GPS module near my window, to ensure a good receiption. In the beginning I received almost empty NMEA strings from the GPS module, but after a few minutes the GPS was calibrated correctly, and started outputting data as expected:
No comments:
Post a Comment