A Small GPS Arduino Watch / Clock

by Oscar

Another Arduino GPS Project – Mini GPS Device

Some of the links on this page are affiliate links. I receive a commission (at no extra cost to you) if you make a purchase after clicking on one of these affiliate links. This helps support the free content for the community on this website. Please read our Affiliate Link Policy for more information.

Garlow is a mini GPS Watch that is based on the Arduino Nano board. It’s not really that “mini” compared to other commercial GPS watch like the Garmin, but I really made a great effort to bring the size down. In fact it looks more like a GPS clock. The first version Arduino GPS logger I built was based on the Arduino UNO, and it was larger than 2 packs of poker cards stacked together. It works just as well as a Garmin GPS watch.

Garlow stands for GPS Arduino Rechargeable Logger OLED Watch. It does what the name suggests: Accurate time, positioning related information are received from GPS satellites, and they can be logged on SD card and shown on a OLED display. It can be carried as a watch or simply left at the back seat of your car as a GPS data logger. The whole system is built on the backbone of an Arduino Nano board, with a Lipo power module which enables USB battery recharge.

During the development of this Arduino GPS watch, I discovered so many things and techniques that I didn’t know about the Arduino, for example I didn’t know you could save data on EEPROM, which is unaffected by power down.

Compoents, and Circuit Connection Schematics

So here are all the parts I used in this project.

  • Arduino UNO
  • Adafruit GPS Module
  •  Mini SD Card module
  • 0.96′ Mono Colour OLED Display
  • Power Cell – LiPo Charger/Booster
  • 600mAh 1S Lipo Battery
  • Some jumper wires

Wiring is easy, and soldering is minimum.  I used jumper wires so each component can be disconnected for future projects.

IMAG1225

 

IMAG1226

I built the case using Plastic Styrene sheet (my favorite DIY material). Everything is then glued together using hot glue, and some nylon screws and nuts.

IMAG1224

IMAG1227

IMAG1228

IMAG1235

IMAG1234

IMAG1233

GPS Insight

If you don’t know how GPS receiver works, check out my previous Arudino GPS tutorials first. It’s much easier to use a GPS library to help decoding the gps nmea sentences, and get the useful data directly. I am using TinyGPS for this project.

OLED Display Explained

There isn’t any formal or standard library for the 0.96′ OLED displays I bought from eBay, and the one provided by the seller isn’t that easy to use either, so I wrote my own OLED display library here.

arduino-oled-display

Micro SD Card adapter for Arduino

The SD card module is a random one I found on eBay where the Chinese manufacturers have made it dirt cheap (only $5). Most of them works with Arduino using SPI communication. There is a standard SD library provided by the Arduino Official, and here is a tutorial on this. However it was causing flash memory problem for me.

This is a tricky one. I written my sketch, and tested the GPS and OLED display, everything was working great, until I added the SD Card module, and the Arduino IDE was telling me my sketch is too big to upload!

After a long research, and tried many different libraries, I found an old SD library. Although it can only do “append”, it’s only 3KB when compiled. That’s all I need anyway as a data logger.

Lipo Battery Booster & Battery

Power Cell – LiPo Charger/Booster by Sparkfun. I used this LIPO booster in my DIY Bike Light project, works pretty well as a battery charger and voltage regulator at the same time.

You can leave the circuit running and charging at the same time. It cuts off when voltage drops below 2.6V. Some people found it cuts off at 3.2V or higher, that’s because when the device is operating, and it’s drawing current from the battery, the voltage would drop. When it reaches 2.6V, the fail safe kicks in, and disconnects the circuit, so the voltage of the battery gradually rises again, eventually back to 3.2V. However this will not trigger the booster to start until you charge your battery.

diy-bike-light-voltage-check-3-3V

I am using a 600mAh 1S Lipo battery from my little quadcopter. With the Arduino Nano’s analog input, I am able to check the battery voltage by connecting the battery+ to the analog pin directly. Same reason in the Bike Light project, I had to put a push button in between, so when it’s not pressed, it’s a open circuit. Otherwise current will be drawn from the battery constantly.

Programming

When it came to programming, It was quite a challenge for me. It wasn’t because of the complexity of the coding, but I was stuck with the limited sketch space on the Arduino. I kept getting “Sketch is too big” error, and I was struggling to try to reduce the size of my program. Following my previous post about tips on reducing Arduino sketch size, I was able to cut the compiled size of my code down, just under the limit of the Arduino UNO (around 32K KB), but still it’s 2KB over the limit of Arduino Nano.

After analyzing my code, I realize the biggest space consumer was the SD.h library, and it was taking 13 out of 32KB! After looking over the internet, I found some old SD card libraries tend to be smaller when compiled, but they usually only support FAT16 format, which means SD cards that are larger than 4GB won’t work. I saved another 5KB by using the fat16lib Library. Yes!

Not long after that, I ran out of flash memory again! I have added so many functionality I don’t really want to give up. So I started look for even smaller SD card module library. Eventually I was able to find FileLogger, which only takes 3KB of memory.

I will share my source code once I have finished optimizing it and commented everything.

Performance Tests

IMAG1232

Electrical Property

This GPS clock draws a total current of 40mA at standby mode (OLED turned off, SD card Modue turned off, only GPS working), and at 80mA normal operation (all on). The current consumption can be broken down to:

  • Arduino Nano – 20mA
  • GPS Modue – 20mA
  • OLED Display – 15mA
  • SD Card Module – 25mA

So with fully charged battery (600mA) it can run 13 hours on standby mode (with 10% left), and 6.5 hours on normal operation.

GPS Accuracy

The GPS positioning accuracy is about +/- 3 meters, as you can see from the video the result is zigzag. Update rate is very good which is 10Hz. It also works indoor but needs to be close to the windows.

gps_google

Conclusion

Here is the source code, if you find any bugs, or have any good idea please let me know!

https://code.google.com/archive/p/arduino-gps-watch/source/default/source

Leave a Comment

By using this form, you agree with the storage and handling of your data by this website. Note that all comments are held for moderation before appearing.

37 comments

sylvain 27th July 2019 - 6:34 pm

hello I would like to change the code to save
gps flight altitude on the map sd (ulm)
great job
super a +

Reply
İsmail Erol 29th January 2019 - 6:51 pm

Hi my friend. I want to download code but I cannot do it.
I think link broken.
Can u check link :)
See you again.

Reply
Amnart Boonpeng 22nd June 2018 - 6:39 pm

Hi Oscar,

Programming you use a Arduino IDE version? for compiler.
I’m use a Arduino IDE version 1.6.5 and compiler error code WProgram.h no such file or directory.

Thank you…

Reply
Nicklas 10th May 2017 - 11:09 am

Great Project!
Where can I find the code?
Google code seems to be blank

Reply
Mathieu 9th November 2015 - 9:44 am

Hi Oscar
Your project is very interesting and I try to do the same.
I search in the arduino sketch but I don’t find the pins to connect the screen. Can you help me please?

Thanks

Mathieu

Reply
Oscar 10th November 2015 - 11:47 am

the screen uses i2c, which is always A4 and A5, check out my oled tutorial.

Reply
Erwin Jabor 20th July 2015 - 11:49 am

Hi,
I just your commands about Arduino-Nano coming from China. It is not so easy to find an Arduino here. So I have to order them in China. This takes around 2 Months! I have here an Arduino-Nano that I can use to build an GPS. I’m coming so fare that I can see the data coming from GPS. The next step is to select the data, so I can use them. I don’t need an display, because the data only have to drive the rudder. I can test it here with the serial-output of the computer.
Is here some one that has a working skeleton ?

Regards Erwin Tagaytay – Philippines

Reply
Steve 19th April 2015 - 3:44 pm

Great project, Ive been trying to get an OLED and GPS working together for ages.. BUT that said i’m having some issues with the buttons.

Pressing them doesnt seem to do anything but touching them with my hand gives various reponses (Ive put serial.printl in the checkbutton routine), its as if there is a loose wire, but wondered if it was anything to do with “debounce”

I have the button wired up Pin 5 -> Button -> GND (tried Vcc instead of GND but no Joy) My questions are

1. Should button go to Vcc or GND
2. Do I need a resistor (as in a debounce curcuit)

once again congratulations on an awesome project
Steve

Reply
Oscar 20th April 2015 - 12:55 am

See how I use button with Arduino here:
https://oscarliang.com/how-to-control-a-servo/

Reply
Baczakó Attila 17th December 2014 - 3:22 pm

A great project congratulations. Where can you find a wiring diagram?

Reply
Oscar 17th December 2014 - 8:38 pm

sorry, no wiring diagram, but if you are looking for pin connections, it’s in the arduino sketch.

Reply
kitt 13th November 2014 - 4:50 pm

Hi,

Your project is very interesting. I try to upload it to my pro mini but I get lots of error messages. They are about:

Spi.h:36: error: ‘byte’ has not been declared
mmc.h:62: error: ‘byte’ does not name a type
nanofat.h:39: error: ‘byte’ does not name a type

Please see the full error message here:
https://www.dropbox.com/s/d9jp9ekd45obu1x/error.txt?dl=0

I copy and paste files in your library folder into arduino library folder. I have no idea what went wrong. Hope you can help.

Thank you,
Kitt

Reply
kitt 15th November 2014 - 4:30 pm

Now, the problem solved. It works after I changed and “WProgram.h” in FileLogger library to

After that I try to upload the code. I did come changing. What I changed are:
1. GPS Tx Rx pin
2. Botton pin to A6 A7
3. digitalRead to analogRead
4. botton conditions
botton A –> buttonA > 500
!botton A –> buttonA < 500

The rest remains the same.

Issue
1. program do not start after re-applying power.
2. seems like it never get into void loop. Screen becomes blank after GPS fix.
3. screen refresh rate is abnormally slow

Please see:
youtube.com/watch?v=jLP3gZcnjfA

Please help

Reply
kitt 15th November 2014 - 4:34 pm

Oh one more change:

SoftwareSerial baudrate from 9600 to 4800

Reply
Oscar 17th November 2014 - 1:36 pm

make sure this line is on top of each of these files with errors
#include

Reply
Frank 17th September 2014 - 7:03 pm

Hi Oscar,

yes i saw your video tool late and i use kml generator to display my routes via google earth.
Speed course was displayed, but nothing about altitude.. okay.. for a car it´s not very interesting.

It was a pita to create api keys for google, so i decide to make it more simple … :-)

Can you tell me the last step, how to implement (GPS) altitude to my sd card?

char buffer[90];

// lat_c[9];
// lon_c[9];
// time_c[9]
// date_c[11]
// total size – 38

int length = sprintf(buffer, “%s,%s,%s,%s,%s,%s,%srn”, time_c, date_c, lat_c, lon_c, altitude, kmh_c);
sd_status = FileLogger::append(“log.txt”, (byte*)buffer, length);
sd_entry++;

Will test it on my 250ér Miniquad, similiar to yours … next step is with a bmp085 baro.
A version that works without any displays, grabs the signal from my gps copter(UBX,APM) and serves data after a GPS FIX.

But at first you can really help me to get Altitude, and Course to my sd card.. , km/h works now.

KR
Frank

Reply
Frank 15th September 2014 - 8:21 pm

Sorry for hitchhiking/confusing this Blog, please delete older posts of me.
Now it´s working and data will be written to the sd card. :-)
Size is a matchbox format, which is very comfortable to mount it anywhere.(quadcopter .. bike.. etc.)

For other users:
You need a sd card with maximum size of 2GB, e.g. Trancend.. working like a charm.
If you have an arduino nano, connect the card to pins 10 to 13. Test it before with filelogger.pde and exclude #define MEM_PW 8. Power your SD Card via VCC (3.3V).

I take a short trip with my car and now i have some gps coodinates, but speed is mssing.
Next question is to import those data to google earth or or google maps to verify my trip?

Hope you can help me there @Oscar.

Thx for your good work!!!

KR
Frank

Reply
Oscar 17th September 2014 - 11:57 am

Great you figured it out :)
about how to import data to the map, Did you see my video, i used a website called gps visualizer to show the GPS data on google map.

Reply
Frank 15th September 2014 - 3:24 pm

It´s me again :-)

Filelogger Lib is working now with 2GB SD Card, but it won´t work with your sketch.
I have to disable #define MEM_PW 8 and the after i type “W” it appends the card with messages.
Card is directly powered and not via Output Pin.

12345Hello, this is my message. Just testing the FileLogger library.
Hello, this is my message. Just testing the FileLogger library.
Hello, this is my message. Just testing the FileLogger library.

My card will not work with your sketch.. Error1.

Any suggestions??

BR
Frank

Reply
Frank 14th September 2014 - 8:26 pm

Hi Oscar,

many thanks for your work. All is working except my SD Card (Error1).
I see in MMC lib this:
// PORTB pin numbers
//
// arduino D10
#define SS 2

Which Pin is SS Pin? Pin4 is reserved by GPS and PIN 10 isn´t working.
Which file will be created on the Stick? MyFile with some characters?
Would be great to finish your project.

TIA
Frank

Reply
marcos 6th September 2014 - 5:09 pm

Hi Oscar, great project – very useful. Thanks for posting the code, but would you be able to post only the code from the menu? Right now I don’t need the rest of the functions in and when I try to remove them manually many errors show up. If you have a done menu project just like this one and posted it it would be great.

Thanks a lot!

Reply
Nelson 30th July 2014 - 8:42 pm

I have a 1GB FAT16 formatted microSD in the Shield mentioned. All other (bigger) SD Libraries work with my SD-Card, just Filelogger does not.

Reply
Nelson 30th July 2014 - 2:59 pm

Hi Oscar, did you connect your SD-Shield using HW SPI? If so, on which pins did you connect it (11,12,13?). I am using Adafruits mircoSD Breakout (adafruit.com/products/254) and I cannot get it to work with the Filelogger Library. I formatted the microSD with FAT16 and created a file with the corresponding name in the code and included some characters (because as I read, the file needs to have at least one Byte inside it). All other (big) SD-Libraries work fine, but since my sketch size is already quite large, since I head to take u8g-Lib for my Display and Adafruits GPS-Lib for the GPS.
I would really like to use the Filelogger-Library but with all my tests I get the Resultcode 1 (“Result: Fail initializing”).
Regards, Nelson

Reply
Oscar 30th July 2014 - 3:32 pm

I connected the SD card module described here:
https://oscarliang.com/sd-card-arduino/

how big is your SD card, as I described in my post:

I found some old SD card libraries tend to be smaller when compiled, but they usually only support FAT16 format, which means SD cards that are larger than 4GB won’t work.

Mine is 2GB micro SD card, have you tried something similar?

Reply
Nelson 21st July 2014 - 4:15 pm

Thank you very much Oscar. Have a nice day.

Reply
Nelson 16th July 2014 - 6:47 pm

Hi Oscar, i think you meant main.cpp right?. I get compile errors on all drawBitmap commands like
start_up_logo
kmh
DregreeSymbol
minus

where did you store them? I don’t see any code in main.cpp where you load them first from somewhere.

And thanks a lot again for sharing your code. I’m learning a lot by going through your code.

Nelson

Reply
Oscar 17th July 2014 - 11:26 pm

oh, i missed two files sorry about that, i have re-uploaded the file, check again.

Reply
Nelson 16th July 2014 - 4:30 pm

Hi Oscar, thank you very much. Many regards from Switzerland, Nelson

Reply
Nelson 13th July 2014 - 4:40 pm

How did you do your menu system? Did you use an existing library or did you create it yourself in the code?

many regards, Nelson

Reply
Oscar 15th July 2014 - 4:22 pm

HI Nelson, the code is now available to download.
the menu is written by me, and it’s in the main.ino file.

Reply
Nelson 8th July 2014 - 8:44 pm

Hi, your project is exactly what i’m trying to build as well. But i am struggling with the same problem (code size). The parts I am using for my tests are
– Sparkfun Arduino Pro Mini 5V/16Mhz
– Adafruit Ultimate GPS v3
– Adafruit Monochrome 1.3″ 128×64 OLED graphic display (or 128×32 OLED)
– Adafruit Micro SD Breakout.
– unfortunately I cannot get an LiPo Charger/Booster here in Switzerland like the ones from Sparkfun (my be you have an Idea how to solve this)

But always the same problem everything is working fine except the SD Logging Function (because of the code size – I will try with one of the 2 libraries you described).

Your menu structure is fantastic and I would really like to implement this into my little project as well. How exactly did you realize this?

Would you mind to share the code? Does not matter if it is not documented I would really like to try it with the parts I have here.

many Regards from Switzerland,

Nelson

Reply
Oscar 9th July 2014 - 3:59 pm

Sure! I have always wanted to upload my code once I added adequate amount of comments in the source code, but I still haven’t got around doing that. I might just upload it anyway in the next few days!

thanks for the reminder!

Reply
Thomas Rutherford 16th May 2014 - 1:40 am

very intrested in the code too!! my wife is working on her own unit based on yours and no code = no working unit….please email me if and when you get it ready thanks alt email [email protected]

Reply
Olivier 2nd May 2014 - 11:18 am

Hi
Nice project and I am interested by your project, working also on a similar one. I will be glad if you can send me your sketch.
Thanks and best regards
Olivier

Reply
James Haley 2nd April 2014 - 7:13 pm

Oscar, nice job. I’m really new to electronics, but managed to build two working GPS receivers, one with a 16×2 LCD, and the other with a 2.2″ TFT (Adafruit) the 2nd one is pretty good, but about the dimensions of an iPhone, but twice as thick. I want to make one even smaller one and thinking of using Arduino Micro again and a smaller display like OLED, I’m really new to code, so that’s my big challenge. I would really like to get your code for this project…yours does lots more than I need, so that would really get my project going…

Thanks,
Jim

Reply
Dave 28th March 2014 - 5:05 am

When you’re ready to share, I’d be interested in seeing your code because I’ve been trying to build a similar project, one which uses a GPS, SD card, and a display with Arduino Uno. But I’ve been running up against memory limitations.

Reply
Oscar 28th March 2014 - 7:23 pm

thanks for your interest. No one said anything about the code, so i have already forgotten about it. i will upload the code somewhere soon. give me a couple of days.

Reply