Programmable relay switch using PIC MCU (revised version)
Programmable relays are key elements in numerous automation applications such as automatic street light control, watering and pump control, HVAC, home automation, power plants automation in industries, etc. This article describes a DIY programmable relay switch using PIC16F1847 (PIC16F628A can also be used) microcontroller. It is a revised version of my previous PIC-based relay timer project with added features and some improvements in the circuit design part. Like my previous version, it also allows you to set both ON and OFF times. The maximum time interval that you can set for ON and OFF operations is 99 hours and 59 minutes. The new version features cyclic option, which means you can choose to run it in a continuous loop of ON and OFF cycles. The timer can be programmed through 4 push switches. The programming menu, relay status (ON or OFF), and number of cycles completed are displayed on a 16×2 character LCD. The timing resolution of this relay timer is 1 minute. The timer also saves the previously-set ON/OFF times and the cyclic option in its internal EEPROM so that it can retain these values after any power supply interrupt. The firmware for this project is provided for both PIC16F1847 and PIC16F628A microcontrollers.
Here are the summary of the features that this programmable relay switch has:
- On-board +5V voltage regulator (operates at 9-15V DC input)
- OFF and ON time setup for the relay operation
- Option for cyclic run (maximum 100 cycles, after which the timer stops automatically)
- Stores ON/OFF times and Cyclic option from previous setup into internal EEPROM
- ON/OFF timing range: 0 to 99 hours and 59 minutes with 1 min resolution
- Interactive user interface using 4 tact switches and a character LCD
- On-board buzzer alarm
You can buy the PCB for this project from Elecrow.
Let’s first talk about the hardware part of this relay timer project. It is not much different than the previous version except for a few improvements, such as an optical isolation between the microcontroller I/O pin and the relay control circuit, which will be discussed later.
Power supply: The entire circuit runs off a regulated 5V power supply derived from the LM7805 linear regulator chip (Figure 1). To minimize the heat dissipation in the voltage regulator, the recommended input DC voltage is 9V, which can be easily obtained from a DC wall adapter. The circuit board contains a 2-pin terminal block and a standard 2.1mm DC barrel jack to receive the unregulated input DC voltage. There is no power supply ON/OFF switch available on board this time.
For more detail: Programmable relay switch using PIC MCU (revised version)
JLCPCB – Prototype 10 PCBs for $2 + 2 days Lead Time
China’s Largest PCB Prototype Enterprise, 300,000+ Customers & 10,000+ Online Orders Per Day
Inside a huge PCB factory: https://www.youtube.com/watch?v=_XCznQFV-Mw
Current Project / Post can also be found using:
- mini projet de clock avec le pic
- pic18 clock project