N3: No-Nonsense Navigation
N3 (No-Nonsense Navigation) is a handheld GPS receiver, but without all the nonsense. A toggle switch turns the device on (and off) and as soon as it has a fix, the current position is displayed on the screen. While switched on, N3 also automatically logs your journey to an SD card so you can look at it later. It can run for about 10-12 hours on a pair of AA batteries which can be changed in the middle of nowhere if neccessary.
This project attempts to scratch an itch casual walkers such as myself and my dad seem to have with comercial GPS devices. I usually simply want to occasionally find out my current position as a Ordenance Survey grid reference in order to check my position on a real, paper map. Though perfectly capable of doing this comercial receivers seem to want me to navigate through pages of menus or enter waypoints while holding the map down in the wind before they tell me where I actually am.
The user interface consists of an 8x2 character display, a toggle switch to turn the device on and off and a push button. The GUI consists of a set of "windows" which are cycled by pressing the push button. Windows are only displayed when they make sense. For example, when there is no fix, the position windows are not displayed but the "I'm Lost" window can be.
HD44780 displays support the definition of 8 custom characters. These were used liberally to add some primitive graphics to the UI which made for some fun (if sometimes somewhat unclear) pixel "art". Below is a series of (simulated) screen shots of the various windows and their splash screens.
I'm Lost (No Fix)
Ordnance Survey Grid Reference
Irish Ordnance Survey Grid Reference
WGS-84 Latitude and Longitude
Ordnance Survey (OSDN) Altitude
Mean Sea-Level Altitude
GPS Date & Time
SD Card Status
Converting from the latitude and longitude values produced by GPS modules to OS grid references, and in fact just understanding what this really means, proved to be a project in itself which I've described elsewhere.
The device is built on the LeafLabs Maple Mini, an inexpensive, compact ARM Cortex M3 based microcontroller board. LeafLabs offer a very clean, well-thought out, well documented wrapper around many of the built in hardware peripherals as well as an implementation of most of the Arduino standard library. This meant that while I could trivially drive the LCD using the LiquidCrystal library while using more advanced features such as Direct Memory Access hardware (DMA) with minimal fuss.
As such the software is pretty straight forward but makes use of a number of hardware features I've somehow never tried to use in the past. Most notably, the software puts the device to sleep for the vast majority of the time. The device is woken up whenever a button is pressed or the GPS module produces a position update and as soon as the display has been updated as required, it goes immediately back to sleep.
The hardware in N3 is fairly straightforward though it proved a real challenge for a hardware newbie like myself to squish it down to a hand-held size. Inside the box lives:
- Maple Mini
- A small Cortex-M3 (ARM) board which runs the show.
- Locosys LS20031 GPS Module
- A GPS module with built in antenna which provides raw position data.
- 8x2 LCD (HD44780 Compatible) Display
- A tiny, easy to control character LCD.
- Boost Converter
- Efficiently boosts the AA battery voltage to 5v
- SD Card
- Used to store routes, accessed via SPI.
The original messy breadboard prototype can be seen above.
I originally hoped to 3D print an enclosure on the aging MakerBot Cupcake I worked on during my unversity 3rd year project. Since I had no 3D design experience what-so-ever, the design itself proved to be a difficult task on its own.
The case needed to be handheld, water proof (to a degree) and have an easy-to-open battery compartment -- a significant challenge to the first time designer. Ultimately my plans were met with failiure when the printer failed to reproduce my test designs every tool-less entry battery compartment I could come up with. As a result, the plan of 3D printing the encolosure was abandoned.
After hours of scouring the web for hand-held sized waterproof enclosures with battery compartments which didn't look absolutely dreadful I eventually gave up and bought the ugly enclosure you can see in the pictures. Sadly (yet unsurprisingly) despite claims of being splash-proof by the datasheet, it probably wouldn't stand up to some light rain. On the other hand, it is still a reasonable size and features a AA battery slot and so would have to do (and live in a waterproof map case on rainy days).
Before breaking out the soldering iron, a quick final check that the parts would all fit was in order. Though pretty tight, it looked like a go-er!
A Few hours of soldering later and the messy (though by my (low) standards, pretty tight) soldering was complete. Surprisingly everything (just about) still fitted inside the enclosure. All the exposed components were wrapped in insulation tape to prevent shorts, a perspex window was glue-gunned in front of the hole for the LCD in a vain attempt to improve the sealing of the case.
I was originally hoping to cram the software into the (accuratly named) ATtiny85 or at least an Arduino Pro Mini to make connecting the peripherals easier. This plan unfortunately didn't work out for two reasons:
AVR-GCC doesn't support compiling support for (software) double-precision floating point numbers. If you try and use them you end up with single-precision numbers instead. For many applications this would be fine but when converting coordinates into OS grid references this lack of precision can result in some cases of positions being being out by many hundreds of meters.
After painstakingly re-writing my conversion routines to use a double precision math library, I finally discovered that the 32 kb of code space simply wasn't going to be enough space.
My next thought was to use an mbed but was immediately put off by the power consumption figures. I eventually (re)discovered the Maple Mini which is a similar microcontroler but without a lot of the "magic" mbed add-ons. What I soon discovered was that they also provide an absolutely astoundingly slick development experience.