Go Down

Topic: Problem with Arduino nano and GPS (Read 1 time) previous topic - next topic


I bought a arduino nano clone and a up501 fastrax gps. I am using the code from the arduiana website. The gps works with the uno but not the nano. I tried other sensors like lm35, bmp085 and they work fine with both uno and my nano. I tried on another new nano, different computer as well as with different baud rates but no luck. Any ideas? Here is the code I'm using:

#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3);

// Connect the GPS Power pin to 3.3V
// Connect the GPS Ground pin to ground
// Connect the GPS VBAT pin to 3.3V if no battery is used
// Connect the GPS TX (transmit) pin to Digital 2
// Connect the GPS RX (receive) pin to Digital 3
// For 3.3V only modules such as the UP501, connect a 10K
// resistor between digital 3 and GPS RX and a 10K resistor
// from GPS RX to ground.

// different commands to set the update rate from once a second (1 Hz) to 10 times a second (10Hz)
#define PMTK_SET_NMEA_UPDATE_1HZ  "$PMTK220,1000*1F"
#define PMTK_SET_NMEA_UPDATE_5HZ  "$PMTK220,200*2C"
#define PMTK_SET_NMEA_UPDATE_10HZ "$PMTK220,100*2F"

// turn on only the second sentence (GPRMC)
#define PMTK_SET_NMEA_OUTPUT_RMCONLY "$PMTK314,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29"
// turn on ALL THE DATA
#define PMTK_SET_NMEA_OUTPUT_ALLDATA "$PMTK314,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0*28"

// to generate your own sentences, check out the MTK command datasheet and use a checksum calculator
// such as the awesome http://www.hhhh.org/wiml/proj/nmeaxor.html

void setup() 
  Serial.println("Adafruit MTK3329 NMEA test!");

  // 9600 NMEA is the default baud rate
  // uncomment this line to turn on only the "minimum recommended" data for high update rates!

  // uncomment this line to turn on all the available data - for 9600 baud you'll want 1 Hz rate
// mySerial.println(PMTK_SET_NMEA_OUTPUT_ALLDATA);
  // Set the update rate
  // 1 Hz update rate
  // 5 Hz update rate- for 9600 baud you'll have to set the output to RMC only (see above)
  // 10 Hz update rate - for 9600 baud you'll have to set the output to RMC only (see above)


void loop()                     // run over and over again

  if (mySerial.available()) {
  if (Serial.available()) {


Well the last bit of your code is not going to work.   

You will be sending only every second character from the GPS to the serial monitor.

You need something more like this

Code: [Select]

while ( gpsSerial.available() )
    char ch = gpsSerial.read() ;
    SerialMonitor.print(ch) ;


Since I have myserial as a Software Serial object as long as a call it myserial.print() I should be able to access it. If I initialized it as Software Serial gpsserial then I had to call it by saying gpsserial.print(). Also since the code works on one board there is no problem there. The problem is what is different in the clone boards that this does not work. I appreciate your help on this matter. Thanks.


So the EXACT same code works on the Uno but not the nano,  is that what you are saying ?

Have you confirmed that the nano upload process works,  by uploading some other simple program to it ?


I figured out the problem...what i was doing was that from the gps two pins go the the arduino ground. I was connecting both the pins to the same arduino ground. But since the uno board already comes with the female header pins there is no way to insert two wires to the same ground pin.

When I grounded the gps pins two two different arduino ground pins, it started working. I dont know what exactly is the reason the previous setup did not work as before it was 2 pins grounded at the same point (and the connections were properly grounded) Thanks for all the help. I really want to find out why it doesnt work...maybe im missing something. If you figure it out let me know. Thanks.



did you figure out what happened in your case ?

I'm facing the same problem here.
Have no problems using an Arduino Uno + GPS UP501.
But, if I do the same connection to my Arduino Nano, it doesn't work.

I checked the grounds as you did, used one, two, both gnd but nothing made it work.

Does anyone has an idea ?

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131