Night Light Saver V6 using AT89C2051 Using Atmega

Night Light Saver

This new version has internal Ni-MH battery backup, reset button and simple time setting. Now the circuit board was embedded with lamp fixture. Preset turn on period is from 18:00 to 22:00 everyday. You may let the saver turn on whenever you want. The period of time on can be reprogrammed with sdcc. Howvere this project is not recommended for beginner. The circuit uses transformerless supply and no galvanic isolation!
Figure 1 shows complete hardware schematic of the Night Light Saver V6.0. The AC line was protected F1, a 1A fuse. Any short circuit caused by saver’s components will blow the fuse. R1 and C1 limit current to the +5V zener diode, D3. R2 discharges capacitor C1 when power terminal of the circuit was opened. The super capacitor C2,+5V 0.01F filters DC supply. D4 acts as unidirectional switch for current supplied to MCU. BT1 is +3V 60mAH Ni-MH battery for backup the MCU when main power failed. The charging current is approx. 2mA with AC main lives. When main power failed, BT1 supplies approx. 4mA to the MCU. With fully charged, it could be able to provide backup time approx. 15Hrs. The MCU runs with +Vbackup. SW1 helps reset the MCU, in case of brownout voltage by BT1. C4 and internal pull-down resistor forms simple reset circuit. The MCU, 89C2051 runs with 3.579MHz Xtal. SW2 is for clock setting, when pressed, time will be 18:00. P3.7 drives tick LED with small sink current. R5, 4.7k limits less than one mA for D5. P3.0 provides 5Hz clock signal for calibration. The output bit is P1.6. It drives PNP transistor, Q1. R3 limits base current. R5 pull base pin to +V when P1.6 is logic ‘1’ to fully turn off Q1. R4 limits DC current injected to Q2, MAC97 small triac. LP1 is incandescent 25W lamp. The lamp’s wattage can be up to 40W.
I built the board with universal pcb and put it under the lamp fixture. SW1 and SW2 are small tact switch. To press them I need a small rod made by bamboo.

Night Light Saver

Software
The source program is beautiful coding with c language. After timer initialization then idle mode is entered by setting bit0 in PCON register. The timer0 overflows 10 times per second. Tasks for update clock, check SW2, blink LED and update output bit will be executed every 1/10s. The task that controls output instead, will be executed every one second. For different preset time, time on, time off, you can edit the source code and recompile with sdcc easily.

Read more: Night Light Saver V6 using AT89C2051

Leave a Comment

Your email address will not be published. Required fields are marked *