Communicate with GPS using Arduino Uno

I have such a setup:

PC -> Arduino -> GPS. The GPS is powered with 5V and connected using RX/TX pins. Can I communicate directly with the GPS? in such a way that the Arduino forwards all serial communication from the PC to the GPS and from the GPS to the PC?

I have tried this but it doesn't seem to work.

0xKD:
I have such a setup:

PC -> Arduino -> GPS. The GPS is powered with 5V and connected using RX/TX pins. Can I communicate directly with the GPS? in such a way that the Arduino forwards all serial communication from the PC to the GPS and from the GPS to the PC?

I have tried this but it doesn't seem to work.

The method works, however your wiring of the rec and tx wires on pins 0 and 1 from the arduino to the GPS have to be swapped around when you want direct communications path from GPS to PC via USB serial link. If your GPS is shield based then the swap over may be difficult without modifying the shield.

Lefty

I'm not using a shield, and yes, I have connected RX to the GPS' TX and TX to GPS' RX, and uploaded the code. But when I use a Windows based tool to communicate with the GPS using the same COM port as the Arduino's, I get no response.

0xKD:
I'm not using a shield, and yes, I have connected RX to the GPS' TX and TX to GPS' RX, and uploaded the code. But when I use a Windows based tool to communicate with the GPS using the same COM port as the Arduino's, I get no response.

Not sure that is correct, can you spell that out further with arduino pin numbers and GPS signal name.

I'll try to spell in out better also.

When you normally want some sketch running in a arduino board to talk to a gps unit you have to wire:

Pin 0 (AVR rec) to gps tx
Pin 1 (AVR tx) to gps rec

However if you wish the gps to wire and talk directly with the on-board USB serial converter chip then wiring must be as such:
Pin 0 to gps rec
Pin 1 to gps tx

Lefty

The GPS has 4 pins. 5V,GND,TXD,RXD. TXD goes to Arduino Pin 0(RX), and RXD goes to Arduino Pin 1(TX). Not sure what you mean by 'rec'. Is it the same as RX?

Am I supposed to connect RXD -> Pin 0(RX) and TXD to Pin 1(TX)?

Arduino TX should go to GPS RX.
GPS TX should go to Arduino RX.

Which GPS are you using?

if you want to see the results on the PC, try using NewSoftSerial ( or SoftSerial for v 1.0 ) to communicate with the GPS, then relay the data to the pc as usual via the TX and RX pins and USB cable

I am using this GPS: http://www.rhydolabz.com/index.php?main_page=product_info&products_id=475

Datasheet of main component: http://www.rhydolabz.com/documents/gps_gsm/GPS1269_UserManual.pdf

heres part of a sketch I used on a gps clock, I only wanted the time but you can extract any data you want.
I have removed all my indenting system from the sketch as it upsets the group :slight_smile:
I use pins 14 and 15 as the Rx and Tx to the GPS ( in fact I only connected pin 14 as I was just receiving the sentances being churned out of the module every second. )

have a look at the references in the intro :-

/*
     Boffin1  GPS clock  based on  http://tronixstuff.com/tutorials > Chapter 19
 and code by Aaron Weiss of SparkFun Electronics;  http://bit.ly/99YnI6
 and code and libaries by arduiniana.org. and the people of the Arduino forum !
 Thank you :)
 */

#include <NewSoftSerial.h>
#include <TinyGPS.h>
#include <VirtualWire.h>

#define RXPIN 14 //   from the GPS tx pin
#define TXPIN 15 // 
#define GPSBAUD 9600 // baud rate of our UP501D GPS module. Change for your GPS module if different
// Create an instance of the TinyGPS object
TinyGPS gps;
// Initialize the NewSoftSerial library to the pins you defined above
NewSoftSerial uart_gps(RXPIN, TXPIN);
// This is where you declare prototypes for the functions that will be using the TinyGPS library.
void getgps(TinyGPS &gps);
int hourtens;
int hourunits;
int mintens;
int minunits;
int rxhours;
int rxmins;
int rxsecs;
//  ========================================================================
void setup()
{
  uart_gps.begin(GPSBAUD); // setup sketch for data output speed of GPS module
  Serial.begin(115200);
}
//  ========================================================================
void getgps(TinyGPS &gps)    // The getgps function will get the values we want.
{
  int year,a,t;
  byte month, day, hour, minute, second, hundredths;
  gps.crack_datetime(&year,&month,&day,&hour,&minute,&second,&hundredths);
  hour=hour+2; // my zone is GMT +2
  if (hour>23) { 
    hour=hour-24;
  }
  rxhours = ( int ) hour;
  rxmins = (int) minute;
  rxsecs = ( int ) second; 
  }   
}
//********************************************************************************************
void loop()
{
 getgps();
//whatever you want to do with the data
}  // end of loop

Will the GPS return no data at all if it is not receiving a signal?

0xKD:
The GPS has 4 pins. 5V,GND,TXD,RXD. TXD goes to Arduino Pin 0(RX), and RXD goes to Arduino Pin 1(TX). Not sure what you mean by 'rec'. Is it the same as RX?

Am I supposed to connect RXD -> Pin 0(RX) and TXD to Pin 1(TX)?

That depends if you want the GPS to talk to the AVR chip running a sketch
OR
If you want the GPS to talk directly to the PC via USB serial

Those require two different wirings to pins 0 and 1, so tell us what you want to talk with what.

That link you posted in your first post is showing you how to have your GPS talk to the PC, bypassing the AVR chip.

Lefty

If you want the GPS to talk directly to the PC via USB serial

This is what I want.

0xKD:

If you want the GPS to talk directly to the PC via USB serial

This is what I want.

Then wire connect RXD -> Pin 0(RX) and TXD to Pin 1(TX) but only after you either load that 'dummy' sketch into your AVR chip as that article showed, or simple run a jumper from reset to ground to keep the AVR chip electricaly isolated from the serial communications going on between the GPS and the PC.

Lefty

Got it working :grin:

Thanks Lefty!