“In this Instructable, Im going to be showing you how to build your own crack the code game in which you use a rotary encoder dial to guess the randomly generated code to the safe. There are 8 LEDs on the front of the safe to tell you how many of the digits youve guessed are correct and how many are in the right place as well.
The safe is initially open, allowing you to put something into the inside compartment. The Arduino and battery are housed in a separate compartment in the back. You then push the dial to lock the safe, which is done using a servo on the inside of the door. You then need to input the code by turning the dial to select the digits and pushing the dial to confirm each digit. After your fourth digit is chosen, the safe displays how many of your digits are correct and how many of them are in the correct place using the red and green LEDs on the door.
A red LED indicates a correct digit and a green LED indicate that its also in the correct place. So you need to light up all four red and green LEDs in order to crack the code and open the safe.
The safe keeps track of how many guesses youve made in order to crack the code and this is displayed once you have managed to crack it. It may sound complicated at first but it’s actually not that difficult, you just need to remember and build upon your previous guesses. Most of the time you should be able to crack the code in 5 to 10 guesses, depending on how lucky your initial guesses are.
In order to build this Crack The Code safe box, you’ll need:
Arduino Uno - Buy Here
I2C OLED Display – Buy Here
Pushbutton Encoder – Buy Here
4 x 5mm Red LEDs – Buy Here
4 x 5mm Green LEDs – Buy Here
8 x 220Ω Resistors – Buy Here
Micro Servo – Buy Here
Ribbon Cable - Buy Here
Header Strips - Buy Here
Power Switch - Buy Here
3mm MDF Sheet - Buy Here
You’ll also need some basic tools, wood glue, a glue gun and a soldering iron.
The parts for the safe box need to be laser cut. If you don’t have access to a laser cutter, consider using an online laser cutting service, they’ve become quite affordable and will cut and deliver the components to your door.
This is the laser cutter which I’ved used in the Instructable - K40 Laser Cutter”