GPS Bee Kit (Part 2)

In my previous article, GPS Bee Kit (Part 1), I have shown a few methods how to read NMEA messages directly from your computer without an Arduino. In this post, I will explain some basics of the NMEA message and how to make a simple interface with Arduino and GPE Bee Kit.

NMEA stands for National Marine Electronics Association. For GPS Bee Kit, it uses NMEA 0183 protocol. Let us look at the message received from Hyperterminal previously.

Received data from GPS at Hyperterminal

Notice that all the message starts with a dollar sign, ‘$’. The next two characters after $ identifies the talker and the next three characters after talker identifies the type of message. After the identifier, you will get the data with respect to the type of message. Each different data are separated by comma sign, ‘,’. At the end of NMEA string you will see an aterisk, ‘*’ follow by two digits of hexadecimal number which represents the checksum. The NMEA string actually ends after the checksum with , carriage return and line feed.

For more details on GPS NMEA sentence, visit here. This link explained very detail for each NMEA sentence, highly recommended.

When you get all the geographic coordinate data, which is the latitude and longitude, how can you verify it? If you are unclear with geographic coordinate system, Wiki has a good explanation on it. Now, I am going to show you how to verify your location with Google Map. Go to https://maps.google.com/

First, search for your location on Google Map.

Next, right click on the point you would like to get the location. Click on “What’s Here?”.

Finally you will have the latitude and longitude coordinate on top of the search bar.

Before this, I have shown how to test GPS data with several software. Now, I am going to show you how you can test and read the NMEA messages with an Arduino.

First I used software serial to read data from GPS, then I used the built in serial port on Arduino to display the data through serial monitor.

You need to include SoftwareSerial.h library in order to use it. It works almost the same as Serial in Arduino.

At the beginning of your program, you need to initialize which pins are you going to use for software serial. Then in your setup() function, you need to declare the baud rate of serial communication. Then you can read data just like how you used in Serial function.

For the next part, I am going to use one of the library available for Arduino, which is TinyGPS. You can download TinyGPS library here. This library ease your job to get all the information from GPS data.

To get all the information with the library, you need to read from the software serial first. Therefore, a char c is used to store the data received in serial pin. Then you need to encode the data received. It will return TRUE if the sentence received is valid. After the encode part is done, you can extract all the informations from the GPS.

gps.encode(c)

– Encode the serial data and returns true if the sentence is valid.

gps.get_position(&lat,&lon)

– Retrieves latitude and longitude information.

gps.crack_datetime(&year,&month,&day,&hour,&minute,&second)

– Retrieves each data and time informations in separate variables.

gps.get_datetime(&date,&time)

– Retrieves date in the format of ddmmyy, and time in the format of hhmmsscc.

gps.f_speed()

– Retrieves the speed information from GPS. Some other available speed information with conversion:

–gps.f_speed_knots() -> speed in knots

–gps.f_speed_kmph() -> speed in km/hr

–gps.f_speed_mps() -> speed in m/s

–gps.f_speed_mph() -> speed in miles/hr

My first test without velocity detailsVelocity added.Still in stationary.Moving along with GPS, velocity increased

I was actually cycling with one hand controlling the bicycle and the other hand holding my laptop together with GPS to test the velocity. That was tough! I should consider making all the data display on LCD perhaps, instead of serial monitor next time.

Some images of my final set up on Arduino:

GPS Bee switched on. Power LED lights up.The breadboard and Arduino are fitted in a boxGPS Bee kitAntenna attached on the outer layer of box, to ease the GPS receivingArduino and GPS Bee Kit on breadboard

Basically the Part 1 and Part 2 will provide sufficient information to understand how a GPS module works and how to use it with Arduino. I hope that all the information provided can help your understanding on GPS. If there is any suggestion or information to add on, or even any questions, kindly drop me a comment below. Of course, you can also share your GPS experience and ideas too.