Pages: [1]   Go Down
Author Topic: Communicate with GPS using Arduino Uno  (Read 1925 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17259
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17259
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
« Last Edit: December 08, 2012, 11:21:33 pm by retrolefty » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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)?
Logged

Offline Offline
Edison Member
*
Karma: 64
Posts: 2448
Now, More Than Ever
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Which GPS are you using?

http://incredulist.blogspot.com/2012/10/pmb-688-gps.html
Logged

"Hello, I must be going..."
"You gotta fight -- for your right -- to party!"
Don't react - Read.
"Who is like unto the beast? who is able to make war with him?"

Cape Town South Africa
Offline Offline
Edison Member
*
Karma: 19
Posts: 1217
A newbie with loads of posts, and still so much to learn !
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

With my mobile phone I can call people and talk to them -  how smart can you get ?

Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Cape Town South Africa
Offline Offline
Edison Member
*
Karma: 19
Posts: 1217
A newbie with loads of posts, and still so much to learn !
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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 :-)
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 :-

Code:
/*
     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





Logged

With my mobile phone I can call people and talk to them -  how smart can you get ?

Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17259
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
« Last Edit: December 09, 2012, 12:41:11 am by retrolefty » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
If you want the GPS to talk directly to the PC via USB serial
This is what I want.
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17259
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Got it working smiley-mr-green

Thanks Lefty!
Logged

Pages: [1]   Go Up
Jump to: