PIC Countdown Timer


This project is intended as a countdown timer for a UV exposure box for PCB development that uses fluorescent UV lamps (it will also work with any other lamp, don’t worry). It is based around a PIC16F627 micro and has following features:

  • adjustable time in 15-second increments (up to 10 minutes)
  • lamp preheat feature
  • two button operation (with audible feedback)
  • countdown alarm (when timer reaches zero)
  • relay for lamp switching
  • 7-segment display

10 minutes?

I have chosen the upper time limit of 10 minutes which should be more than enough for most applications and initial time is set for a 5 minute countdown (I’m preparing a revised software which will load initial time from EEPROM so it can be configured manually). Step increment of 15 seconds has been chosen partially due to ease of operation because there are only two buttons – time adjustment and start/stop. Time adjustment is incremental meaning that each time you press the button time is incremented by 15 seconds. When upper limit is reached time is reset to zero and the process repeats. Start/stop button is used for, you will never guess, starting and stopping the timer with lamp preheat feature.

Serving it warm

Lamp preheat was added due to necessity – fluorescent lamps take some time to achieve full light output. It wouldn’t be a problem if it took exactly the same on every lamp turn-on, but that’s not the case as you might have guessed. What’s even worse is the fact that if you use multiple lamps with separate ballasts not all lamps will turn on at the exact moment. I have a situation where 2 out of 3 lamps turn on and the 3rd lamp still flickers for a couple of seconds then finally turns on. This kind of bugged me a little so I added the lamp preheat feature which basically turns on the lamps but doesn’t start the countdown (countdown is initiated by a second button press). If your lamps behave properly (incandescent or LEDs) you can simply double-click the start/stop button and it will skip the preheat function.

Bring it on

Countdown timer is separated into two boards – mainboard and I/O board. Mainboard PCB contains the power supply, lamp relay and PIC with its associated circuitry. I/O board contains the displays and buttons for user interface and the boards are connected via two 8-pin ribbon cables allowing you to place the I/O board where ever you want (i.e. outside the UV exposure box). Entire circuit can be powered from a small transformer with a secondary rating of 6-24V but I would recommend to keep the input voltage below 15V because of the voltage regulator IC.

Mainboard I/O Board

As you can see from the schematics, entire circuit is quite common and simple. Displays are multiplexed meaning that they are driven one by one, really fast, so they seem to be constantly on due to persistence of vision. One nice feature with the 16F62x PICs is their internal RC oscillator which is accurate enough for this purpose and frees up two additional pins. As for the power supply, 7805 IC regulator seems to be all time favorite with DIYers and I’m no exception. You might want to fix it to a small heat sink especially if you are going to put the circuit next to the lamps in a closed box.

Use the relay to switch the live (or “hot”) AC wire!

Hi-res schematics and board layouts can be found at the end of this article.

Operation

Timer operation is nice and simple, just the way I like it! As mentioned before, you adjust the time with the TIME ADJ button and start or stop the timer with the START/STOP button. While adjusting the time the display will obviously show the time. When START/STOP button is pressed once the timer will go into lamp preheat mode and the display will alternate between “HEAT” and set time (you can still adjust the time if needed). On a second button press the timer will start the countdown and the display will show remaining time. When the countdown is complete the display will show a blinking “DONE” text (or rather “dOnE” on 7-segment displays) and an alarm will sound for indication which can be cancelled by pressing any button.

Flash before use

I have provided HEX files for 16F627(A) and 16F628(A) PICs so you can use whichever you have at hand. Configuration data is in the HEX file provided you select correct device before loading the file. In any case, all fuses should be off except power-up timer. Oscillator must be configured for IntRC with I/O functionality (since RA6 and RA7 are used for driving the buzzer and relay).

Give it to me

Here is the documentation available for this circuit. You can download individual items or an entire archive if you want to save a few clicks. Each PCB layout has a component view (bottom + top + silkscreen) to assist in component placement. Layouts are 600 DPI images so keep that in mind before printing (board dimensions are also available).

Hi-res schematic: Mainboard, I/O Board
PCB layout: Mainboard, I/O Board
Connection diagram: not available
HEX file: 16F627, 16F627A, 16F628, 16F628A
Software: not available
Complete archive: PIC Countdown Timer

Things to improve for Rev 2.0:
- remember last selected time and recall it on turn-on
- load configuration from PIC’s EEPROM (time limit, time step, audible button feedback, alarm and preheat bypass)


  1. jim says:

    Well written article and great website. Very informative. Keep up the good work!

  2. Vane says:

    Marko sta da komentisem to ti je Prekrasen i edukativen proekt bravo za tebe,produzi samo taka..Pozdrav od Makedonija

  3. [...] Arcom Leave a Reply Visited 1 times | Tags: Pic Microcontroller, [...]

  4. A man’s interest in a single bluebird is worth more than a complete but dry list of the fauna and flora of a town.-Henry David Thoreau

  5. Coach outlet says:

    Thanks for that wonderful submit. I’ll take the notes you have written.

  6. Hello. Great job, if I wasn’t so busy with my school work I read your full site. Thanks!

  7. Billi says:

    Not quite the subject, but your site loads really slow. Something wrong with your server ?

  8. Wonderful blog! I really love how it’s easy on my eyes and the data are well written. I am wondering how I might be notified whenever a new post has been made. I have subscribed to your rss feed which need to do the trick! Have a nice day!

  9. I was looking the some useful information that was referred to in the above article in other websites, but this article was the most helpful so far. Thank you.

  10. I would be grateful if you continue with the quality of what we are doing now with your blog … I really enjoyed it

  11. Thank you for your insightful comments. I hope to visit your website soon.

  12. i see nice info there thankfull to you.

  13. Hi!
    Thanks for providing some informative info on the topic.

    I am saving your website and might definitely check back often.

  14. JEANNINE says:

    How long have you been doing this?

  15. Ilse says:

    Not quite the theme, but your web site loads real slowly. Something wrong with your host ?

  16. Blogmyreview says:

    yes i was looking for that thanks for sharing this.

  17. Thank you for your insightful comments. I hope to visit your website soon.

  18. Panama Canal says:

    http://arcslab.com/pic-countdown-timer is great! you have many fans in my country.

  19. Kudos from one brainiac to another.

  20. hi, thank for this latest information. Therefore, I would like to ask for your permission to add some of this information in my blog. Of course, I will provide a link to your blog, as a source of my quoted information.

Leave a Reply

  • 2010: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec