I Make Projects . com
On the right project, some bad rust looks better than some good paint.

Main | Projects | About | Contact and Services

This is an older site. For my professional site and contact information, visit AE Innovations. You can also visit my new site at It Came From The Workshop.

The Deluxe Reverse Geocache Puzzle

What This Is

First, this is inspired by the original Reverse Geocache Puzzle which is an incredibly clever piece of work!

This device is a locked Pelican-brand case that is stuffed with electronics. It can only be opened when it is within a pre-determined geographical area; otherwise it remains shut and gives simple hints about where it needs to go in order to be opened. This is in contrast to what happens in Geocaching, where the physical location of a container is known and the container itself must be found. Instead, the container itself is held and the physical location must be found. Hence the name "reverse geocache".

A user has a limited number of attempts (default 50) to solve the puzzle. After 50 attempts the user is limited to one additional attempt per hour. If the box is at the proper location, it can be opened! If it is not, the box tells the user how far they are from the target location, how far they moved since the last activation, and how far they have to be from the target location in order for the puzzle to count as solved (example: "You must be within 1.0km of the target location").

The device has been specifically designed to be used multiple times and shared between people. To this end, once it is "solved" it can be quickly and easily reprogrammed with a new target location then passed on to the next user. The quick method is to actually bring the solved device to the new target location and tell it "Solve when you are HERE again" and resets to 50 attempts and a 1000m detection radius. For advanced users, the USB cable inside the box can be used to access a simple terminal interface where specific GPS coordinates can be set as well as number of attempts to allow, and detection radius to use.

I designed and built the Deluxe Reverse Geocache for the owner of a local business, MicroTek Corporation. The owner is an avid geocacher and wanted something a little different.

How It Works

Screw-cap covers protect the activation button, charging port, and key holder. A custom-cut lexan window covers the LCD. The inside has about an inch of space between the enclosures for a payload such as a notebook, etc. The circuitboard visible allows access to the Micro SD memory card which holds JPEG photos randomly taken by the onboard camera - but I'm getting a little ahead of myself.

To use the device:

  • The user pushes the activation button (under the red screw-top cap) and the device powers up.
  • The LCD lights up with a welcome message and announces how many times the device has been activated.
  • The device turns on the GPS and seeks a signal.
  • Once there is a solid fix, the user is told how far away they are from the target location. They are also told how far they moved since the last activation. (Number of attempts remaining, etc are also communicated.) A reminder to recharge the unit is also displayed in the event that the internal battery is getting low.
  • If the box is actually at the target location, a WHIRRRR-CLICK! is heard and the user is told to open the Orange cap. The barrier has been removed and the key can be retrieved - and the box opened!
  • The box allows resetting to a new location either by physically bringing it to the new spot, or by using a simple terminal interface over USB. The key is then re-locked inside, and the box can be passed off to a new person!
  • During every activation, a camera takes random photos. Once the box is solved the camera's memory card can be accessed and the photos viewed.

Some Design Details

There are a number of differences between the Deluxe Reverse Geocache and its original inspiration. Also, this piece of work turned out to be both easier and harder than I expected it to be! I'll share some useful tips about the construction and programming.

The device uses an Arduino Pro 3.3V as the main processor, a 20 Channel Helical GPS Receiver, a nice big LCD, and a variety of custom enclosures, connectors, and other components. The camera is a JPG Color Camera and matching JPEG Trigger board. A 6Ah Lithium-Polymer battery and charging circuit with a couple DC-DC voltage converters rounds out the system. A Pololu LV pushbutton power switch takes care of power control - activating the system powers it up, and when the job is done it shuts itself off. Thanks to the LV power switch, virtually no power is consumed when "OFF", which is a great advantage to a battery powered device with short and irregular "on" times like this one.

As mentioned, and unlike the original inspiration, the case itself is not locked from the inside - padlocks secure the case on the outside. The KEY is the part that is secured inside! When the puzzle is "solved", the key is dispensed to the user. This makes it easy to keep a "backdoor" - simply hold on to a copy of the keys.

The orange capped tube on the top right of the case is the holder for the key. A motor on the inside slides a solid barrier over to block access to the inside of the tube when the puzzle is locked. When unlocked, the barrier is moved out of the way and the key can be accessed. The motor is a Solarbotics GM3.

The early prototype / proof-of-concept so you can see what a messy process creativity can be:

The entire device is run from a large Lithium-Polymer battery, which is 3.7V. This posed a slight problem, since most motor drivers don't normally work on such low voltages. However it was easily solved by using a Z-Bridge which I was familiar with from playing with BEAM Robotics. It easily did the job and I had it on-hand.

A bit more about the camera

The camera deserves a special mention - not the electronics part (which is nearly completely self-contained) - but the design of integrating it physically into the device.

I wanted the camera to point more or less towards the user as it took some random snapshots but this was more challenging than I expected.

I mounted the camera lens into a hole in the top of the case, which of course points it straight up and not at all towards the user. To rectify this I placed a 30-60-90 Degree Littrow Prism over the lens. This essentially "bends" the view of the camera 60 degrees, so it now looks out towards the user.

Mounting it required a little care, but with the help of some Sintra (expanded PVC), small screws, E-6000 glue, and a custom 3-D printed prism holder I was set!

I designed the holder for the prism in Google Sketchup, and printed it on my Makerbot 3D Printer. For me, this is the sweet spot for the Makerbot's capabilities: small, geometrically simple objects that are nevertheless complex enough in shape that making them by hand would be impractical or impossible or just plain ugly. (Warning: Using your Makerbot in such a way is not very "revolutionary". But you can go back to making coat hooks, bottle openers, and shower curtain rings immediately afterward to retain maker-movement-cred, no one needs to know.)

Some Handy Software Bits

First of all, two Arduino libraries in particular are super-useful: NewSoftSerial (an improved software serial library) and TinyGPS - which provides an excellent way to process the raw GPS data from GPS units. Here are some specific tips:

GPS fix validity: The GPS software object from TinyGPS might be logically valid, but that doesn't mean the entire GPS object's data is guaranteed good. It's a good idea to check that the date and time and elevation, etc values are "sane" before trusting the data. After checking that the GPS data is valid (not stale, etc) just check that the other data isn't weird values like 9999999, the date isn't suddenly in the past, etc.

The Serial Graphical LCD from Sparkfun has quirks: In theory you can set the baud rate to whatever you want, but in practice it's extremely easy to 'reset' it back to the 115200 default. The only pins capable of 115200 on the Arduino are the hardware UART pins, so no software serial interface to the LCD for you - once it resets to 115200 (and it will, trust me) you will find yourself quite stuck. Also, the +V for the display is 6V but the interface is 5V. But hey, it's pretty and not too expensive. Just make sure you know the gotchas.

Calculating Distance Between Two GPS Locations: This is a math intensive problem, but luckily the work's been done before. Here's my code (requires floating point values for latitude and longtitude - see the TinyGPS documentation about that). This is the implementation code:

// Determine how many kilometers we are from the target location
float kms_toTarget = interDistance(flat, target_lat, flon, target_lon);

Now here are the functions:

// Find distance in kilometers between two lat/long (floats) in signed decimal degrees format (e.g. +/- xxx.yyyyy)
// Note: requires including math.h to work.
float interDistance(float lat1, float lat2, float lon1, float lon2)
  // To calculate distance between two lat/lon points with the Haversine formula:
  int   R = 6371; // in km (earth's radius)
  float dLat = toRad(lat2-lat1);
  float dLon = toRad(lon2-lon1);
  float a = (sin(dLat/2) * sin(dLat/2)) + (cos(toRad(lat1)) * cos(toRad(lat2))) * (sin(dLon/2) * sin(dLon/2));
  float c = 2 * atan2(sqrt(a), sqrt(1-a));
  return (R * c);

// Convert degrees to radians: multiply degrees by (pi/180)
float toRad(float degrees)
  return (degrees * 3.1415926 / 180);


That's it! Enjoy some miscellaneous photos of the building and design process.
Image one is the "hello world" for the camera embedded in the device. Sometimes the lighting comes out funny but the pictures wind up kind of cool as a result.

Other Reverse Geocache Puzzles

The one that started it all
The Frustromatic Box
A little Reverse Geocache Box

Main | Projects | About | Contact and Services

Original Content - Copyright 2010 (Except where specified)