Moving Forward with Arduino – Chapter 19 – GPS part II

Learn more about Arduino and GPS in chapter nineteen of a series originally titled “Getting Started with Arduino!” by John Boxall – A tutorial on the Arduino universe. The first chapter is here, the complete series is detailed here.

Updated 24/01/2013

In this instalment we will continue to examine the use of our GPS system and Arduino through creating two more applications. Some of them may seem simple, but we will build on them later on to make more complex things. To review previous information, the first GPS instalment was chapter seventeen.

“Household official time”

At home we often have various discussions about what the actual time is. At first it sounds silly, but when you have clocks on the microwave, kitchen wall, a wristwatch, mobile phone, clock-radio, and so on – things can get a little out of hand. And my better half has all her clocks ten minutes fast. Insanity may prevail! So let’s make a nice big LED-display reference clock – something that wouldn’t look out of place in a radio or television studio:

Then when people start arguing over the time, you can point at your new clock and smile. From a hardware perspective, we will combine three or four things: our Arduino board, our GPS system, and the MAX7219 display driver. We will need the following items:

  • Arduino Uno or compatible board
  • the GPS shield bundle
  • Maxim MAX7219 display driver IC
  • two four-digit, seven-segment LED displays (common cathode). You could also rig up four separate digits with some patience;
  • one 1 kilo ohm resistor
  • one 10 kilo ohm resistor
  • one single pole, double-throw switch
  • a nice breadboard and some connecting wire
  • a separate 5V power supply – all those LED segments are thirsty, the completed clock uses under 350 milliamps with a brightness setting of 8:


Here is the schematic:



Although the sketch (download) may seem quite complex, it is just made up of things we have already examined in the past. The only unfamiliar part could be the MAX7219 display driver IC, which in itself is quite easy to use. There is a full part review and explanation here. It is most likely that everyone will have different LED display units, as the 4-digit modules can be hard to track for some people or too expensive –  so some more explanation is in order.

You will need common-cathode display modules. If you line the digits up from left to right, they will be numbered zero to nine with respect to the MAX7219 – so connect MAX7219 pin 2 to the cathode of your first display, and so on. With regards to the anodes (a~g and dp [decimal point]) – link each anode type together.

For example, if you have eight separate 7-segment display modules, connect each ‘a’ pin together, then to MAX pin 14. And so on. Here is the board layout – a real mess:


And our action video:

An interesting twist you might find of interest is the function:


Which allows you to alter the brightness of the LED display(s). The range is 0 to 18 – in my examples it has been set to 8. You could then make your clock dim the display brightness between (for example) 11pm and 5am – so when you wake up in the middle of the night the display won’t act like a frickin’  laser-beam burning into your eyeballs. Furthermore, dropping the brightness reduces the power consumption.


 “You went… where?”

Now it is time for what most of you have been waiting for – making a GPS tracking device. Now before you get too excited, it would be proper to make sure you have the permission of someone before you track them. From a hardware perspective this example is a lot easier that you think – it is just the Arduino board, GPS shield and microSD shield. You will need to install TinyGPS library if not already installed.

Then, we will need the following items:

  • Arduino Uno or compatible board
  • the GPS shield bundle
  • microSD shield and a matching memory card up to 2GB in size
  • portable power, for example an alkaline 9V PP3 battery and adaptor cable

Download the Example 19.2 sketch from here.

Don’t forget to format the microSD card to FAT16 before use. Once power is applied, the system will take a position reading and write it to the microSD card every 30 seconds. You can alter this period by changing the value in the delay() function at the end of  void getgps(TinyGPS &gps). The text file is closed after every write, so you can just turn it off when finished then take the memory card to the computer to copy the data.

Although the hardware wasn’t that interesting to plug together, what can be done with it and the data it captures is quite fascinating. To generate some sample data, I have taken the hardware for a walk to the post office. We will now open the file produced by our hardware and examine it further. If you would like to follow along, you can download the file from here.

The file is a typical, comma-delimited text file. You can examine it further using common spreadsheet software such as LibreOffice Calc. For example, if you open the file of GPS data from here, you will be presented with the following window:


You can see that the data delimits quite easily. Just click “OK” and the file will be presented to you.


So as you can see, there is time, date (remember – GMT), latitude and longitude, my speed (with a couple of anomalies) and random sensor data results (see the sketch). We can have this data converted into a much more useful form by using the GPS Visualiser website. Save the data as a .csv file. Then visit, and use the Get Started Now box in the middle of the web page. Select Google Maps as the output format, then upload the file. This will result in the following:


Just like normal Google Maps there are many display options you can choose from, and the GPS Visualiser web site has many tutorials about making the most of their service. If you look in detail you will see some “jittering” along parts of the track that are not representative of my movements (though I had just taken my morning coffee). This could be the result of the receiver module moving about in all three axes during my walk, one would imagine it would be a lot smoother inside a motor vehicle. So have fun with that.


Have fun and keep checking into Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column, or join our Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.


  1. Dear sir,

    I like to know how to transfer data from GPS shield to SD Shield.

    With regards,

    Sitarama Rao.

Comments are closed.