Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
Resource icon

PIC Single-Chip 4-Digit 99-Minute Timer 2014-05-19

I'd like to present a relatively simple 4-digit 99 minute timer project. The low parts count design is a result of experiments with some very bright miniature 4-digit displays available from Sparkfun that come in red, green, yellow, white (all $1.95), and blue ($2.50) colors.

4-Digit #1.png


In addition to the Digital 99 Minute Timer presented here, the circuit design, with minor modifications, might support several other projects, including, but not limited to;

() Digital Voltage Monitor
() Digital Thermometer
() Digital Thermostat
() Repeating On/Off Interval Timer
() Digital Alarm Clock
() Digital Clock/Calendar/Alarm/Timer
() Digital Stopwatch
() Digital RPM Indicator

Requirements

You'll need a programmer to program the PIC16F1828 device and you'll need a regulated 5 Vdc power source to power the circuit. You'll also need a simple transistor, opto-isolator, SSR (Solid State Relay IC), or similar driver circuit which will take its input from the active high output signal on the RA2 pin. The output circuit you choose depends on what you intend to drive (relay, etc.)

4-Digit Schematic.jpg


Hardware

The wiring diagram shows several components that are not required for the 99 Minute Timer application. Specifically, you don't need to install the crystal and capacitors in the oscillator block and you don't need to install the two discrete 'A' and 'B' LEDs for this particular project.

The little 4-digit displays are so bright that I decided to drive them one segment at a time (1/32nd duty cycle) directly from the PIC16F1828 I/O pins (no column/digit driver transistors). I didn't use current limiting resistors on the LED cathode segments, relying instead on ~250 ohms combined RDS(ON) resistance of the I/O pin FET drivers inside of the PIC (about 150 ohms for a high-side 'sourcing' FET driver and about 100 ohms for a low-side 'sinking' FET driver).

You'll find that the red, green, and yellow displays (Vf=2.1v) are a bit brighter than the white display (Vf=3.1v) and the blue display (Vf=3.4v).

Parts List

1 ea. PIC16F1828-I/P (DIP package)
1 ea. 0.1-uf (100nf) ceramic capacitor
1 ea. 10 kOhm, 1/8th watt carbon film resistor
4 ea. 1N914 or 1N4148 silicon switching diode
1 ea. Sparkfun COM-09481 Blue Common Anode 4-Digit Display
4 ea. generic momentary contact switch
1 ea. Soberton GT111P Piezo Speaker
Misc. sockets, connectors, prototype circuit board​

The timer circuit was built on a Radio Shack prototype board (sku 276-149) with point-to-point wiring using 30 guage Kynar wire-wrap wire. A plastic coated paper silk screen was glued onto the top (component) side of the board.

Software

The source and hex program files are contained in the zip file attachment. Program the 16F1828 device with the hex program file using a PICKIT2, PICKIT3, or similar programmer.

The program was written using the free/lite version of BoostC from Sourceboost. The program uses packed BCD "minutes" and "seconds" variables and the code to increment and decrement those variables may look a little strange to some programmers.

Operation

The <SET> switch is used to toggle between "set" and "run" modes. Press <SET> to enter "set" mode and the "minutes" display group will flash at a 2-Hz rate. While in "set" mode the <Rt> arrow key is used to toggle between the "minutes" and the "seconds" display group and the <Up> and <Dn> arrow switches are used to increment or decrement the value of the current flashing display group. The "minutes" display group will rollover from 99 to 0 or from 0 to 99 and the "seconds" display group will rollover from 59 to 0 or from 0 to 59. The <Up> and <Dn> arrow switches will repeat when held down. Press <SET> again to exit "set" mode and enter "run" mode (display stops flashing). In "run" mode you press the <Rt> arrow switch to start or stop the Timer. An active high signal is available on the RA2 pin when the Timer is running. While the Timer is running and counting down, the <SET> switch, the <Up> switch, and the <Dn> switch are disabled. Those switches are still sampled and debounced in the interrupt service routine and you'll still hear a "new press" beep when you press one of them but they're ignored and cleared by the logic in the program.

4-Digit #3.jpg
  • 4-Digit #1.png
    4-Digit #1.png
    377.4 KB · Views: 9,918
  • 4-Digit Schematic.jpg
    4-Digit Schematic.jpg
    107.4 KB · Views: 9,374
  • 16F1828 Photo Timer.zip
    4.2 KB · Views: 1,415
  • 4-Digit #3.jpg
    4-Digit #3.jpg
    182.2 KB · Views: 1,149
Author
Mike - K8LH
Views
8,722
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from Mike - K8LH

New Articles From Microcontroller Tips

Back
Top