Go Down

Topic: Communicate with GPS using Arduino Uno (Read 2300 times) previous topic - next topic

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.

retrolefty


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

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.

retrolefty

#3
Dec 09, 2012, 05:17 am Last Edit: Dec 09, 2012, 05:21 am by retrolefty Reason: 1

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

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

Runaway Pancake

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
"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?"

Boffin1

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
With my mobile phone I can call people and talk to them -  how smart can you get ?

0xKD

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

Boffin1

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: [Select]

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





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

0xKD

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

retrolefty

#10
Dec 09, 2012, 06:32 am Last Edit: Dec 09, 2012, 06:41 am by retrolefty Reason: 1

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

0xKD

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

This is what I want.

retrolefty


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

0xKD


Go Up