Our third assignment this semester is to use an Arduino to create a makeshift lock. The project is pretty open-ended, so I’ve decided to make a lock box using servo motor along with the Arduino.
An infrared sensor will trigger a servo to unlock the box.
The concept is simple. I will use an infrared sensor to activate the servo, unlocking the box. After my last project which blew up my Arduino, I’m ready to redeem myself, new Arduino in hand!
It will read movement and activate the servo.
This little guy is the motor and locking device.
The difficult part has been coding the infrared sensor to rotate the servo. I resorted to using code that allowed me to control and LED with a potentiometer as a starting point. This was beneficial to eventually getting my wiring working properly.
Success! Now to implement it into the box.
After a few hiccups, some tweaks to the code, and some food in my belly, the wiring is ready to go in the box!
Before I place the components in the box, I need to set up the locking device.
The servo will rotate, positioning itself into the makeshift lock.
Using cardboard, I created make shift device that the servo can lock into. When activated, the servo will rotate into the groove of the cardboard (the locked position). A wave of a hand across the sensor will rotate the servo, unlocking the box.
I cut a rectangular hole along the side of the box for the infrared sensor.
It’s not pretty, but it works.
The biggest pain in the butt was not having the servo move out of place. At first I used cardboard wedged in between the inner wall of the box, and the servo, but that didn’t work. I also tried pieces of tin which didn’t work either. I eventually ended up using mounting tape to create a cushion on one side, and a piece of tine taped to the bottom of the box on the other side. This worked perfectly. The servo does not move at all!
Here is the box in action!