Satellite Sports Network Words
LOG IN JOIN
 
HOT LINKS: Overview  ·  CACHING BOX.COM  ·  PODCACHER.COM  ·  GEOCACHING.COM  ·  WORLDWIDE LINKS TO EVERYTHING GEOCACHING  ·  GLOSSARY  ·  TYPES OF CACHES  ·  ETIQUETTE  ·  U.S.A. GEOCACHING TRAIL MAPS  ·  MORE LINKS
 

The start of the Reverse Geocache Puzzle Box


by Mikal Hart

 

The Reverse Geocache™ Puzzle

The "Reverse Geo-cache" Puzzle

Fig. 1 - The Box

[Author's note: This post is the first in a real-life story that ultimately took a full year and four chapters (1, 2, 3, 4) to tell. Read them all, then browse through the other surprising puzzle box stories that have popped up along the way.]

Early this summer, the friend who first introduced me to Arduino amazed us with the news that he was moving to France to get married. Once I recovered from the surprise, it occurred to me that putting together some sort of Arduino-based wedding present might be a uniquely fitting thanks for his years of friendship and for helping get me started in this delightful enterprise. And so after weighing several ideas — I didn’t fancy adding some ugly techno-junk to the pretty collection of tea cozies and china sets — I finally settled on building the device I describe here: a puzzle box that won’t open until it is taken to a certain location.

To better understand my conception, let’s fast forward and imagine the gift opening. The new couple, freshly back from their honeymoon, remove the wrapping to reveal a book-sized wooden box elaborately carved with elephant images. (I didn’t carve it; I bought it that way at World Market.) Mounted into the lid, perhaps incongruously, are an illuminated button, a small display, and a mysterious module that sharp-eyed readers might recognize as a GPS. There’s also some kind of connector tucked away on the box’s left side. More about that later.

What do they make of all this? It’s hard to guess, but naturally I imagine they might try to open it up and take a look inside. When they do, however, they find the lid stuck tight — it seems to be latched from the inside. Will they push the button? Pretty buttons are awfully hard to resist, so let’s assume so. The blue display fires up and displays a friendly, personal greeting:

Bonsoir, famille Immel!
This is attempt 1 of 50.

Huh?

Now they don’t know this yet, but the box’s embedded electronics require a good GPS fix – something that’s probably hard to come by inside a Parisian apartment. And so the display flashes “SEEKING SIGNAL” for a couple of minutes and gives up.

No signal acquired...
Powering off...

Now my hope is that they’ll realize they need to take the box outdoors or near a window. Is that a stretch? I don’t think so. My friend is a patient fellow with an engineering background, so I expect he will at least try moving it before throwing it against the wall or chiseling off the hinges. Let’s assume, then, that they go outside and push the button again. This time the series of messages is different:

This is attempt 2 of 50.
Distance 391km
*Access Denied*
Powering off...

 

Fig. 2 - Distance 391km

Fig. 2 - Distance 391km

Hmm. What does “Distance 391km” mean? “Access Denied” suggests that getting inside the box is indeed the objective of all this button pushing. Just for fun, let’s try again.

This is attempt 3 of 50.
Distance 391km
*Access Denied*
Powering off...

Uh oh. We seem to be consuming our limited supply of “attempts”. The “No signal” problem seems to be solved, but the message “Distance 391km” remains puzzling. Does the box know its own location? Is there something 391 kilometers away? London? The Hague? A circle of that radius drawn around Paris intersects quite a few interesting places in France, England, Holland, Switzerland, and Germany.

Knowing my friend, he will eventually think to move the box to a new location to see how the message changes. Let’s imagine, then, that he hops in his car and motors down the A11 to the famous city of Le Mans, about two hours to the southwest. After a brief tour of the cathedral and a snack at a sidewalk café, he pulls the elephant box from his backpack and pushes the button again.

This time the display is once again slightly different:

This is attempt 4 of 50.
Distance 226km
*Access Denied*
Powering off...

Aha. We seem to be getting somewhere. If we are in fact looking for a specific place, it would appear that it is 391 kilometers from Paris but only 226 from Le Mans. As you can see by the map in Figure 3, there are only two places on earth that meet these criteria – a spot just off the northern Brittany coast, and a rural area in the southwest near Bordeaux. And, as my friend is aware, one of these can be quickly eliminated simply by taking a third “reading” in a new spot.

Fig. 4 - and a circle around Le Mans

Fig. 3 - Circles around Paris and Le Mans

I suspect that from here things will proceed relatively quickly. My friend will triangulate that the “magic spot” is Île-de-Bréhat, a tiny island just a short ferry ride off the northern coast of Bretagne. If and when the couple do bring the box here, they’ll be greeted with a congratulatory “Access Granted!” and the whir of a motor announcing that the treasure inside is about to be finally revealed!

Fig. 5 - The box is unlocked!

Fig. 4 - The box is unlocked!

 

Hardware

The electronics for this project are fairly simple. At the core, of course, is the Arduino, surrounded by a handful of devices that talk harmoniously through various native and third-party libraries. The peripherals are wired to a custom “shield” that I soldered together. The shield design makes the system modular and easy to disassemble for moving. Power is provided by 4 AA lithium batteries mounted in the box’s interior.

Major components

Fig. 6 - Arduino and the custom shield

Fig. 5 - Arduino and the custom shield

1 Arduino Duemilanove
1 USGlobalSat EM-406A GPS module
1 8×2 blue backlight HD44780 LCD
1 Hitec HS-311 servo motor
1 illuminated pushbutton
1 low voltage Pololu power switch
1 2.5mm female DC power connector
1 Adafruit Arduino prototype shield
1 ornamental box

Minor components

1 severed chopstick used as latching dowel
3 #14 eyelet screws
1 Battery pack with 4xAA lithium batteries
Various mounting screws and glue
Wire, headers, solder, and other circuit connecting items

I designed this project to last a long time. The batteries are locked inside the box and can’t be replaced if they run down — not while the puzzle remains unsolved, anyway — so it’s important to conserve power. That’s why a given “session” lasts at most 2-3 minutes before the system powers off. Furthermore, the owner is allowed only 50 attempts to discover the box’s secret, so the active lifespan of the batteries need be no more than about 150 minutes. Between sessions, the electronics draw virtually no power and should last idle for years.

Fig. 7 - The tiny Pololu switch

Fig. 6 - The tiny Pololu switch

The secret to this power conservation is the clever little Pololu switch, which gives a circuit the ability to completely turn itself off through software. When you push the button, it latches and distributes power to the system. When the sketch decides it’s time to shut down — either because it can’t find a GPS signal or it’s not close enough to the target — it simply brings the Pololu’s power control pin high, cutting power. In this “off” state the switch draws just 0.01 microamps.

Fig. 8 - The EM-406A GPS module

Fig. 7 - The EM-406A GPS module

Like most GPS units, the EM-406A generates a stream of NMEA position data. This stream enters the Arduino via a “soft” serial port managed by my NewSoftSerial library. The NMEA data is parsed into latitude/longitude using TinyGPS, a popular library I built especially for this project. If the GPS is getting a good fix, the box can determine its location within 10 meters and, through a simple calculation, how close it is to the target.

Fig. 9 - The 8x2 Liquid Crystal Display

Fig. 8 - The 8x2 Liquid Crystal Display

The display is an HD44780-compatible device controlled by the Arduino LiquidCrystal library. I wanted to incorporate some visual effects like flashing and scrolling, so my sketch contains several custom display routines. These were carefully written so as not to block the all-important serial input stream coming from the GPS.

Fig. 10 - The interior showing chopstick latch

Fig. 9 - The interior showing chopstick latch

The internal latch is built around a Hitec servo, three eyelet screws, and, as a sentimental salute to the little Chinese restaurant my friend and I used to eat at, a dowel made from one of its chopsticks. One chopstick end is attached to the servo arm, and the other threaded through the two eyelet screws mounted into the box bottom. The servo operates in one of two positions – “open” and “closed”. When instructed to close, it drives the chopstick laterally through a third eyelet screw hanging from the box lid. At this point, the box is latched. Once the puzzle is finally solved, the servo pulls the chopstick back, and the box can again be opened.

Software

The box is running the Arduino version 0016 framework. The sketch I wrote uses native libraries Serial, Servo, and LiquidCrystal, as well as several of my own: TinyGPS, NewSoftSerial, PString, Streaming,andFlash. My libraries are freely available for download at Arduiniana.org.

Conceptually, the software is fairly straightforward. At power up, the system hunts for a GPS signal. If it detects that the box is within 2 kilometers of the target spot — in this case the center of the little island — it unlocks the latch. Otherwise, it displays the somewhat cryptic “Distance: nnn km” and keeps the latch firmly locked.

How the software works

How the software works

Fig. 11 - A fake voltage overload

Fig. 10 - A fake voltage overload

The Back Door

It may seem risky to create a device that can only be activated a limited number of times before it locks permanently. What happens if the bride’s four-year-old gets hold of it? What if the batteries unexpectedly run out? What if, despite all my care and attention, there are still bugs in the implementation? Will the treasure inside be forever sealed? To address these concerns, I built a “back door” into the design. This is where the mysterious 2.5mm coaxial connector to the left in Figure 1 comes in.

If you apply some current here at a reasonable voltage, the system will power up just as if you pressed the button. But since this circuit bypasses the Pololu switch, when the box claims to be “Powering down”, it is actually lying. Instead, after a two-minute delay, the latch opens, regardless of where the box is actually located. This gives the sheepish designer (me) emergency access and one more chance to replace the batteries or repair the latest design flaw.

You might question whether it’s a good idea to leave such a gaping back door. After all, it’s a lot easier for my friend to open the box by simply plugging it in than driving it the 391 kilometers to Bréhat. Quite true. So to dissuade him from snooping too far down this path, I built in a few frightening messages. Remember, he has no idea how to use this “back door” or what voltage and current to apply. If he does figure out how to power the box this way, I feel fairly confident that whatever satisfaction he gains will rapidly disappear when the LCD starts flashing the completely fake warnings

Excess Voltage!
Remove Power!

And if these aren’t discouraging enough, they are followed by a blast of random “garbage”, suggesting that a critical failure is underway. (See Figure 10.) Whoever opens the box this way will have to stare at these ominous characters for a full two minutes.

Last minute disasters

Just a couple of days before I left for France I made a pretty serious mistake. At the time I had completed the physical construction and was just beginning the first full-scale closed-lid tests. Everything was going swimmingly – so smoothly, in fact, that I became a bit cavalier about my methodology. To address an intermittent problem, I made the last-minute decision to upgrade my system software. Reflecting back, I should have done plenty of preliminary “open box” tests before sealing it up; instead, riding the wave of my enthusiasm into disaster, I uploaded the new version, confidently closed the lid, and pressed the button. The latch engaged normally, but then the whole system went haywire. The motor began jerking crazily and the LCD limped along, displaying dimly only the top halves of each message. Soon I discovered that I had locked myself out of my own box and that disassembling it was the only way to recover. Because I had designed it to be somewhat tamper proof, this was far from easy. Ultimately, I had to break a bracket to get a screwdriver far enough into the interior to pry open the latch.

In France I had left myself just one short day to reassemble the box (which had been taken apart to increase my chances with airport security), run some last-second tests, and perform the final reset. When it came time to rearm it, something you do by connecting power to the “back door” for four minutes, I found that I had brought the wrong power supply with me. I fruitlessly combed the house I was staying in for a telephone or router with a 2.5mm connector, and then tried desperately to locate the French equivalent of a Radio Shack. After my panic subsided I realized I could just jimmy up what I needed with a couple of paper clips. It wasn’t pleasant or easy to hold those clips in place for four minutes, but I finally did manage to rearm the box with mere hours to go.

Frequently Asked Questions

What happened when they unwrapped the box?

The day after the wedding, the bride’s family hosted a brunch in the back lawn of their beautiful country house. I hadn’t expected to be present at the opening, but at one point I noticed some furtive activity in the corner of the lawn and saw that the box was being passed around, accompanied by much head scratching and gesturing in my direction. My friend, who had apparently already consumed three “attempts”, was darting back and forth exhorting everyone in halting French “Ne poussez pas le bouton!” (“Don’t push the button!”). To his dismay, his new father-in-law didn’t understand and pushed it anyway. Several people approached me to ask questions about the box, which I apologetically declined to answer. At one point a friend of the family, a charming gentleman from up the street, said to me with a thick accent, “You are — how you say in English? — a BASTARD!” That one comment made this whole project worthwhile. As of this writing I do not think they have yet managed to open the box.

What did you put inside?

With all the electronics, there wasn’t much room inside the box for anything too substantial. I put in a few local (US) gift cards to entice them to visit soon, a set of Kazuo Ishiguro audio books (on a USB key), and an overly sentimental card. And of course, as I pointed out in the card, if either of them fancies doing a little Arduino development, there’s a perfectly good Duemilanove to play with, not to mention an LCD, a servo, and a GPS.

How did you choose the target location?

Île-de-Bréhat, a charming island where motorized vehicles are prohibited, is a special place for this couple. It was while my friend was filming a movie here that he first began to realize his feelings for the young lady starring in it. And she for him, if I understand correctly. To help matters, the bride’s family owns a house here, making it a doubly attractive destination. (I may be a bastard, but I’m not going to make them travel 400 kilometers to some random, isolated location just to open a few gift cards.)

How did you get it through airport security?

I worried a lot about this. At first, when I was not certain whether I would be able get to France to attend the wedding, I had thought to present them the fully “armed” box while they were visiting the US. Fortunately, someone pointed out the foolishness of this idea. Can you imagine the interview at airport security when the hand soldered electronics show up in the X-ray?

Sir, did you pack this yourself?– No.

What’s inside?– I have no idea.

Can you open it please?– Nope.

Eventually, I decided that the best strategy was to disassemble it as much as practically possible and hope that none of the individual pieces were sufficiently suspicious to warrant being detonated on the tarmac. This seemed to work. I brought the disassembled box on two major trips without a hint of trouble.

Why limit the number of attempts to 50?

Two reasons. First, a puzzle is just more exciting if it is bounded. If it’s fun to solve a Sudoku, how much more fun is it to try and do it in under ten minutes?

The second reason is a practical one. I needed some way to make sure that power consumption would not end up being a problem. How disappointing would it be if, after all the work I put into it, the batteries ran out and the puzzle was ruined? Constraining the number of attempts helps ensure that this won’t be an issue.

The number 50 has no special significance. 25 or 20 would probably have worked just as well.

Why the 2000-meter tolerance?

There is always a little bit of error in a GPS reading, so some tolerance is necessary. The island is about 4 kilometers across, so setting the tolerance at 2000 meters forces them to actually ferry across to it without constraining them to any particular part.

Conclusion

The box is unwrapped

The box is unwrapped

Building this project was a joy. It was rewarding to conceive of a relatively unique GPS application and to work through the various problems as they arose. Designing the latch, for example, was a challenge I spent a good deal of time on. My experience solving mechanical problems is fairly limited, but I’d like to think that the next time I build something with a mechanical component I’ll be able to approach it with a little more savvy. Meanwhile, when you think about all the cheap sensors, displays, lights, motors, modules, radios, and buttons you can attach to an Arduino, you realize that imagination is the only constraint on the kinds of projects that can be built. This little box is a novel way of combining a GPS, a servo, a button and a display. How many more marvelous combinations lurk out there, if only someone has the imagination to put them together the right way?

[Make sure you read the sequel to this story when you're finished here.]