Introduction: Arduino Riddlebox
In this Instructable I am going to show you how to make an Arduino powered Riddlebox. I made this to add a bit of fun to my girlfriends actual christmas present, which I hid inside the compartment of the box.
Once 5V are applied to the USB lead, the Arduino powers on and the LCD shows a short tutorial and then a sequence of ten riddles, which need to be solved to open the servo operated compartment, which can hold a gift or present.
There is also a sneaky, password protected, settings menu for resetting progress and opening the compartment.
I used what I could find at my local hardware store and 3D printed the rest. Obviously you can customise the Riddlebox by adding more sensors or leaving out some parts. Let your creativity run free.
You will need:
Step 1: Setting Up the Hardware
I first prototyped the riddles, with the Arduino a breadboard and the components I wanted to use, namely the key switch and the keypad. To use the Arduino code from this instructable as is, connect the parts as described below. Of course you can add and remove components, or use different pins, as long as you make the appropriate changes to the code.
Most keypads have a pin for each row and each column. Find out which pins are the row pins, by testing for continuity between different pins while pressing buttons to close the circuit (see example diagramm). The remaining 4 pins must be the column pins. (Note: sometimes the two most outside pins are connected to the copper fill on the PCB and can be ignored)
Connect the keypad pins COL0 - COL3 to Arduino pins 12 - 9 and ROW0 - ROW3 to Arduino pins 8 - 5.
The LCD is connected via I2C, so there are only four pins needed: SDA, SCL, 5V and GND.
The key switch has three positions and six pins: Both C (common) pins go to ground, while the two pins labled NO (normaly open) go to Arduino pin 22 and 23 respectively. (Note: the arduino inputs are pulled high, so we only need to connect ground to the switch's common pins)
The two servos are used to physically open the compartment door and to lock it via a latch.
Connect 5V and GND of the servos to the Arduino and connect the signal lines as follows: lock servo = pin 44, door servo = pin 45.
Step 2: Arduino Code and Riddles
The code for the Arduino consits of several files. The main sketch initiates all the hardware, libraries and global variables. All riddles and menublocks are stored in functions in seperate files for easy management. The state of progress, which is saved in the EEPROM (i.e. is safe even after powercylce), determines which riddle functions is called in the switch function of the main file.
I removed any personal information from the code and replaced some solutions with generic slutions (1234...) . Feel free to change the code as you see fit and add some personalised solutions.
Riddles and menublocks:
- Advanced: Advanced settings menu with progress reset and compartment controls.
- Intro: Intro menu with greeting text and tutorial.
- Elementary: Riddle aksing for the atomic number of iodine.
- Outsourcing: Player needs to contact an email address which autoreplies a number riddle. (Star shaped riddle in images)
- Sixteen: Player needs to convert a hex number into decimal.
- Choices: Player needs to complete a text adventure located on a flash drive, the password for the next level is hidden in the story. (see Amnesia.rtf)
- Offline: Player has to recieve the key to activate the key switch (e.g. via mail, gread way to slow them down if they're too fast).
- Invisible: The password for the next level is writen on a piece of paper in invisible ink.
- Calculus: Simple calculus task. (More of a placeholder that never got filled, as I ran out of time)
- Change: Short riddle concerning Euro bank notes, can be adapted to any currency with different coloured bank notes.
- Patience: Player must not turn the key for a period of 5 min, else the timer resets and doubles. (Note: Turning the key often enough causes the variable to overflow and reset to zero due to its limited size.)
- The Answer: "What is THE answer?". The solution is obviously 42.
- End Screen: Congratulations and instructions on opening the compartment. (via the keyswitch)
I have included further documentation in the form of comments in the code files.
FYI: holding 'A' during the splash screen opens the settings menu. Password: 2582
Step 3: Building the Faceplate
I bought the case in my local hardware store together with the aluminium sheet. It came with dividers which I later reused to create the compartment walls.
The sheet of aluminium was to wide, so I scribed and shortened it with a coping saw. However, a scrollsaw, rotary tool or even a grinder with a cut-off wheel might be a better fit, since it took me ages and I snapped two blades in the process. The gap in the front of the case is intentional. It provides space to place a powerbank and the memory stick.
After marking out where I wanted everything to go I drilled holes in the corners of the marked out sections and cut them out using the coping saw again. For the compartment section I tried a cut-off wheel on a grinder, and it worked fantastically. I used a metal file to trim the openings to fit the components and debur them. A quick pass with the orbital sander gave it all a matte finish. This is of course totally optional, I scuffed the aluminium plate up a lot, so sanding seemed good way to hide them and remove my sharpie markings.
The door to the compartment is simply a trimmed off piece of the leftover aluminium sheet.
I attached the hinge to the door and metal plate using the high bond glue. It's applied to both surfaces, allowed to cure for 10-20 min. and then both sides are pressed together. The bond is instant and there is no way to adjust the two pieces later on.
The keypad and LCD diplay hold in place with some hot glue around the sides. (Note: Make sure to isolate the pins of the components from the aluminium sheet. A dab of hot glue does the trick)
The keyswitch has a thread and nut, so I drilled a hole in the correct size and fit the switch through.
To make the compartment open automatically I attached the door and lock servos to the underside of the aluminium sheet with hotglue. The locking hook and opening lever and lock latch I bent to shape out of some brackets (similar to plubmers tape). In hinesight I could and probably should have 3D printed theese components as they are somewaht flimsy this way and will probably be the first thing to fail. I attached these parts with hotglue and high bond glue respectively (see pictures).
Because the front didn't look very pretty this way, I decided to print some frames to go around the different components and attached them with hot glue as well.
Step 4: Finishing the Case
As I metioned previously, the case came with some deviders. I decided on an arangement to create a rough compartment and some space for the Arduino and then used the high bond glue to fix it all in place.
After connecting all the components to the Arduino Mega and hot gluing it down to case, I fed the USB cable out through the small opening between the dividers, so that it was accessable from the ouside.
After carefully dropping the aluminium plate into its final position, I fixed it in place by pressing the nozzle of the hot glue gun to the seam between the plate and the case and forcing the glue into the gap. At first I was sceptical about the itegrety of this fixation method but it's held up so far.
The last thing left to do was to apply some finishing touches. I designed some simple stickers in MS Publisher which I printed, cut out and attached to the front plate with a simple glue stick.
Of course it's totally up to you if and how many stickers you want to make and attach. Also this might be a good opportunity to practice some weathering techniques to make it all look a bit more bad ass. Sadly this only came to me while writing up this Instructable.
Anyway, I hope you enjoyed this Riddlebox build. If you have any questions or improvement ideas, leave me a comment down below and I'll try to get back to you as soon as possible.