Go Down

Topic: Project guidance for code-based locker opener (Read 1 time) previous topic - next topic


Hello. I am a sixth grade teacher and am working on a project with two students. Here is what we have created (they more than me). The goal was to solve a problem encountered by many sixth-graders, the dreaded combination lock to open the locker. My kids wanted to create a system that would read a code and unlock the locker if the code was correct.

We have an Arduino Uno with the Adafruit Motor shield v2.  We connected a 4x4 membrane keypad to read the code and a solenoid style lock to lock. We got it to work just fine! We connected a pigtail to the EXT PWR on the motor shield and we're running it off a 9V battery.

Links to what we've used:

Here is our dilemma:

We want to figure out where to go from here. My concern is that there's no current way for us to know if the battery will die, leaving the locker hopelessly locked. Also, we naturally need to graduate to a better battery. The solenoid will handle any voltage from 9V to 12V, so my thinking was to use a 12V lead acid battery. However, I need help with understanding:

1. Is there a way for the Arduino to read the voltage, given the battery will be plugged into the Motor shield?

2. Do we need to use any resistors and/or transistors in the mix anywhere?

3. Should we power the Arduino and Motor shield separately?

Thanks so much for any help you can provide. We've been Googling for days and are a bit out of our element here.

PS...Attached is a picture of our little project.


Sigh. I had really hoped for some help for my students.


Try searching for a geocache box or reverse geocache box.
I remember reading about one a while back but can't find the link.
If I remember correctly, they had the same battery issue you do but had figured out a solution.

Good luck with your project.


1.  do not use a 9v 'transistor battery'.
2. do not use batteries at all, since it is an indoor application.  Use distributed power from an A/C sourced power supply.

Barring the above, there are scripts out there to monitor battery voltage (the first indication that you are heading for death).

Also, to reduce constant power demands and avoid being hopelessly locked out in a power fail (dead battery or loss of A/C source),  use two solenoids: one to pull bolt into locked position and one to pull the bolt into the open position.  Momentary kick on the solenoid moves the bolt into desired position and then you cut power to the solenoids.  Also might be a good idea to incorporate a micro-switch on the door to disable the locking solenoid when the door is open.  good luck and y'all have fun now, ya hear?


Thanks kindly for the responses. The locker isn't close enough to an outlet, so we can't use the power supply. Hence the battery discussion. :)

I will certainly look at the possibility of two motors, that's a good thought. And I will search those scripts.

Reading now about reverse geocache, thanks for the heads up!


not REALLY relevant, but how many lockers, how many kids?  (and what kind of budget, is this just proof of concept?)

It shouldn't be a big deal to get the building facility folks to run a low voltage line from the classroom (where you have A/C outlet and place the supply) to the lockers.  Although 'transmission' of D/C power induces a lot of losses, it shouldn't be much of a problem in this case (and you can revert to low voltage A/C to the lockers and A/C to D/C convert at the lockers; bridge rectifier,  filter caps, and linear regulator).

But it is your call, it's your project/application.  JUST DON"T RELY ON 9V BRICK BATTERIES.


I hear you loud and clear about 9V batteries.

This is proof of concept for now. We want to make it scalable, though, and we felt like figuring out the battery issue is a problem we needed to address.

Thanks again for the help!

Go Up