Page 1 of 2

More advanced LCD Four Digit Door Lock.

Posted: Wed Apr 11, 2012 8:08 pm
by medelec35
Flowcode version: V4 or higher.
Hardware: Eb006 programming board, EB004 LED board, EB005 LCD board & EB014 Keypad board.

With This lock there are two pass codes.
1) Master code
This used for changing the normal pass code (just in case the normal pass code has been changed, then forgotten)
It can only be changed by altering on flowchart (so you can look at flowchart if master pass code is forgotten) then resending to target device. For security reasons this cannot be used for opening the door.

2) Normal pass code.
This is used to open the door. The default is 1234. But if you change this pass code, then the new pass code will be stored in EEPROM.
So it will be remembered in event of a power failure. You can also use this normal pass code to change the current pass code.

To change the current pass code, before entering any digits press Hash key #
Now enter the old pass code or master code. (currently set at 6543)

Note: The hash key is also used as an enter key, after entering four digits.
The star key * is use to remove the last digit entered. so if you want 1234 but enter 234 by mistake, then press *** then enter 1234 finally press #

Although used a 16F883, you can use any target device will will allow you to connect a keypad an LCD and 2 spare o/p pins. ( one, if you don't require a door locked indicator).


To open a door, if current pass code is 1234, then press 1234#

If you would like to see any improvements or new features added then any suggestions are welcome.

Martin.

Re: More advanced LCD Four Digit Door Lock.

Posted: Thu Apr 12, 2012 11:08 am
by medelec35
I will be adding more features as I either think of them or someone suggests in this thread some features.
Every time a new feature is added, I will increment letter after V2 by 1.

Added: Number of tries feature.
Like pass code, this is also stored in EEPROM.
So it can't be fooled by removing and restoring power.
Number of tries will reset to 0 when correct pass code is entered (not master code!)
Door lock V2A.png
(13.83 KiB) Downloaded 22308 times
Next feature I will be adding is: Set door open delay time in seconds via keypad.

Re: More advanced LCD Four Digit Door Lock.

Posted: Thu Apr 12, 2012 11:19 am
by Benj
Hi Martin,

Very nice program there thanks for sharing :) Might have to go and get myself a shed so I can have a go with fitting a electronic lock on it :D

Re: More advanced LCD Four Digit Door Lock.

Posted: Thu Apr 12, 2012 11:27 am
by medelec35
Thanks Ben.
I will be doing the same to my shed :lol:
I thought the number of tries would come in handy to see if someone unauthorised is trying to gain access.
I guess can add another output to trigger a relay for a set time if more then three tries have been registered?
Then there will be an unauthorised attempt alarm.

Re: More advanced LCD Four Digit Door Lock.

Posted: Thu Apr 12, 2012 8:25 pm
by Steve001
Hi Martin,

this is somthing that i have been thinking about for a while now, after seening a few electronic locks on my travels i have thought of having a go my self at them but have not had the time :(


here are a couple of ideas

using the RFID EBlock, keypad, ethernet pcb.

The user presents the RF card to the unit then enters a pin number to open the lock, 3 incorrect codes = 30 min lock out period and the card will be ignored and not allow a code to be entered further attempts increase the lock out time delay.
the ethernet module is used to program access so that various levels can be programed so you can open some locks and not others
and can also see who has operated the lock. and incorrect codes.

the second idea

using a touch screen e block ( don't know if it's available yet) as a keypad, and drawing different key pad patterns on the display
as key pads can get worn and you can see the numbers that have been pressed regular


steve

Re: More advanced LCD Four Digit Door Lock.

Posted: Thu Apr 12, 2012 11:54 pm
by medelec35
Thanks for your input,
You have some good ideas Steve.

Good point with the keypad. I guess it would be a good idea to regularly change the code to prevent the wearing out of pads.

Martin

Re: More advanced LCD Four Digit Door Lock.

Posted: Fri Apr 13, 2012 11:06 pm
by medelec35
As promised added a function to change seconds door stays unlocked, by entering a new delay value via keypad:
Door lock V2B.png
(12.78 KiB) Downloaded 22261 times
To do this enter 1#
Then you must enter correct code to access delay function to prevent unauthorised delay alterations.
Then enter seconds, followed by #
E.g. if pass code is 1234 and I want to change delay door stays unlocked to 15 seconds.
Key sequence is:
1#
1234#
15#
The new value will be stored in EEPROM, and will be retrieved in event of power failure.

Martin

Re: More advanced LCD Four Digit Door Lock.

Posted: Sun May 27, 2012 4:30 pm
by donald
Hi everybody,
Mr. Martin, you can make a conversion for PIC16F628 ?
Without delay, without count of tries.
Thank you in advance

Re: More advanced LCD Four Digit Door Lock.

Posted: Sun May 27, 2012 4:37 pm
by medelec35
Hi donald,
The attachment on the very 1st post is without count of retries or delay.

Just change the target for your device (not forgetting to disable WDT and LVP)

There is a version here:
http://www.matrixmultimedia.com/mmforum ... =26&t=7413
which is more basic and does not even use EEPROM .

Martin

Re: More advanced LCD Four Digit Door Lock.

Posted: Sun May 27, 2012 5:38 pm
by donald
Hi Martin,
I am interested to tackle EEPROM and to operate on a PIC16F628, if possible.

Re: More advanced LCD Four Digit Door Lock.

Posted: Sun May 27, 2012 6:29 pm
by medelec35
Not sure if this will work on 16F628A as I have not got that chip to test Flowchart with.
Try attached flowchart. It is the flowchart that's posted on the first post, but has be altered for 16F628A.

What type of oscillator (e.g internal, external ) and clock frequency are you using?

Re: More advanced LCD Four Digit Door Lock.

Posted: Sun May 27, 2012 6:49 pm
by donald
Internal oscillator, usually 4MHz, it seems to me that it works, I tell you made me very happy. :D :D :D
Thank you very much

Re: More advanced LCD Four Digit Door Lock.

Posted: Sun May 27, 2012 7:11 pm
by medelec35
No problem.
Glad it seems to work for you.

I have altered settings for 4MHz internal osc with no external reset.

Re: More advanced LCD Four Digit Door Lock.

Posted: Sun May 27, 2012 7:28 pm
by donald
Simulation works, but does not compile to 16F628.

Re: More advanced LCD Four Digit Door Lock.

Posted: Sun May 27, 2012 7:58 pm
by medelec35
Compiles just fine for me.
I'm sure yours is not compiling because EEPROM is not available in the free version of Flowcode.

Try attached flowchart.
The only difference is I have removed the EEPROM component.

Here are all the limitations of the free version:

Code: Select all

Nag Screen                         : Always (5 seconds, startup and close down)
Icon count per macro               : 16
Macros per project                 : 4
C code lines per C icon            : 4
C code lines for suplementary code : 4
Vnet                               : Disabled
ICD                                : Disabled
Customise component code           : Disabled
Components                         : LEDarray, LED, LED7Seg1, LED7Seg4, LCD, Switch, Switchbank, ADC, Keypad, PWM, FormulaFlowcode, MIAC
Allowed chips (PIC_8)              : 16F84A, 16F628A, 16F690, 16F88, 16F877A, 16F887, 16F1937, 18F4431, 18F2220, Formula Flowcode Buggy, ECIO-40, ECIO-28, MIAC, Locktronics PIC

Re: More advanced LCD Four Digit Door Lock.

Posted: Tue May 29, 2012 4:15 pm
by donald
Hi everybody,
Thank you very much Martin, with a battery stored in extra code changed or if I give up to the battery
and a source of power is accidentally disconnected returns to the code initially, is not an issue. :D :D :D
All the best !

Re: More advanced LCD Four Digit Door Lock.

Posted: Thu Jul 12, 2012 7:21 am
by medelec35
Thanks donald.
donald wrote: if I give up to the battery
and a source of power is accidentally disconnected returns to the code initially, is not an issue. :D :D :D
Yes that's the big advantage of using a non volatile memory like EEPROM to sore pass code.
:)

Martin

Re: More advanced LCD Four Digit Door Lock.

Posted: Sat Dec 15, 2012 1:33 am
by dan@ttl
Hi all,
I've been using this example to learn Flowcode, tried some modifications. I wanted the lock to have a limit of tries. I've changed the wrong_tries to not exceed 4. I've inserted a reset_macro on the code_check macro to display "YOU HAVE EXCEEDED NUMBER OF TRIES" and to jump to end on the main macro. My main idea is to block further attempts for input and to require a physical reset or to power reset. It jumps to end, but I can't display the message somehow. Using V5 Pro.

Re: More advanced LCD Four Digit Door Lock.

Posted: Sat Dec 15, 2012 2:02 am
by medelec35
Hi Dan,
All you need to do is place text after the jump to point A
Then a continuous loop so routine is halted.

Martin

Re: More advanced LCD Four Digit Door Lock.

Posted: Mon Dec 17, 2012 3:18 am
by dan@ttl
Thank you much. I will run it on the hardware.

Re: More advanced LCD Four Digit Door Lock.

Posted: Mon Dec 17, 2012 9:38 am
by brandonb
nice project, i have to get a keypad now... i've always wondered about static shocks on keypads, how vonerable are they to this, have you ever taken a automotive spark tester and set it to 20,000 volts, then get out of your car with it in your hand, it will arch across no problem with a loud pop when its dry outside, of course i live in the desert so its always dry

Re: More advanced LCD Four Digit Door Lock.

Posted: Mon Dec 17, 2012 8:18 pm
by dan@ttl
never had the problem with keypads. it gets pretty dry here in winter and i always have the habit of grounding myself before touching anything metallic. then again keypads have plastic keys and there is usually a rubber membrane before the actual contact. don't know how much they are rated though.

Re: More advanced LCD Four Digit Door Lock.

Posted: Mon Jan 07, 2013 10:20 pm
by dan@ttl
Got back on the project and added a lock/unlocked routine. Works, but I got lost in the change_code portion. I can make the change in the lock code, but I need help on the unlocked code change. I figured this program can be used for alarm circuits also. Any ideas appreciated.

Re: More advanced LCD Four Digit Door Lock.

Posted: Tue Jan 08, 2013 3:35 am
by medelec35
Hi Dan,
I have altered Flowchart so pressing the star key before any numbers will allow you to change the Lock code.
pressing the hash before any numbers will allow you to change the Unlock code.
When four digit code is entered, as usual press the Hash key

Any codes that get change are then stored in EEPROM

Master Key will allow you to set both Lock and Unlock codes should you forget what the new codes are, once altered.
The idea being if you forget the master key, you just look at the Flowchart and your see it's code.
Best to change the master key value within Flowcode before programming target device, to make security higher.

Martin

Re: More advanced LCD Four Digit Door Lock.

Posted: Tue Jan 08, 2013 8:00 pm
by dan@ttl
Hi Martin,

Thanks a million. That was the routine that I couldn't figure out where to insert. I was also thinking in bed last night why do I need two pass codes? Most alarm systems only use one. Will try with an output variable and a decision to check on or off state. Thanks again.

Dan