Any Ideas on Letting a User Set Their Own PIN within a keypad system?

miskhar

New Member
Hello,

Ive been working on a lockbox design using an 18M2 and code based off of the PicAxe keypad lock kit. I wanted to be able to let users define and use their own PIN. I poked around the forum and haven't really found anything helpful so far.

My thought was to turn the PIN numbers into variable locations. After inputting the correct PIN, the user would be able to hit a button on the keypad (say #, during the "open" state) to use the keypad scanning code (the rows and columns method) to detect which keys are being hit, saving those numbers to separate locations, and then setting the original PIN variables to the user defined PIN.

I haven't had a chance to play around with this yet, but I was wondering if anyone else out there has done something similar, and if I'm on the right track. Any input, or an example of some code that accomplishes this would be greatly appreciated.
 

premelec

Senior Member
Welcome to this forum - you probably want to store the PIN to EEPROM so it stays when power is interrupted. You can also store a code that says it has been stored - It is more complicated if you want to be able to recover the PIN if the user forgets it... In that case _you_ could rewrite the PICAXE chip with entire code and have the _user_ then store another PIN...
 

SAborn

Senior Member
It is more complicated if you want to be able to recover the PIN if the user forgets it...
I don't see why it's more complicated if you have a programming socket available to the outside of the lock box, as all you do on power up is read the eeprom and Sertxd the value stored.
Lets face it the average idiot trying to crack the lock box wont have a laptop and a serial terminal at the correct baud to view the data.
 

JimPerry

Senior Member
Is it a "Lockbox" or a "Doorlock" ? Important if doorlock and SAborn advice used - then programming from the secured area only. :rolleyes:
 

hippy

Ex-Staff (retired)
Reporting the programmed PIN could also be locked behind having to enter another specific PIN or longer number sequence. What is output could also be encrypted or encoded.

If there is an Okay or Fail LED the code can be hidden in the flashes of those. Someone may spot there is something there if they guess the right sequence to activate it but would not be able to easily tell what was there.

But back to the main need - Key to success in my opinion is having a subroutine which returns when a new key press is detected which returns a key pressed identifier in a variable. Get that routine working then wrap the main program around that.
 

miskhar

New Member
Thanks for all the thoughts!

To answer your question JimPerry, it is intended to be a lockbox, not a doorlock.

hippy, your idea of the subroutine putting an identifier into a variable is right along the lines another guy in my class and I discussed. We concluded that it would be the easiest way, so I'm very glad to hear that we are at least thinking along the lines of those with more experience than us. This weekend or next week I'll be trying to use the keypad scanning code in a subroutine. I'll let you guys know my results!

The collective ideas here about PIN retrieval are interesting. I had kicked around the idea of maybe letting the user be able to have a setting where they could enter a mathematical function (* or / or + or -) and then maybe enter a number, so that if they needed to retrieve the PIN they would be able to get a PIN returned that, with some thought, would allow them to figure out their code. But if the pin + the mathematical function wound up being floating point...well, it just started to get pretty convoluted. The eeprom+sertexd (or maybe even serout?), or the flashing LED's (there will be LED's to indicate the state of the lock) seem much more elegant and far less convoluted.

Since there is thoughtful discussion here, I'll at least flesh out my project idea, as I've really appreciated the input you have given me so far. This is (obviously) a lockbox; it will use a 4x4 keypad (i've got a few, they seem to be better put together than the $2 3x3 that I see alot online). There will be either a bicolor LED or some combination of other LED's for lock state indicators, and I've got a Parallax LCD screen with attached piezo.

So far, on the breadboard I have the 3x3 PicAxe code working which leaves one column on the 4x4 unusable now. I was planning to allow the user to use this column to input hex values in the PIN (or, rather, partial hex, as it only goes as far as D). I'm also not sure if I will actually use the Parallax LCD or if ill get one of the PicAxe OLED kits. I've got a 9v 600ma (I believe, will have to double check the specs) solenoid to act as the lock/unlock mechanism. I was planning on trying to find alternative solenoids (pull-type, hopefully) that are smaller than the one I currently have, which is about 3x1x1.5 inches. And then I've gotta find (or plan to build) a suitable box to implement it in. Another idea I was kicking around was maybe putting another power source in parallel with the main battery pack, which would allow someone to plug the box in if it had been sitting for a very long period of time or the batteries failed for some reason (overkill I know, but it will be fun looking at ways to implement it). The ability for a user to unlock the box, set a timer that once relocked, would prevent the box from being opened for some length of time also seemed like it would be an interesting bit of code to try and flesh out.

Wow, sorry about the wall of text, but from scouring the forums, and getting great responses in this thread, I figured I'd just throw these ideas and specs out there to see if it will spark any further interesting thoughts. Thanks guys!
 
Top