Author Options:

Does anyone know how I could make a combonation lock using a potentiometer and an arduino? Answered

I'm making a room automation/security thing to keep my brother and sisters out, and its going very well. But I need some way to disable the a;arm when its me going in, so I though It would be cool to use my door handle and a pot as a combo lock. I'm using an arduino for the brain.



Best Answer 9 years ago

There should be plenty of examples of using the arduino to do resistance measurements. Start with one of those. Then rite a program for the arduino which tracks that value, watching for it to become stable (ie, for you to pause) at particular points in the pot's range. Remember that you probably aren't going to be able to hit EXACTLY the same position every time and there's going to be a bit of jitter in the measurement, so what you want to watch for is a value that's "close enough" to the right position; you'll probably have to determine what that range is (ie, how many distinct positions you can recognize) by trial and error.

Then of course you'll want to come up with some kind of calibrated dial for the potentiometer so you can see where you're turning it to.


Answer 9 years ago

thanx, Ive just finished building the hardware, and its looking great. I decided to just have the pot on its own instead of attached to the handle because it gave more degrees of freedom. Im having a little trouble with the code though, if someone could give me a little snippet of code that I could work off of that would be nice. I know how to read potentiometers and the simple stuff, Im just having trouble putting it all together. :)


9 years ago

Here is a few pics of what Iv got going on if anyones interested. I thought a good way to make it work would be to have the user turn the pot to the corect value, click the switch, turn the pot, ect...

The first pic is the unlocker, and the next two are some of the entire security system