Night Light Saver V3.2 (PIC12C508)


It’s time for 8-pin microcontroller Microchip PIC12C508, the SAVER V3.2, my latest design of a device that turns a night light on and off everyday. The circuit uses only a PIC12C508 8-pin CMOS micontroller and a small triac, MAC97A6. The Saver V3.2 also demonstrates the use PCW PIC C Compiler.Night Light Saver V3.2 (PIC12C508)


Circuit Description

The schematic of the SAVER V3.2 is depicted in Figure 1.A transformerless power supply uses Xc of a 0.22uF capacitor to limit current providing about 10mA current source. The diodes rectifies ac current to dc current which in turns charged to filtering capacitor, 100uF. A 5.1V zener diode provides dc supply ~5V to the PIC12C508. The microcontroller circuit runs with low power 32kHz X-tal. GP2 connects a momentary button for setting time to 8:00. GP1 drives small dot LED that blink every 5 s for normal running. GP0 directly drives with source current to a small triac MAC97A6.

Caution!! High Voltage!! Do not touch any conductive parts of the circuit


Saver.hex is HEX file suitable for writing the code to the PIC12C508 chip. This file sets time to 8:00 when press S1 once. Time on and off is set to 19:00 to 22:00 everyday.

The original source program SAVER.C and SAVER.H was written in ‘C’ language. User may change set time when press S1 and change time on/off.

To recompile the source file you need a PCW PIC C Compiler from CCS.


The Saver may be built-in any kind of lamp fixtures. Figure 2 shows the author’s concept for building-in a 25W lamp fixture.

Although the Saver can operate even wrong connection of L and N to the circuit. The author suggests to correct AC line connection to L and N of the circuit. After finished installation, turn the main switch on, functioning LED will blink every 1 second. Let try press S1 once, the lamp will turn on 1 minute then off. The Saver assumes the current time is then be 8:00.

Note that every time you press S1, the lamp will turn on 1 minute only once. The day after the lamp will then turn on and off at preset time. Functioning LED will blink at low rate indicating normal operation.

If high blink rate is noticed when return home, power failed should happen, no problem, just wait again 8:00 then press S1.

If the LED is not blinked, someone may turn main switch off, turn it back on again and wait for 8:00. Night Light Saver V3.2 (PIC12C508) schematics

Energy Saving Lamp

The Saver was not designed for turning such energy saving lamps on and off. They mostly use internal high frequency inverter. I have been tested with one from National, it works!! But I am not guarantee for your energy saving lamp. I shall be grateful if you could test and let me know the result.



For more detail: Night Light Saver V3.2 (PIC12C508)

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: