Summary of Programmable digital timer switch using a PIC Microcontroller
This project builds a programmable digital timer using a PIC16F628A microcontroller to schedule an appliance via a 5V relay. It provides separate programmable on and off times (up to 99 hours 59 minutes), a 16×2 LCD user interface, four pushbuttons for input, a piezo buzzer for audible feedback, and is powered from a 9V adapter with a 7805 regulator.
Parts used in the Programmable Digital Timer Switch:
- PIC16F628A microcontroller
- 16×2 character LCD (4-bit mode)
- 5V relay
- PN2222 transistor
- Piezoelectric buzzer
- 4 push buttons
- LM7805 voltage regulator IC
- 9V DC wall adapter (input supply)
- 39 Ohm resistor (for LCD backlight, if present)
- General purpose prototyping circuit board
- Assorted passive components (wiring, resistors, etc.)
Circuit Design
The circuit diagram of this project is shown below. A 5V relay is driven by a PN2222 transistor that is controlled by RB3 pin of PIC16F628A. Digital inputs from the 4 push buttons are read through port pins RA2, RA3, RA4, and RB0. The functions of these push buttons are discussed in the operation section below. A standard 16×2 character LCD is used in the project to display the device status, program menu and time. The LCD is operated in 4-bit mode, therefore, only 6 I/O pins of PIC16F628A are required to drive it. A piezoelectric buzzer provides audible tone when the timer is started and stopped. It also beeps when the device is turned on or off. The + 5V power supply for the circuit is derived from a LM7805 regulator IC. The input to the regulator is given from a 9V DC wall adapter.
In the circuit diagram, the pins 15 and 16 of the LCD are shown open. These pins are available only in those LCDs that have a back light illumination LED. The pins 15 and 16 are the anode and the cathode of the LED. If your LCD has the back light LED, you can connect these pins to the power supply terminals with a 39 Ohm resistor in series. The backlight LED enhances the readability of the LCD display in low illumination condition.
The complete circuit soldered on a general purpose prototyping circuit board is shown below.
Operation of the timer
The timer gets inputs from the 4 push buttons. Their functions are described as follows:
- What microcontroller is used in the project?
The project uses the PIC16F628A microcontroller. - How is the appliance switched on and off?
The appliance is controlled through a 5V relay driven by a PN2222 transistor controlled from RB3 of the PIC16F628A. - How many push buttons are used and where are they connected?
The timer uses four push buttons connected to RA2, RA3, RA4, and RB0 of the PIC16F628A. - What display is used for the user interface?
A 16×2 character LCD operated in 4-bit mode is used to display status, menu, and time. - What is the maximum programmable on and off interval?
The maximum time interval for on and off operation is 99 hours and 59 minutes. - How is the circuit powered?
The circuit is powered from a 9V DC wall adapter with a 5V supply derived using an LM7805 regulator. - Does the LCD backlight require extra connections?
If the LCD has a backlight, pins 15 and 16 (anode and cathode) can be connected to the supply via a 39 Ohm resistor in series. - What audible feedback does the project provide?
A piezoelectric buzzer provides tones when the timer is started, stopped, and when the device is turned on or off.
