Electronic lock

From Grahams Wiki
Jump to: navigation, search


Arduino Lock digital lock.

This is going to be for a physrep electronic safe.

Its basically a 4 digit 7 segment display attached to pins D2-D13 (Except for Pin11)

Its actually a very simple project with no significant additional electronics required. (Just a few resistors)


A servo attached to Pin 11 (Was originally going to use a solenoid for this purpose, but a servo is easier.)

and two 20 position rotary Grey encoders. (Attached to A0,A1 and A2,A3)

The two I used also had a push switch built in which is wired to D0 and D1. (These are pressed together to put into SET VALUE mode, then left is used to cancel and right to Set)

Lastly, there is a 24LC64 I2C EEProm connected to A4 and A5. This is used to store the unlock code between Powerdowns, Although a 64k EEprom is a bit of a waste for 2 bytes of storage...

Possible mods

Use a RTC chip instead of the 24LC64. Can store the value in the ALARM settings. Can display the time instead of blanking...

I would like to add an indicator to indicate the lock is open. as there are no pins free, will have to multiplex it some how. A quick look identified that the elements a,d (the top line and the bottom line) as contenders as the bottom line is never on at the same time as the top line is off. Thus an LED could be connected between these pins (With the appropriate resistor) The software would have to be modified to add an additional state display state, and on this 5th state with all digit lines low, then control these element pins appropriately.

Source code

Source code