Another Arduino GPS Project – Mini GPS Device
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.
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.
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.
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
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.
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.
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.
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:
So with fully charged battery (600mA) it can run 13 hours on standby mode (with 10% left), and 6.5 hours on normal operation.
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.
Here is the source code, if you find any bugs, or have any good idea please let me know!