Pages: [1]   Go Down
Author Topic: Transmit GPS information wirelessly using UNO and (2) Xbee's S1  (Read 1351 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Good evening all.

Been running into some issues for the past few days trying to transmit NMEA data using simple point-point communication on my Xbees. I have 1 Xbee connected to my laptop via Xbee Explorer(http://www.sparkfun.com/products/8687) as a receiver, and another xbee connected to my Arduino UNO via Xbee Shield (http://www.sparkfun.com/products/9588) as a transmitter. I have already proven wireless functionality with the PhysicalPixel sketch example.
Using the Parallax GPS module (http://www.parallax.com/tabid/768/ProductID/396/Default.aspx) I wanted to see the NMEA strings serially, so I modded the Seral.Read example found on the Arduino website. On the GPS Module itself, I have /RAW GND tied to groun on the UNO, VCC supplied with+5V, and SIO in Pin0RX.
Code:
int incomingByte = 0;

void setup() {
Serial.begin(4800);
}
void loop() {
if (Serial.available() > 0) {

incomingByte = Serial.read();

Serial.print(incomingByte, BYTE);
}
}

This is what I saw in the Serial Monitor:
$GPRMC,040022.035,V,0000.0000,N,00000.0000,E,,,150209,,,N*7B
$GPGGA,040023.035,0000.0000,N,00000.0000,E,0,00,,0.0,M,0.0,M,,0000*40
$GPGSA,A,1,,,,,,,,,,,,,,,*1E

Which was expected. I powered my UNO with another computer, set the switch on the Xbee shield to UART, and observed the terminal X-CTU where my xbee explorer was plugged into and saw that only a segment of the NMEA string was transmitted (shown below)
E,0,00,,0.0,M,0.0,M,,0000*40

After transmitting this data, communication between the explorer and UNO just hung up. I did a little research and found that since the GPS module is eating up my TX and RX pin so much that I can't transmit this information wirelessly ( is this a correct assumption?)
This is my flowchart interpretation of whats going on:



With this in mind, I decided to control the power of the GPS module by controlling the VCC input with a digital pin. I figured since the GPS never stops receiving information, I could temporarily turn off the GPS after receiving the NMEA strings, store the NMEA strings, serially write them (wireless when switched to UART) to my computer. But still no success. I am pretty much at an ends as to what I can do to get this information to transmit wirelessly. I have looked into Newsoftserial, but I have a feeling that only helps for controllers with multiple TX and RX pins.

If any other information is needed, please let me know.

Thanks,
GA

Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
After transmitting this data, communication between the explorer and UNO just hung up. I did a little research and found that since the GPS module is eating up my TX and RX pin so much that I can't transmit this information wirelessly ( is this a correct assumption?)
No, the assumption is incorrect. You can have only ONE device on either ends of a serial port - either the PC or the GPS. Not both.

Quote
With this in mind, I decided to control the power of the GPS module by controlling the VCC input with a digital pin. I figured since the GPS never stops receiving information, I could temporarily turn off the GPS after receiving the NMEA strings, store the NMEA strings, serially write them (wireless when switched to UART) to my computer. But still no success.
Not surprising. Turning off the GPS requires that it find satellites again every time you turn it on. And, you still have it connected to the hardware serial port, which won't work.

Quote
I have looked into Newsoftserial, but I have a feeling that only helps for controllers with multiple TX and RX pins.
No, the whole purpose of NewSoftSerial is to create software serial ports on devices that have only one hardware serial port. You DO need to use NewSoftSerial to read the GPS.

NewSoftSerial does, in fact, not play well with devices that do have more than 1 hardware serial port, which is fine because it is (generally) not needed on those devices.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok i'll do a little more research on the softserial. Although there is still something bothering me, why would this be a solution to my problem?  So the idea here is that the GPS information is interpreted by a digital pin that I specify. Why is leaving the rx pin unused beneficial to me. Any data transmitted is purely done by the TX pin, does this have to do with the fact that my system set-up is half duplex?

-GA
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey Paul, I have attempted to use the Newsoftserial with not much success. I used a simple example from their library shown below...

Code:
#include <NewSoftSerial.h>

NewSoftSerial nss(2, 3);
NewSoftSerial nss2(4, 5);

void setup()
{
  nss2.begin(4800);
  nss.begin(4800);
  Serial.begin(115200);
}

void loop()
{
  // Every 10 seconds switch from
  // one serial GPS device to the other
  if ((millis() / 10000) % 2 == 0)
  {
    if (nss.available())
    {
      Serial.print(nss.read(), BYTE);
    }
  }
  
  else
  {
    if (nss2.available())
    {
      Serial.print(nss2.read(), BYTE);
    }
  }
}

I am still not understanding why it would be beneficial to switch from one set of pins to another. GPS information can only be received through Pin RX on the arduino. The GPS receiver I have has only one dedicated pin for transmitting and receiving (the parallax one i linked earlier) maybe you can shed some light on some missing concepts here...

Quote
No, the assumption is incorrect. You can have only ONE device on either ends of a serial port - either the PC or the GPS. Not both.

ARG i'm still not understanding what you mean by this. So if the RX pin is being used by the GPS receiver, the TX pin cannot be used to talk to the computer at the same time? Should I buy a GPS with separate TX and RX pin? What is a better approach to just trying to implement complicated software? Any help would be appreciated as I am completely brain dead and lost as I have been working on this ever since I replied.

-GA
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
GPS information can only be received through Pin RX on the arduino.
This is the heart of your problem. The GPS data can be received by ANY digital pin on the Arduino, if you use NewSoftSerial.

Quote
I used a simple example from their library shown below...
There is even a simpler example that uses ONE instance of NewSoftSerial. That is the basis for your application.

Quote
So if the RX pin is being used by the GPS receiver, the TX pin cannot be used to talk to the computer at the same time?
You should not think of the TX and RX pins as independent. They form a pair that is expected to be connected to ONE device. You wouldn't wear one hiking boot and one sandal, would you. Shoes come in pairs. TX/RX pins come in pairs.

Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
This is the heart of your problem. The GPS data can be received by ANY digital pin on the Arduino, if you use NewSoftSerial.

I am still not seeing eye-eye on this.... Am I doing something wrong here?
Code:
#include <NewSoftSerial.h>

NewSoftSerial nss(2, 3);
NewSoftSerial nss2(4, 5);

void setup()
{
  nss2.begin(4800);
  nss.begin(4800);
  Serial.begin(115200);
}

void loop()
{
  // Every 10 seconds switch from
  // one serial GPS device to the other
  if ((millis() / 10000) % 2 == 0)
  {
    if (nss.available())
    {
      Serial.print(nss.read(), BYTE);
    }
  }
 
  else
  {
    if (nss2.available())
    {
      Serial.print(nss2.read(), BYTE);
    }
  }
}

I have the SIO pin on the GPS module attached to digital pin 2 on the uno. Still no data seen through the terminal.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I FIGURED IT OUT PAUL!! yay

Thanks for the insight!
Logged

Pages: [1]   Go Up
Jump to: