Simple Power Guard – PIC12F683

This is a very simple and accurate power guard circuit. This circuit is useful to guard the electronic or electrical devices from mains transients and spikes. Very high spikes can develop at power on due to sparking in the switch and more serious effects occur when power resumes after a power failure due to high magnetic field in the distribution transformer. This will damage your device permanently. To avoid such damages we can use this circuit. Simple Power Guard - PIC12F683

This circuit used cheap PIC12F683 micro-controller. It controls all the functions of power guard. After power is applied, the green LED starts to blink. This circuit gives a time delay before giving power to the device. Default value is 30 seconds. However, you can change this value. See configuration for more details. After this delay, Green LED turns on permanently. Then Relay activates and connects power to the device.

When the power is abnormal Yellow or Red LED turns on and relay will turn off to protect our device. The Green LED will start to flash again and after delay time it check power status and turn relay on if the voltage is good. Yellow LED indicates low voltage and Red LED indicate high voltage. If all the LEDs are turn on, that indicates firmware error and pleases re-programmed micro-controller.


Configuration and Calibration

For this circuit I used 12v step down transformer. Its output use to sense the power condition. Before using, you need to calibrate this circuit for working correctly. In my project, I choose 240v as normal, 260v as high and 200v as low voltage.

Connect multimeter to GP0 and check voltage. if it exceed 5v immediately turn off power and check the component and connections. (Typical value is 3 – 3.5v)

V = [Tp/12] x [(Vdd/1023) x Eeprom val x 4]
Tp = primary voltage

200 = [240/12] x [(5/1023) x Eeprom val x 4]
260 = [240/12] x [(5/1023) x Eeprom val x 4]
Simple Power Guard - PIC12F683 schematic
Eeprom value for low condition (200v) = 511 (1FF hex)
GP0 voltage = (2v4)

Eeprom value for high condition (260v) = 664 (298 hex)
GP0 voltage = (3v3)

Write those values to Eeprom.
V high = Eeprom (0)*256 + Eeprom (1) – (0x02 and 0x98)
V low = Eeprom (2)*256 + Eeprom (3) – (0x01 and 0xFF)

To change  delay time simply changes the value of Eeprom address 4 (Default 0x3C)

Delay time in seconds = value of Eeprom address / 2
0 < value of Eeprom address < 255 (0 < Delay time in seconds < 127)
Minimum delay time is 0 seconds and maximum delay time is 2 minutes




For more detail: Simple Power Guard – PIC12F683

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us: