Lockbox Process


For my first project, I decided to make a lockbox. I figured making a custom for button arrangement would be a challenge for my coding and construction skills so I broke this project down into small stages. First, I wanted to just get the switches up and running using LED’s. If the user punches in the correct code, the LED would switch from red to yellow. The password, in this case, is 2,1,3,4, but don’t share that. 
Breadboard with four buttons and one LED lit

Below is an example of the lights working. 

 

Servos have been my nemesis over the last couple weeks so I wanted to take this project another step and include one as a locking mechanism.  

Breadboard with four buttons and socket wired

To achieve this, I needed more voltage to run my servo. The Arduino Nano couldn’t get the job done. I went over to the junk pile on the floor to find a power supply that would work.  

The power supply was 12 volts and just raw wires. Luckily I found more components that I could wire together once I knew I was getting the proper voltage. 

 I have never used a voltage regulator, so I got a spare breadboard out and attempted to light just a single LED. I wired the regulator wrong so instead of converting 12v to 3.5v I melted my board. I misread the datasheet. 

With new components, I was up and running correctly.

New wiring for old parts. Wiring with two wire caps

Modified breadboard. Breadboard with four buttons and socket wired

Servo attached to the breadboard. 

Servo up and running with the correct code.

My rough laser cut box. Laser cut cardboard safe

Latch on the interior of my box. 

Cardboard lock

Servo inside the lockbox. 

Servo inside a lock box

The servo and locking hook activated after the code is typed in. 

And here is the piece in full use. 

Below is my code of the project: Arduino code 1 Arduino code 2 Arduino code 3

I referenced several projects to help get this code up and running. Below are links to all those projects. 

https://highvoltages.co/tutorial/arduino-tutorial/combinational-lock-using-push-button-and-arduino/

Button Combination Lock

http://lizastark.com/physcomp/week-4-controlling-led-outputs-using-a-combination-of-buttons/

Going forward:

To make this project more user friendly and interesting, I am considering the following changes.

  • Bring the breadboard inside the box and custom make a button that can sit outside. 
  • Have a reset button either with time or an actual button if the user hits the wrong button. 
  • Have a better locking mechanism. I was thinking of fabricating an eye hook. 
  • Have the ability to relock the box with the servo rather than by hand. 
  • Code the ability to change the combination. 

Repetition with loops

This week the assignment was to “create an interactive artwork that implements the concept of repetition with variation.” Understanding loops and their functionality has been a challenge for me, but this week it finally clicked. Is crying from joy and relief a normal response to learning how to code?

For my assignment, I wanted to make a series of ellipses that the user could modify, but that also changed independently. To achieve this, I used mouseX to adjust the circles’ width and called a random function to control the height. The ellipse is within a nested loop. 

To add a little more complexity and test out some new functions, I added mousePressed to stop the loop and doubleClicked to restart it. 

p5js editor screen shot of a nested loop.

Give it a try here: