GPS module
From SquidBee
Add GPS position to your SquieBee (Arduino)
with the new GPS module from Libelium!!!!!!!!!
The GPS module
GND - GND
TX - Serial TX (transmit)
RX - Serial RX (receive)
Important issues!
* Handle with care the internal antenna. It's fragile
* The GPS module should be inside a plastic box, isolated from the environment.
* The antenna must be in horizontal position.
* For improving the satellites signal, the antenna has to be in a place with a clear sky view (no trees, no buildings...)
* Maybe the GPS module takes 2-3 minutes to get signal the firs time
The GPS module for Arduino is a small electronic circuit that allows to connect to your Arduino board to get position and altitude, as well as speed, date and time on UTC (Universal Time Coordinated). It uses the standard NMEA protocol (www.nmea.org) to transmit the position data via serial port.
Using the GPS module with a computer
This example shows how to connect the GPS module to an Arduino board and watch the NMEA sentences.
Connect the GPS shield as shown in the picture and then connect two short cables to +5V and GND from the GPS shield to the Arduino board. Finally, plug the USB cable to your computer.
Open a terminal program to listen the serial port. Use the following serial port configuration: 4800 baud, 8 data bits, no parity, 1 stop bit, no flow control.
You'll se the NMEA sentences coming from the GPS module
With these NMEA sentences you get position, altitude, speed... data (nmea.org).
Using the GPS module with Arduino
Connect the module to Arduino
Connect the GPS shield as shown in the figure. Arduino's UART (the serial port) is used to communicate with the GPS. Arduino has to read the NMEA sentences from the GPS and it will get all the position, altitude, speed... data. Serial port configuration: 4800 baud. (Serial.begin(4800);)
Using the GPS module with Arduino + XBee shield - Add real position to your SquidBee's network
Because of having two serial components at the same time, we have to use two serial port interfaces in Arduino, one for the XBee and antoher for the GPS. For the XBee (ZigBee communication) we are going to use the “normal” serial port and for the GPS we are going to use the SoftwareSerial library softwareSerial The pins for the GPS serial connection will be 8 and 9.
Understanding NMEA sentences
Code example
/*
* Copyright (C) 2008 Libelium Comunicaciones Distribuidas S.L.
* http://www.libelium.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Version 0.1
* Author: Marcos Yarza <m.yarza [at] libelium [dot] com>
*/
// include the SoftwareSerial library
#include <SoftwareSerial.h>
// Constants
#define rxPin 9
#define txPin 8
// set up the serial port
SoftwareSerial mySerial = SoftwareSerial(rxPin, txPin);
// variables
byte byteGPS = 0;
int i = 0;
int indices[13];
int cont = 0;
int conta = 0;
char inBuffer[300] = "";
int k = 0;
void setup(){
//setup for mySerial port
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
mySerial.begin(4800);
//setup for Serial port
Serial.begin(19200);
// setup the GPS module
Serial.println("Configurando GPS...");
delay(1000);
mySerial.println("$PSTMNMEACONFIG,0,4800,1,1"); // configure NMEA sentences to show only GGA
sentence
delay(100);
// command for setting time and position
mySerial.println("$PSTMINITGPS,4140.000,N,00053.000,W,0197,22,10,2007,11,40,00");
// "4140.000,N" means: Latitude 41º40'00.0" North
// "00053.000,W" means: Longitude 0º53'00.0" West
// "0197" means 197 m elevation
// "22,10,2007,11,40,00" means date and time (October 22, 2.007 - 11h 40min 00sec UTC time)
}
void loop(){
byteGPS = 0;
i = 0;
while(byteGPS != 42){ // read the GGA sentence
byteGPS = mySerial.read();
inBuffer[i]=byteGPS;
i++;
}
k = 1;
while(inBuffer[k] != 42){
Serial.print(inBuffer[k]); // write the GGA sentence
k++;
}
Serial.println();
delay(3000);
}
How to get it
- Libelium Shop : http://tienda.libelium.com
Downloads
Links:
- NMEA













