More advanced LCD Four Digit Door Lock.

Tips, Tricks and methods for programming, learn ways of making your programming life easier, and share your knowledge with others.

Moderators: Benj, Mods

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 9205
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2534 times
Been thanked: 3721 times
Contact:

More advanced LCD Four Digit Door Lock.

Post 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.
Attachments
Door Lock V2 16F883.fcf
(21.53 KiB) Downloaded 964 times
Martin

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 9205
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2534 times
Been thanked: 3721 times
Contact:

Re: More advanced LCD Four Digit Door Lock.

Post 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.
Attachments
Door Lock V2A 16F883.fcf
(24.16 KiB) Downloaded 769 times
Martin

User avatar
Benj
Matrix Staff
Posts: 15159
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4753 times
Been thanked: 4285 times
Contact:

Re: More advanced LCD Four Digit Door Lock.

Post 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

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 9205
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2534 times
Been thanked: 3721 times
Contact:

Re: More advanced LCD Four Digit Door Lock.

Post 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.
Martin

User avatar
Steve001
Valued Contributor
Valued Contributor
Posts: 1187
Joined: Wed Dec 31, 2008 3:37 pm
Has thanked: 459 times
Been thanked: 521 times
Contact:

Re: More advanced LCD Four Digit Door Lock.

Post 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
Success always occurs in private and failure in full view.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 9205
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2534 times
Been thanked: 3721 times
Contact:

Re: More advanced LCD Four Digit Door Lock.

Post 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
Martin

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 9205
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2534 times
Been thanked: 3721 times
Contact:

Re: More advanced LCD Four Digit Door Lock.

Post 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
Attachments
Door Lock V2B 16F883.fcf
(32.09 KiB) Downloaded 692 times
Martin

donald
Posts: 74
Joined: Tue Feb 14, 2012 5:17 pm
Been thanked: 3 times
Contact:

Re: More advanced LCD Four Digit Door Lock.

Post by donald »

Hi everybody,
Mr. Martin, you can make a conversion for PIC16F628 ?
Without delay, without count of tries.
Thank you in advance
Attachments
Door Lock V2B.fcf
(47.63 KiB) Downloaded 591 times

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 9205
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2534 times
Been thanked: 3721 times
Contact:

Re: More advanced LCD Four Digit Door Lock.

Post 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
Martin

donald
Posts: 74
Joined: Tue Feb 14, 2012 5:17 pm
Been thanked: 3 times
Contact:

Re: More advanced LCD Four Digit Door Lock.

Post by donald »

Hi Martin,
I am interested to tackle EEPROM and to operate on a PIC16F628, if possible.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 9205
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2534 times
Been thanked: 3721 times
Contact:

Re: More advanced LCD Four Digit Door Lock.

Post 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?
Attachments
Door Lock V2 16F628A.fcf
(31.56 KiB) Downloaded 509 times
Martin

donald
Posts: 74
Joined: Tue Feb 14, 2012 5:17 pm
Been thanked: 3 times
Contact:

Re: More advanced LCD Four Digit Door Lock.

Post 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

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 9205
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2534 times
Been thanked: 3721 times
Contact:

Re: More advanced LCD Four Digit Door Lock.

Post by medelec35 »

No problem.
Glad it seems to work for you.

I have altered settings for 4MHz internal osc with no external reset.
Attachments
Door Lock V2 16F628A.fcf
4MHz int osc. No external reset.
(31.56 KiB) Downloaded 493 times
Martin

donald
Posts: 74
Joined: Tue Feb 14, 2012 5:17 pm
Been thanked: 3 times
Contact:

Re: More advanced LCD Four Digit Door Lock.

Post by donald »

Simulation works, but does not compile to 16F628.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 9205
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2534 times
Been thanked: 3721 times
Contact:

Re: More advanced LCD Four Digit Door Lock.

Post 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
Attachments
Door Lock V2 16F628A No EEPROM.fcf
(29.46 KiB) Downloaded 515 times
Martin

donald
Posts: 74
Joined: Tue Feb 14, 2012 5:17 pm
Been thanked: 3 times
Contact:

Re: More advanced LCD Four Digit Door Lock.

Post 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 !

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 9205
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2534 times
Been thanked: 3721 times
Contact:

Re: More advanced LCD Four Digit Door Lock.

Post 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
Martin

dan@ttl
Posts: 12
Joined: Thu Dec 06, 2012 2:39 am
Has thanked: 1 time
Been thanked: 3 times
Contact:

Re: More advanced LCD Four Digit Door Lock.

Post 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.
Attachments
mydoorlock2A_877A_limit.fcf
(38.94 KiB) Downloaded 426 times

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 9205
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2534 times
Been thanked: 3721 times
Contact:

Re: More advanced LCD Four Digit Door Lock.

Post 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
Attachments
mydoorlock2A_877B_limit.fcf
(39.86 KiB) Downloaded 447 times
Martin

dan@ttl
Posts: 12
Joined: Thu Dec 06, 2012 2:39 am
Has thanked: 1 time
Been thanked: 3 times
Contact:

Re: More advanced LCD Four Digit Door Lock.

Post by dan@ttl »

Thank you much. I will run it on the hardware.

brandonb
Posts: 438
Joined: Mon Aug 29, 2011 12:26 am
Location: arizona
Has thanked: 175 times
Been thanked: 173 times
Contact:

Re: More advanced LCD Four Digit Door Lock.

Post 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

dan@ttl
Posts: 12
Joined: Thu Dec 06, 2012 2:39 am
Has thanked: 1 time
Been thanked: 3 times
Contact:

Re: More advanced LCD Four Digit Door Lock.

Post 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.

dan@ttl
Posts: 12
Joined: Thu Dec 06, 2012 2:39 am
Has thanked: 1 time
Been thanked: 3 times
Contact:

Re: More advanced LCD Four Digit Door Lock.

Post 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.
Attachments
lock_dualcode_limit.fcf
(38.45 KiB) Downloaded 403 times

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 9205
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2534 times
Been thanked: 3721 times
Contact:

Re: More advanced LCD Four Digit Door Lock.

Post 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
Attachments
lock_dualcode_limit V2.fcf
(46.28 KiB) Downloaded 438 times
Martin

dan@ttl
Posts: 12
Joined: Thu Dec 06, 2012 2:39 am
Has thanked: 1 time
Been thanked: 3 times
Contact:

Re: More advanced LCD Four Digit Door Lock.

Post 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

Post Reply