After applying a few minor adjustments to the Adafruit NeoGeo watch Arduino code and a few months of procrastination, I’ve made a device that indicates roughly how far I am from any number of destinations that I set. All of the code I used is here on GitHub.
The idea to create this little contraption came from my Geocaching adventures with my nieces and nephew: my little device currently tells me where a dozen or so caches are located in Windsor, Ontario, but I’ve also configured it to point me towards coffee shops and other places closer to where I live.
Each light in the device corresponds to a target within 1 km of my current location. Notice that as I rotate, the lights hold their approximate directions of the targets. Red indicates close, blue indicates very far away.
Most smart phones will do a significantly better job of navigating to any location, especially Geocaches. When I Geocache with my family, we often only have one person who has a working phone app at a time; so I’m wondering if it might be more fun to navigate outdoors with multiple navigation devices, especially with kids. But even if we already had multiple phones for navigation: I enjoy programming, coding with Arduino is very easy, I already had most of the pieces that I needed lying around from other projects, and I was really curious to see what it’s like coding with something that has a GPS module. Learning how to work with GPS coordinates kind of sets me up for other interesting projects down the road.
How it Works
The code in the device calculates, once every 20 ms, the distance from its current GPS coordinates to every destination that is entered into an array. Luckily, the Adafruit NeoGeo watch had code that performs this calculation for one destination, so I basically just extended their code to compute distances to any number of destinations with a loop. The code then converts these distances to colours, from 0 meters (red), to 1000 meters (blue), and the compass is used to determine which light in the ring should be activated. The lights that are activated “point” in the direction that the person using it needs to move towards in order to reach destinations that are within 1000 meters (i.e. – 1 km).
The Modifications I Made
Most of the code I used was based on the NeoGeo watch code. I simply modified their code
- to adjust the brightness of the lights (the lights were too bright when demonstrating its use indoors),
- to change the colours so that they would start at blue (far away) to red (very close),
- to introduce a threshold distance, so that destinations over 1000 meters away won’t be displayed,
- to add a yellow circulating pattern to indicate when none of the destinations are located within the threshold distance of 1 km,
- to account for the compass to be orientated facing up (instead of down),
- by removing its ability for the device to tell the current time, which might be cool, I’m thinking of putting it back, and
- to display multiple distances simultaneously by adding more arrays into the code.
The NeoGeo watch instructions places the GPS on top of the compass, but that would hide the compass and FLORA chips, and I think the device is way cooler looking when it shows them off.
I soldered a ring of LEDs, a compass chip, and a GPS chip to a micro-controller. I already had the tools and some of the hardware that I needed (it was only the LED ring and GPS chip that I needed to purchase):
- a $10 NeoPixel ring with 16 LEDs (the colours of the LEDs are controllable!)
- a $25 Adafruit Flora (the Adruino micro-controller), which I already had lying around from another project
- a $40 GPS module specifically designed for the Flora,
- a $20 compass (i.e. – magnometer) and accelerometer sensor
- bits of hook-up wire and solder to connect the components together,
- a small LiPo battery,
- “small” dabs of glue to fix a plastic tie to the Flora microcontroller, and
- a nylon military wristband.
Multiple Destinations in the Same Direction
There are only 16 lights, so if multiple destinations need to activate the same light, only the closest of those overlapping destinations is displayed. Adding another NeoPixel ring with a different diameter could help, but for Geocaching, overlapping lights aren’t a major issue, I think. More significantly, there isn’t a way to tell the Flora to stop giving you the distance to a cache you’ve already found or don’t want to navigate to. I’m not sure how to adjust for that, but maybe that’s ok. I think I’ll always Geocache with at least one phone.
Maintaining a Satellite Fix and GPS Errors
From time to time, the GPS chip loses its connection with satellites, or the GPS decides that there are no destinations within 1000 meters, perhaps because it is placing its coordinates incorrectly (or because of something silly I did with the code). In any case, the latter problem seems to be easily fixed by resetting the device. The former problem seems to be unfixable. Perhaps I need a better GPS chip?
Finally, I brought this device with me to Canada for the Easter weekend, but sadly the battery cables snapped off before I even got to field-test it. I didn’t have a soldering iron with me to fix it, and our attempts at fixing it with duct tape and glue didn’t go very far. Lesson learned: simply have a spare battery on hand.