I found (and bid on) this project on oDesk.com. I decided it looked like an interesting project, and as I was never awarded the project, I don’t think there are any issues with me posting a solution to it.
Here is the original project:
------------------------------------------------Job Description-------------------------------------------------
I'm looking for a lock system running on 8bit PIC.
Input are 6 buttons, output is a controlling a MOSFET.
Button voltage: OFF state: 0V, ON state: 5V.
Power input for PIC is 5V.
Buttons are numbered from 1 to 6. A correct 4 digit code (like a phone PIN)
set's the output to ON and thus turns the MOSFET on. The current that will pass
through the transistor is max 200mA.
There are 4 tries to enter the code (press 4 buttons in the right order), if you
fail, then you have to enter a 9 digit code (let's call it PUK). You have 99
tries to enter the PUK correctly, after that the device locks itself (output is
permanently OFF). PIC has to keep track of the number of tries of PIN and PUK
are entered even if there is a power failure.
I need you to identify the right PIC for the job and write the code. If you are
good with electronics, also the schematics and PCB design.
Budget depends if you will only write the code or also design the PCB.
------------------------------------------------Job Description-------------------------------------------------
I thought this was an interesting project, because I have already done a similar project, with a 4x4 keypad and a PIC24HJ24GP202. I liked the challenge of the 8-bit limitation, and to make things even more interesting, I chose to use an 8-pin chip on top of the already given restriction of using only an 8-bit chip.
That being said, I only had two Microchip 8-bit, 8-pin chips available to me [1]:
1) PIC12F609
2) PIC12F615
From the two figures below, we see that the PIC12F615 is the only one of the two that has an ADC module. So, that is the only chip that meets the requirements of
1) An 8-Bit PIC
2) Limited to an 8-pin DIP package
3) 1 digital I/O output, 1 INT, and 1 ADC module
Figure 1: PIC12F609 Diagram. Note the lack of ANx values on the pins.[1]
Figure 2: PIC12F615 Diagram. Note that ANx on various GPIO pins.[1]
The next step in the project is to develop the hardware and software. I think it is important to develop the hardware first, and test to make sure it works. Following the hardware development, the software will need to be developed and tested. After they are both tested, we can put them together, test them, fix any final problems, and declare the project complete!
[1] http://ww1.microchip.com/downloads/en/DeviceDoc/41302A.pdf Pages 2 & 3.