The complete hardware schematic of the Night Light Saver V6.0 includes an AC line protected by a 1A fuse (F1). Any short circuit caused by the components of the saver will blow the fuse. Resistor R1 and capacitor C1 limit current to the +5V zener diode (D3). Resistor R2 discharges capacitor C1 when the power terminal of the circuit is opened. The super capacitor C2 (0.01F, +5V) filters the DC supply. Diode D4 acts as a unidirectional switch for the current supplied to the microcontroller unit (MCU). The backup battery (BT1) is a +3V 60mAh Ni-MH battery that powers the MCU when the main power fails. The charging current is approximately 2mA when AC mains are active. When the main power fails, BT1 supplies about 4mA to the MCU, providing a backup time of approximately 15 hours when fully charged. The MCU operates with +Vbackup. Switch SW1 resets the MCU in case of brownout voltage from BT1. Capacitor C4 and an internal pull-down resistor form a simple reset circuit. The MCU, an 89C2051, operates at 3.579MHz with a crystal oscillator. Switch SW2 is for clock setting; when pressed, the time is set to 18:00. Pin P3.7 drives a tick LED with a small sink current, while resistor R5 (4.7k) limits the current to less than one mA for diode D5. Pin P3.0 provides a 5Hz clock signal for calibration. The output bit is P1.6, which drives a PNP transistor (Q1). Resistor R3 limits the base current, and resistor R5 pulls the base pin to +V when P1.6 is high to fully turn off Q1. Resistor R4 limits the DC current injected into Q2, a MAC97 small triac. The load (LP1) is an incandescent lamp rated for 25W, with a maximum wattage of 40W. The source program is written in C language. After timer initialization, the system enters idle mode by setting bit0 in the PCON register. Timer0 overflows 10 times per second, executing tasks such as updating the clock, checking SW2, blinking the LED, and updating the output bit every 1/10 second. The task that controls output is executed every second. For different preset times, the on and off durations can be edited in the source code and recompiled using SDCC. A sample scheduler scanning function, scan_pgm(), is provided. To modify the code for all 8-bit output on P1, similar to the Miniature Real-time Controller, an open collector driver can be used with minimal changes to the source code. The timer interrupt service routine is defined as follows:
```c
void timer_isr(void) interrupt 1 using 1 {
TH0 = 0x8b;
TL0 = 0x7f; // reload with 35711 for 10Hz tick
tick_test = 1; // test tick for 10Hz/2 or 5Hz
time();
set_time();
blink_led();
update_output();
}
main() {
TMOD = 0x01; // timer1 and timer0 = mode 1
EA = ET0 = TR0 = 1; // enable timer0 interrupt, start timer
PCON |= 1; // enable IDLE mode to extend backup period
for(;;);
}
```
Figure 4 illustrates that pressing SW2 sets the start time at 18:00, causing the lamp to turn on until 22:00 daily. The preset time of 18:00 can be adjusted by pressing SW2 at the desired time; for instance, if the time is set to 19:00 in summer when the sun sets later, the lamp will turn on at 19:00 the following day, with the time off shifting to 23:00.
The schematic demonstrates a robust design for a night light saver, integrating power management, timing functions, and user interaction through simple switch controls. The use of a microcontroller allows for flexible programming and adaptability to user preferences, making it a versatile solution for automated lighting control.The 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. 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. I provide sample scheduler scanning function, scan_pgm( ). If you want to modify the code for all 8-bit output on P1 similar to the Miniature Real-time Controller.
You may have open collector driver, the same hardware and modify a little bit of the source code. void timer_isr(void) interrupt 1 using 1 { TH0 = 0x8b; TL0 = 0x7f; // reload with 35711 for 10Hz tick+; tick_test = 1; // test tick for 10Hz/2 or 5Hz time(); set_time(); blink_led(); update_output(); } main() { TMOD = 0x01; // timer1 and timer0 = mode 1 EA = ET0 = TR0 = 1; // enable timer0 interrupt, start timer PCON |= 1; // enable IDLE mode, to extend backup period for(;) ; } Figure 4 shows start time at 18:00 when SW2 was pressed. The lamp will turn on until 22:00 everyday. Since the preset time, 18:00 can set whenever SW2 was pressed, so if you want to change time on, for examples in summer season, sun will set lately, suppose you want the lamp to be turned on at 19:00, you just press SW2 at 19:00.
The day after it will turn on at 19:00, however time off will shift to 23:00. 🔗 External reference
The following governor is designed to regulate the light intensity of a 220 V incandescent lamp. The circuit consists of relatively few components, allowing for easy assembly on a small circuit board. It is recommended to enclose the completed...
Two light barriers positioned closely together can determine the direction of passage. For instance, placing them at the entrance of a toilet allows for automatic control of lights: turning on when entering and off when exiting. The circuit shares...
This circuit is designed as a low-power LED night lamp that automatically switches off during daytime. The CMOS timer IC TS555CN is configured as a square wave generator operating at approximately 5 Hz. The output voltage from the IC...
This document provides an explanation of a simple 100-watt inverter circuit using the IC CD4047 and the IRF540 MOSFET. The circuit is designed to be simple, cost-effective, and suitable for assembly on a veroboard. The CD4047 is a low-power...
The White's Classic I was a straightforward and user-friendly metal detector, making it suitable for entry-level enthusiasts. It featured a simple design with only an on/off switch and a discriminator adjustment knob. Although it lacked depth, it was capable...
The State Jal Boards supply water for a limited duration each day. The timing of the water supply is determined by management, leaving the public unaware of the schedule. In this context, a water alarm circuit can alleviate long...
We use cookies to enhance your experience, analyze traffic, and serve personalized ads.
By clicking "Accept", you agree to our use of cookies.
Learn more