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: 8440
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2412 times
Been thanked: 3451 times
Contact:

More advanced LCD Four Digit Door Lock.

Postby medelec35 » Wed Apr 11, 2012 8:08 pm

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 869 times
These users thanked the author medelec35 for the post (total 4):
JohnCrow (Wed Apr 11, 2012 8:20 pm) • Benj (Thu Apr 12, 2012 9:39 am) • Spanish_dude (Tue May 29, 2012 8:21 pm) • brandonb (Mon Dec 17, 2012 9:27 am)
Rating: 21.05%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

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

Re: More advanced LCD Four Digit Door Lock.

Postby medelec35 » Thu Apr 12, 2012 11:08 am

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
Door lock V2A.png (13.83 KiB) Viewed 20581 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 672 times
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

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

Re: More advanced LCD Four Digit Door Lock.

Postby Benj » Thu Apr 12, 2012 11:19 am

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
These users thanked the author Benj for the post:
medelec35 (Thu Apr 12, 2012 11:21 am)
Rating: 5.26%
 

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

Re: More advanced LCD Four Digit Door Lock.

Postby medelec35 » Thu Apr 12, 2012 11:27 am

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

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
Steve001
Valued Contributor
Valued Contributor
Posts: 1086
Joined: Wed Dec 31, 2008 3:37 pm
Has thanked: 440 times
Been thanked: 492 times
Contact:

Re: More advanced LCD Four Digit Door Lock.

Postby Steve001 » Thu Apr 12, 2012 8:25 pm

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
These users thanked the author Steve001 for the post:
medelec35 (Thu Apr 12, 2012 11:50 pm)
Rating: 5.26%
 
Success always occurs in private and failure in full view.

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

Re: More advanced LCD Four Digit Door Lock.

Postby medelec35 » Thu Apr 12, 2012 11:54 pm

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

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

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

Re: More advanced LCD Four Digit Door Lock.

Postby medelec35 » Fri Apr 13, 2012 11:06 pm

As promised added a function to change seconds door stays unlocked, by entering a new delay value via keypad:
Door lock V2B.png
Door lock V2B.png (12.78 KiB) Viewed 20534 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 591 times
These users thanked the author medelec35 for the post (total 2):
fotios (Sat Apr 14, 2012 7:28 am) • mauro (Fri May 18, 2012 7:47 am)
Rating: 10.53%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

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

Re: More advanced LCD Four Digit Door Lock.

Postby donald » Sun May 27, 2012 4:30 pm

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 500 times

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

Re: More advanced LCD Four Digit Door Lock.

Postby medelec35 » Sun May 27, 2012 4:37 pm

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:
viewtopic.php?f=26&t=7413
which is more basic and does not even use EEPROM .

Martin
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

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

Re: More advanced LCD Four Digit Door Lock.

Postby donald » Sun May 27, 2012 5:38 pm

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

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

Re: More advanced LCD Four Digit Door Lock.

Postby medelec35 » Sun May 27, 2012 6:29 pm

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 439 times
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

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

Re: More advanced LCD Four Digit Door Lock.

Postby donald » Sun May 27, 2012 6:49 pm

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: 8440
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2412 times
Been thanked: 3451 times
Contact:

Re: More advanced LCD Four Digit Door Lock.

Postby medelec35 » Sun May 27, 2012 7:11 pm

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 438 times
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

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

Re: More advanced LCD Four Digit Door Lock.

Postby donald » Sun May 27, 2012 7:28 pm

Simulation works, but does not compile to 16F628.

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

Re: More advanced LCD Four Digit Door Lock.

Postby medelec35 » Sun May 27, 2012 7:58 pm

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 460 times
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

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

Re: More advanced LCD Four Digit Door Lock.

Postby donald » Tue May 29, 2012 4:15 pm

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: 8440
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2412 times
Been thanked: 3451 times
Contact:

Re: More advanced LCD Four Digit Door Lock.

Postby medelec35 » Thu Jul 12, 2012 7:21 am

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

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

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.

Postby dan@ttl » Sat Dec 15, 2012 1:33 am

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 372 times

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

Re: More advanced LCD Four Digit Door Lock.

Postby medelec35 » Sat Dec 15, 2012 2:02 am

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 395 times
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

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.

Postby dan@ttl » Mon Dec 17, 2012 3:18 am

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.

Postby brandonb » Mon Dec 17, 2012 9:38 am

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.

Postby dan@ttl » Mon Dec 17, 2012 8:18 pm

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.

Postby dan@ttl » Mon Jan 07, 2013 10:20 pm

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 343 times

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

Re: More advanced LCD Four Digit Door Lock.

Postby medelec35 » Tue Jan 08, 2013 3:35 am

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 382 times
These users thanked the author medelec35 for the post:
dan@ttl (Tue Jan 08, 2013 8:02 pm)
Rating: 5.26%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

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.

Postby dan@ttl » Tue Jan 08, 2013 8:00 pm

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