GeoCache Puzzle Box

Picture of the front of the box as it searches for a GPS signal

The front of my GeoCache puzzle box as it searches for a GPS signal

Last summer I built a GeoCache puzzle box as a gift. What is this puzzle box? It is based on Mikal Hart's Reverse GeoCache puzzle box (TM Mikal Hart, original article link is below). I read the article, and being a DIY college student, I decided to build my own puzzle box based on his design, only cheaper.

Mikal Hart's original article is here: http://arduiniana.org/projects/the-reverse-geo-cache-puzzle/

I started by doing some research on the parts required. Mikal Hart has a list of components in his article, and now there is even a website where you can go buy either the components or the a completed box (http://www.sundial.com/shop/) or just the electrical components necessary to control the box (except for the arduino and the GPS module, for some reason. Don't know why he didn't include those components). After pricing the components myself, I figured that I could build my own box (and learn about how everything works) for less. So I did.

I began with the GPS unit. Fortunately, Ladyada of Adafruit Industries has wonderful tutorials for GPS units, liquid crystal displays (lcds) and all sorts of other cool stuff. The tutorials that I used are listed below. Basically, I needed to learn how to get my position from a GPS unit, which outputs in a standard format called a NEMA sentence, and use that information to calculate where I am on the planet compared to where I want the box to open (I used the haversine formula to calculate how far the box is from the destination [where I want it to open]. Look it up on wikipedia if you like. It allows you to calculate the distance between two points on a sphere, and the Earth can be approximated as a sphere). Ladyada's tutorial teaches you all that you need to know and provides a library to parse the GPS data stream for you (basically, you don't have to understand how the GPS unit is outputting information. She wrote a library [code that you can use in your code] that checks for, collects and separates the GPS's output so that you can easily use the data it sends in your project. Nifty.) The tutorial also works for the GPS unit that I purchased from Adafruit industries. I chose that one because of the breakout board, which makes it easier to work with when trying to attach it to other circuits, the wonderful tutorial and the library to do the work of taking the data from the GPS for me.

Ladyada's GPS tutorial: http://learn.adafruit.com/adafruit-ultimate-gps

Next, I needed to pick an LCD. Adafruit again has a great selection of parts and a tutorial on how to use them. I chose a blue character (the letters are blue) OLED (organic light emitting diode) that has 16 characters per line and two lines to write on (16x2). It is not compatible with their backpacks, but I liked how it displayed much better than other LCD's. If one was looking for an easier LCD to use, I would go with one of the other LCD's that use I2C to communicate (I2C is a communication protocol that uses 2 wires. Hooking up the blue character OLED to my arduino used 6 wires. You can do it, but it's more wiring). The Adafruit tutorial is listed below.

Ladyada's LCD tutorial: http://learn.adafruit.com/character-lcds/overview

Now that I had a method to get my location and print out information to the user, I had to pick various other components for the actual project. I needed a button to allow the user to turn on the box, so I picked one that looked cool at the Adafruit store (www.adafruit.com). I also needed a servo motor (motor whose position you can control) so that I could precisely move a latch to lock the box. Then I needed to decide how to power it (batteries), what processor to use (an Atmega328p, the brain of an arduino), and if I wanted to put an arduino in the box. I decided against putting an arduino into the box, since I wanted to learn how to build an arduino clone, and I wanted to minimize the cost of the project. Links on how to build arduino clones are provided below. I also found a cheap cigar box on amazon.com and decided to use that as the box. I didn't need anything fancy. Just a box.

Arduino on a Breadboard: http://www.arduino.cc/en/Main/Standalone

Poor Man's Arduino: http://aeturnalus.com/robotics/poor-mans-breadboard-arduino/

So, now I had all the physical pieces that I needed, and now had to write the code to control the darn thing. I based my code on the GPS tutorial that Ladyada posted in her GPS tutorial at Adafruit. I won't go into the details here, but I basically wrote two programs: one to actually control the GeoCache puzzle box and another to test that code and see if it is working correctly. It's always important to test your code, as I didn't want it to fail after giving the box to someone as a present. I also added a backdoor mechanism to open the box in case of power failure or GPS failure. The box can be powered externally using two inputs near the hinge on the back, and after the box tries to shut itself down, if it is powered externally, it will automatically open itself (this kept me from driving to the place where it opened every time I wanted to test it).

After all the coding, testing, and assembling, I had a GeoCache puzzle box. It took around a month and a half to learn, build and test, but all in all I probably didn't spend more than 30 hours on the project. Not that I kept track. That's a rough estimate.

I hope this post is a useful guide to the methodology I used to gather the information required to build my GeoCache puzzle box and has some good resources. I may end up building another one, since I gave this one away as a gift and do not have it anymore. If I do construct another, I'll be sure to post the wiring diagrams and detailed photos of the build so that others can make this if they'd like. I've put a summary of the links below in case you want to click on all of them now.

Mikal Hart's original article is here: http://arduiniana.org/projects/the-reverse-geo-cache-puzzle/

Ladyada's GPS tutorial: http://learn.adafruit.com/adafruit-ultimate-gps

Ladyada's LCD tutorial: http://learn.adafruit.com/character-lcds/overview

Arduino on a Breadboard: http://www.arduino.cc/en/Main/Standalone

Poor Man's Arduino: http://aeturnalus.com/robotics/poor-mans-breadboard-arduino/

These are other pictures of the GeoCache Puzzle box, showing the internal wiring (messy. I'll try to make this less so if I build another) and the place on the back of the box to power it externally.

Internal wiring of the GeoCache Puzzle Box

Internal wiring of the GeoCache Puzzle Box

This is where one would power the box to open it no matter the location

This is where one would power the box to open it no matter the location

 

5 thoughts on “GeoCache Puzzle Box

Leave a Reply

Your email address will not be published. Required fields are marked *