## Introduction: The Memento Game

You probably know those games where the player memorizes a sequence of colors and sounds and has to play them back, right?

The Memento Game adds prizes for extra fun! Once a player hits a predetermined score, they win the game and the box opens, revealing the prize.

I had a few requirements: the box needed to be sturdy, capable of being manhandled by a small child; the compartment had to be big enough to hold small gifts; and I wanted some way of changing the difficulty level, without allowing the players to do it themselves.

Here's a video of the whole process, wherein I learn how to use Tinkercad, design the box and circuit, and then proceed to the actual build. The video skips a couple of parts and is mostly sped up 150x but don't worry, because all the actual instructions are in the next steps. Also, for improved readability, all the files, plans, code, etc. are posted in the last step.

## Step 1: Designing the Box

It was surprisingly easy to design the box using Tinkercad. I went through a few of the official tutorials to get the hang of it, then youtube saw me through the rest. Here's the box so you can tinker with it (drag to view it in 3D):

If you open this in Tinkercad, you can click on each part and then press the arrow keys to move it around (Ctrl+up if you want to go up). Using those keys you can get an "exploded view". The wedge shape inside the box represents the solenoid lock, just in case you're wondering.

If there's one element of design of which I'm proud, it's the gravity powered door. By adding that perpendicular wood board next to the door hinge (inside the box, you have to open it to see it), the door naturally wants to stay open and the only thing keeping it closed is the solenoid lock, which, when the player wins, opens for a second.

## Step 2: Designing the Arduino Circuit

So, turns out Tinkercad has Circuits which is an easy to use electronics simulator. By that I mean that it actually simulates the behavior of electronic components including an actual Arduino. When I ran my simulation it even threw out warnings that the LEDs were getting too much current. Sorry Circuits, but I do know better. The LEDs are not on all the time, so 220 Ω resistors are fine. Thanks for the warning, though.

The whole thing is very intuitive, I only did a couple of tutorials before getting the hang of Circuits, so I immediately starting designing the whole thing. Here it is:

You can see the 4 colored lights, each with it's own button, the speaker, and a white lamp.

The while lamp represents the solenoid lock which opens the box, and the speaker actually had to be amplified (you can see me googling simple amplifier circuits in the video, if you don't blink).

## Step 3: Coding the Game

Circuits runs a simulation because we code some instructions for the Arduino. How did I do that? I searched for other Arduino memory games, there were quite a few to choose from, so I ended up doing exactly that. I chose some bits of code from here, some from there, added my own secret sauce, and mashed everything in a coherent enough way that it works. I should have documented it better, sorry I didn't. Feel free to hack my code to pieces if there's anything there that serves you. Just click on the Code button in Circuits to see it.

I used the Arduino IDE to actually send the code to my Arduino for a real live prototype, before moving on to the next step.

## Step 4: Barebones Arduino

As I explain in the video, I chose a barebones Arduino setup, so I could fit the extra circuits and components in the same board. You don't have to do this, you can use any Arduino, but in case you want to replicate my build, I used Nick Gammon's design.

The extra pieces to fit were:

An isolated relay circuit to drive the 9v solenoid lock that opens the door.

A simple amplifier circuit for the speaker.

I've attached a Fritzing drawing that shows what connects where. I purposely left a space between the ATmega328P-PU pins and the rest of the components, but they are in fact connected.

The ATmega328P-PU chip is covered by a cool label to help identify which pins correspond to the Arduino pins. There's a file for that at the end too.

There is a bypass reed switch in that drawing that I did not implement in the actual game (didn't arrive in time), but I still think it's a good idea. Let me break it down:

Suppose the box is locked and you want to open it, but you either can't solve the current difficulty setting, or somehow there is some unexpected error that does not send the open door signal to the lock. If you actuate the reed switch (by passing a strong magnet nearby), the 9 V battery connects to the lock directly, bypassing the whole circuit. Only you would know this secret "unlock code" and the correct placement of the reed switch.

As it stands, my box looks closed, even on close inspection, but the bottom is just attached by non-glued dowels that happen to fit really tight. If I pull hard enough, it starts to open.

## Step 5: Build Tips and Tricks

If I were to do it again, I would skip making my own wood box, and would just buy something and adapt that. I've seen some sturdy looking plywood boxes selling really cheap, so I would just have to cut one wall for the door and maybe screw the top on. If you're any good at woodworking, go for it. For me it was just way too much trouble. Still, the end result was nice.

The lock was placed by a process of trial and error, I bent that piece of metal you see in the photo with pliers, and adjusted the tolerances taking into account the unintended sideways movement that the metal hinge makes.

I had to carve out a couple of millimeters where the hinge screws to the door and box ceiling.

I planed and sanded the wood boards that were butt joined with dowels. Then I applied varnish to the outside of the box and the inside of the compartment, where the gift is placed. I did not bother with the electronics housing.

I used cardboard to make everything fit snuggly. The box has been dropped and kept on working.

I used some Dupont connectors to make assembling and troubleshooting easier. Every major part of the circuit snaps in and out when needed.

If space is a concern, don't use six 1.5 V batteries to replace one 9 V battery like I did. At the time I was assembling it I did not have the proper connector and didn't feel like changing it afterwards. On the plus side, the lock will have power for years.

I glued the more isolated female Dupont connectors to other, more robust, vertical walls on the main board. Like the relay, or other connectors that had more pins soldered to the board.

As commented in the source code, to change levels you connect ground to a combination of analog pins. There's a file for that too, at the end of the instructable.

## Step 6: The Real Game Goals: Memory Skills and Perseverance

This is a game that my daughter keeps on playing. She's 3 and currently she's getting about 50% success on level 5. Sometimes I put a little toy in there (I have several Lego people which she hasn't seen yet), or a cookie, and she loves it. I've seen her playing alone, and sometimes she solves the game just so she can put a gift in there (one of her toys) for me. Of course I have to solve the game to get it. I've been changing levels when she reaches about 90% success to keep it difficult enough to be motivating.

This particular level (5) has been a real challenge for her, but I want her to know the value of perseverance. Also, that it's fine not to get things right on the first try. You can get better with time and practice.

## Step 7: Source Code, Plans, Links and Files, Come and Get Them, Use Them at Will!

The speed build video: https://youtu.be/2i8izHXbzJY

Attached files:

The Fritzing layout

A "How to change level" text file

A pdf file which has lots of labels to paste on top of your ATmega328P-PU chips.

### Attachments

Runner Up in the
First Time Author Contest