Making a tracking system is something that most of us wanted to have in our projects, and with all that modern technology offering us, it can be made very simply with our beloved board “Arduino” and a GPS shield. Today I will make a detailed comparison between our 1Sheeld GPS shield and the SparkFun GPS shield.
GPS stands for “Global Positioning System”, it was created by the US Department of Defense “DoD” in 1960 and got to public use in 1995 with orders from president “Clinton”.
The idea of GPS is to launch many satellites with 12000km altitude from the earth and with receiver units on the ground start capturing the signals comes from those satellites.
There are more than 24 satellites orbiting around Earth right now just to get your position, and to make the ground unit to work, it must capture at least 4 satellites and depending on the satellites readings it can get your location, date, time and even your speed, so can you imagine how much work made for you just to call for an Uber ride 🙂
Back to our Arduino shields, I compared between both and wrote detailed instructions on how to use them, the comparison will be long so let me summarise it first in the table below:
SparkFun GPS shield
No. of used libraries
File name has a limit
Yes (8.3 DOS format) i.e. only 8 characters
Get No. of satellites
Display data while operating
Complex “must use a laptop”
Simple “display it easily on smartphone”
Now, let’s take a step by step tutorial for both shields and at the end of this comparison you can easily make a tracking system from your school to your home and display your tracking data on Google Earth. So, let’s get started!
1- SparkFun GPS Shield
This amazing shield released by SparkFun is giving you the chance to get your location using GP3906-TLP GPS Module and it is also supported with an SD card module to save the GPS data on an SD card then start logging this data in a .csv file.
The Shield is a 1.0 shield and comes unsoldered so you must get stackable headers like these and also an SD card to log your data in like this.
The GPS is consuming high power so it’s supported with a 12mm cell battery pack, it is highly recommended to use but you can work without it (Will explain in the below steps).
And now after getting all the needed materials we can go with our step by step tutorial.
Step 1: Adjust the shield
As I said before that the shield comes unsoldered so you should get a soldering iron and solder like these to solder the stackable headers to the shield.
N.B: If you don’t want to get a 12mm battery, you should short the 3.3v Batt jumper like in this photo from SparkFun to keep the GPS module functional.
Step 2: Mount the shield over the Arduino board
Putting the shield over the Arduino board is a very simple operation just be careful not to bend any header while mounting it.
The shield has 6 reserved pins that you can’t work on. The pins are (0, 1, 10, 11, 12 and 13).
0 and 1 are for the UART port as it’s the way the GPS is communicating with the board so it will be banned to use the PC terminal to display the data as the PC also uses the UART port to communicate with the Arduino board, and here comes an extra feature on this board is that it supports the use of Software serial library which gives you the chance to use the pins (8 and 9) to work as a UART port with the GPS and leaves the port on pins (0 and 1) to work freely with the PC.
And for the (10, 11, 12 and 13) pins, they are used for the SPI port that the SD card needs to communicate with the Arduino board, so you have 6 banned pins if you are using this shield so be careful not to connect any hardware to those pins.
Step 3: Get an SD card
Get an SD card like we mentioned above and format it in any FAT format, it’s default for the SD cards to be formatted in FAT format, but just in case format it again to make sure it works properly with the GPS module.
Step 4: Download the libraries
The shield needs 4 main libraries to run which are:
SPI: It’s the library used to configure the SPI port of the Arduino to communicate with the SD card module and it also embedded in the Arduino IDE.
SD: This library is used to configure the SD card module itself and you can find it in your Arduino IDE.
SoftwareSerial: This library used to configure another port to work as a UART instead of the main UART port in the Arduino.
TingGPS++: This library is the most important library which is used to configure the GPS shield. It is a very simple library and it gives you the chance to extract a lot of information from the GPS module like longitude, latitude, altitude, speed and course.
You can manage any libraries from Arduino’s IDE, just click Sketch >> Include library >> Manage libraries >> type “The library name” >> then click install and you are good to go.
Step 5: Write the code
This is a code written by Jim Lindblom from SparkFun, it reads the GPS data like Longitude, Latitude, Speed, Course and Altitude and then logs it in a .csv file created on the SD card
if(!SD.exists(logFileName))// If a file doesn't exist
break;// Break out of this loop. We found our index
SerialMonitor.println(" exists");// Print a debug statement
SerialMonitor.print("File name: ");
SerialMonitor.println(logFileName);// Debug print the file name
Step 6: Build the hardware
Only add a 9v battery to power up the whole system, this schematic is for the SparkFun GPS shield, not the GPS logger shield cause its fritzing part is not available, it’s the same but only the SD card interface is missing.
Now you are ready to go out and gather the locations and we will do that just after setting the 1Sheeld system up.
2- 1Sheeld GPS Shield
And now it’s time to talk about our GPS shield
For anyone who does not know about 1Sheeld, it is a board that connects your smartphone’s sensors and peripherals to the Arduino, allowing your smartphone to control Arduino and Arduino to control anything on your phone.
The most important thing in 1Sheeld is that you can make a lot of amazing things with only 1 line of code!
So, here we are going to use the GPS and data logger shields to log the GPS data in an excel sheet on your smartphone everyday.
You will find two versions of it, the 1Sheeld for Android phones and the 1Sheeld+ for iOS and Android phones from 4.3 and above.
Now, let’s get started with the 1Sheeld!
Step 1: Adjust 1Sheeld
Warning! If you have an Arduino that works on 3.3V then you must make your 1Sheeld to work on the 3.3V mode since it may damage your board.
Step 2: Mount the 1Sheeld over the Arduino board
In this tutorial I’m using the Arduino UNO board but if you have a different shield you can check how to mount 1Sheeld to different Arduino board from this tutorial.
Step 3: Install Arduino library
Download the 1Sheeld library from here and after unzipping it, copy the folder to your libraries directory.
Or you can manage any libraries from Arduino’s IDE .. just click Sketch >> Include library >> Manage libraries >> type “The library name” >> then click install and you are good to go.
This code simply is logging the GPS longitudes and latitudes in an excel sheet using the data logger shield. In the beginning, I opened a new folder named GPS locations then I created two columns one to log the longitude and the other is the latitude.
It logs the data every 5 seconds and for 17250 times so it can log the data in 1 file for an entire day.
To reduce the library compiled size and limit its memory usage, you
can specify which shields you want to include in your sketch by
defining CUSTOM_SETTINGS and the shields respective INCLUDE_ define.
/* Include 1Sheeld library. */
/* Reserve a counter. */
/* Start communication. */
/* Save any previous logged values. */
/* Start logging in a new CSV file. */
/* Add noise level values as a column in the CSV file. */
/* Log the row in the file. */
/* Delay for 1 second. */
/* Increment counter. */
/* Stop logging after 20 readings and save the CSV file. */
/* Save the logging CSV file. */
After writing the code, make sure to set 1Sheeld UART switch to the upload mode before you upload your code on Arduino.
After uploading the code, the 1Sheeld is not ready to work until you switch it back to the operating mode.
Operating mode is turned on when the UART switch is pushed towards 1Sheeld logo.
Step 6: Use the 1Sheeld application
Open 1Sheeld application on your Android phone or iOS device.
The application will first scan over Bluetooth for your 1Sheeld, it will take a few seconds and the phone will find it.
Once it appears on your screen as 1Sheeld #xxxx, you will be required to enter the pairing code (the default pairing code is 1234) and connect to 1Sheeld via Bluetooth.
Step 7: Access the shield
Once you have chosen the GPS shield the app will ask you to activate the GPS in your smartphone.
Press Ok so you can open the shield successfully.
And as you see you can display all the data logged inside your smartphone in the same time it had been logged in the excel sheet, you can find lots of Arduino projects on the 1Sheelds’ website and here is a project for a quadcopter which uses the GPS shield of 1Sheeld in gathering data.
Step 8: Setup the hardware
The hardware is simple, just a 9v battery connected to the system to power it up and the smartphone connected to it through Bluetooth.
Now let’s go for a ride and compare between both shields after gathering their logged data.
Step 1: Get out to the street
After putting the SD card in the SparkFun shield and connecting the smartphone to the 1Sheeld now we are ready to go, I tried a lot to get any readings from the SparkFun shield at home but all I get is null and that was because this GPS shield doesn’t work indoors and I must go out for a ride and test in an open sky.
On the other side, the smartphone can get the locations from any place even when it’s in my pocket or in my home as it appears in this photo so I decide to put the whole system in a box while am on my way from home to work and see what we get after reaching my destination.
On my way to work, I wasn’t able to get the SparkFun shield data cause I don’t have a laptop in the street but I can see the 1Sheeld data as it can be displayed on my smartphone.
Step 2: Check the files after the journey
After reaching my work it’s the time to see what the files have, and what I get on the SD card of the SparkFun shield was a file of the same name as written in the code, I found the file in a .csv format as i write in the code containing all the readings I asked for.
What impresses me is the no. of satellites detected cause it can be a sign of what is the most covered locations and what not, but what bothers me is both the time it gets and the altitude! The time was unresonable and the altitude gives so wrong altitudes as it gives me a positive and negative values on the same road which is impossible.
Now is the time to check the 1Sheeld file
it’s only displaying the Longitude and the Latitude with the time and it was so accurate in the timing as you see in the above table.
Step 3: Turn your .csv file to google earth
I found a great tool named GPS Visualizer which can convert the .csv file readings into a .Kml file which is the files google earth can deal with so I can see the track I moved through very clearly on a real map.
Just open the GPS visualizer website and click on browse then choose the file you got from the SD card and choose to turn it into a .Kml file, it gives you the chance also to color your track so I chose to make it green as you see in this image.
Then I made the same operation with the file in the smartphone but I made the line in red color and here is what I get.
And when I open the both files in the same time I can see the both tracks in the time to check the accuracy but I found that sometimes the SparkFun GPS shield is not the same accuracy as the smartphone connected to 1Sheeld.
Like the line here in the beginning of my journey.
In the end of this comparison, I want to say that it was so interesting to operate those shields in this awesome experiment to get the tracking locations from my home to work.
I hope I have covered all the needed points and of course if you have any comments it’s my pleasure to leave it just under the blog :).
Arduino makers …. you can connect your Arduino to MQTT brokers(servers) and launch your IoT with Arduino IoT Shield! It’s the 1Sheeld IoT shield that will do the job for you. It’s one of the most important but recent Arduino shields in 1Sheeld. Simply, it turns your Arduino into MQTT client where you can publish and …
Monitor my home environmental parameters remotely is one of the most desirable things I have ever wanted to make. It’s not about purchasing such a system that can get the job done for me. But, passion to create it myself. So, today, I am going to connect the popular DHT sensor to an online MQTT …
“Oh God! … It seems like I have forgotten the door lock open, again” … the normal saying whenever I am in hurry to go out! Have you encountered this problem before? It always confuses me since I may even think that I have left the door lock opened, and once I go back, …
Here I am with another IoT-based home automation project; Arduino IoT Fan Control. Every day, I get back from work tired and feeling hot. No air conditioner here and the fan takes much time to start cooling the room, sadly! So, I was thinking why not controlling the fan from outside my home with my …
Have you ever forgotten to turn your home lights off when you got outside? Sadly, it happens to me all the time. And this causes confusion once I get my bills! Furthermore, here is one secret about me; I am a lazy man. I always want to control my room lamp from my sweet bed. …
Welcome to our home automation hacks series #3, for so many times I had problems with watering my plants while traveling abroad and I have always needed a way to control it remotely, then I decided to do it with one of the fanciest ways you may ever hear off, cause I’m gonna water my …