So I had a PIC16F628A lying around and after searching the web I found a Brazilian site (I think?) with tons of interesting projects with microcontrolers. This project is based on one of them.
This is the schematic of the timer:
As I said, this project is based on an existing project, but actually my schematic is quite different and the code was almost completely rewritten. My programming abilities are little rusty, but I think the final result is quite good.
There are three buttons to operate the timer: "START/STOP", "MIN" and "SEC".
"START/STOP" is for starting and pausing the timer.
"MIN" is for adjusting the minutes. Minutes may go up to 99 and then starts again from 0.
"SEC" is for adjusting the seconds. Seconds goes up to 59 and then starts from 0.
"MIN" and "SEC" have repeat functionality.
Pressing MIN and SEC buttons simultaneously will reset the timer.
When the timer reach 00:00, the buzzer sounds 3 short and 1 long beeps and the LED lights up.
The buzzer is electromagnetic type.
After this any of these three buttons will reset the status and LED will switch off.
When timer is counting down - RB7 (pin 13) is high and when the timer is stopped - RB7 is low.
With this pin we can operate some external circuitry. In my case there will be connected a transistor which will switch on and off the UV exposure box.
Jumper J1 is for calibrating of the timer. When shorted, the timer enter in adjusting mode. With MIN and SEC buttons we can increase/decrease the value of an internal parameter thus slowing down or speeding up the timer. This value is stored in the EEPROM.
Pressing START/STOP button when in this mode will reset this parameter to its default value.
I tested the schematic on the breadboard and everything works as described.
The code is written and compiled with mikroC PRO for PIC. The options for the project are:
Oscillator: INTOSC oscillator: I/O function...
Oscillator frequency: 4.000000 MHz
Watchdog Timer: disabled
Power-up Timer: enabled
RA5/MCLR/VPP pin function: disabled
Brown-out detect: enabled
The .hex file was programmed in the microcontroller with my clone of PICkit2 using "PICkit 2 programmer" v.2.61
Link for downloading the archive with schematic, source .c file and .hex file : Timer
Use them on your own responsibility!
Some photos of the finished board:
And the schematic (same as above with added switching transistor and the buttons are different type):
How it works:
Update: June 12, 2014
Because, one of my reader ask me to publish the files of the actual device (second schematic), here the link for downloading them: Timer (PIC16F628A)(2).rar
Inside are the schematic, PCB, partlist, source file and .hex file.
Use them on your own responsibility!
Notes: the LCD display is connected via male - female pin headers. I prefer to solder the 16-pin female header on the PCB and the male pin header to the display board, but it can be done otherwise.
If there are used standard pin headers, the distance between display board and PCB is around 10mm, so there must be used low profile capacitors for C1 and C2 or they can be bend to fit under the display.
Update: February 25, 2016
There is update of the software - the changes are:
slightly different interface, the LED will light when the timer is counting. To enter in the adjustment mode it is needed only brief shorting of RA0 to the ground. pressing the START/STOP button will end the adjustment mode.
The link: Timer (PIC16F628A)
In the archive are only .C and .HEX files. The schematic and the PCB are the same and can be found in the previous update.
Update: May 1, 2016
One of my readers, Alnoor Ratansi send me a modified code for the timer with added ability to count up to 99 hours 59 min 59 sec. The software uses one additional button attached to pin 16 for adjusting hours. Thank you, Alnoor!
I haven't tried the code, so if anyone try the code, let me know if it work properly. Here you can download it: PicTimer