All-analog automatic night light circuit

10,408

Circuit Image

Approximately ten days ago, an all-linear automatic night light circuit was installed to control the lights in the living room. The circuit comprises three operational amplifiers (op-amps): two configured as voltage followers and one as a comparator. As depicted in the schematic, all user-adjustable controls are located at the comparator, including one potentiometer to set the trip point and another to adjust the width of the hysteresis band. The sensor circuit is positioned several meters away to ensure an unobstructed view of the outdoors, avoiding interference from indoor lights at night. A high-impedance sensor and low-pass filter require a unity gain buffer (voltage follower) situated close to the sensor, as placing it on the main control circuit board at a distance can degrade the signal quality. The low-pass filter includes a diode, which serves a crucial function. Driving large capacitive loads can introduce stability issues for voltage feedback op-amps, as increased load capacitance decreases the feedback loop's phase margin and reduces closed-loop bandwidth, resulting in gain peaking and overshoot in the frequency response. A unity-gain buffer is particularly sensitive to capacitive loads, thus a small series resistor at the output is recommended to enhance stability by converting the output load to resistive at higher frequencies. Since the circuit operates essentially with a DC signal, a resistor (R3) was added to account for potential capacitance in the cable. The hysteresis circuit (R5, R6, R7) requires a low impedance source, necessitating the use of A2 as a voltage follower to prevent interference with the hysteresis resistor values. A push-pull configuration using complementary transistors drives the relay and LEDs, with a 12-volt relay acting as the output amplifier and high-voltage isolator for switching the 220VAC load. The relay is positioned approximately ten meters from the control circuit, and its normally open contacts are connected in parallel with the wall switch of the light, requiring the switch to be off for the circuit to control the load automatically. Green and red indicator LEDs provide feedback during the adjustment of the potentiometers. A limitation of this circuit, as with all automatic night light circuits, is that the ambient light level at which the load is turned off must exceed the light level at which it is turned on. This means that hysteresis forces the circuit to turn off the load at a brighter condition than the condition for turning it on. In many instances, it is desired to have the lights turn off at dawn, which is a darker condition than when they were turned on. Although a microcontroller (MCU) seems to be a straightforward solution for this issue, the firmware development poses its own challenges. A temporary circuit has been installed to replace the all-analog configuration, with performance evaluations planned for the coming week. The MCU-based design allows for the simplification of the sensor subcircuit, eliminating the need for a low-pass filter, as filtering can now be performed digitally through algorithms, and the potentiometers have been removed.

The automatic night light circuit features a well-structured design that utilizes operational amplifiers to achieve its functionality. The circuit's primary components include three op-amps: two configured as voltage followers to ensure high input impedance and low output impedance, facilitating effective signal transfer without degradation. The comparator op-amp is crucial for determining the light level threshold at which the circuit activates or deactivates the connected lighting system.

The sensor is strategically placed to avoid interference from artificial lighting, ensuring that it accurately detects ambient light conditions. The inclusion of a unity gain buffer is critical in maintaining signal integrity, especially over longer distances, where capacitance can significantly affect performance. The low-pass filter, enhanced by the diode, plays a vital role in smoothing out transient signals and ensuring stable operation.

In terms of load management, the circuit employs a push-pull configuration with complementary transistors to drive the relay, which is responsible for switching the AC load. This design choice allows for efficient control of higher voltage loads while maintaining electrical isolation from the control circuitry. The feedback mechanism provided by the indicator LEDs informs users of the current operational state and adjustments made to the potentiometers.

The circuit's inherent limitation regarding hysteresis is acknowledged, as it necessitates that the light level for turning off the load is greater than that for turning it on. This behavior may not align with user preferences in all scenarios, particularly in applications where lights are desired to turn off at lower ambient light levels. The transition to a microcontroller-based solution is presented as a viable alternative to overcome these limitations, allowing for greater flexibility and customization through digital signal processing.

In summary, the automatic night light circuit represents a sophisticated integration of analog components designed to provide reliable lighting control based on ambient light conditions. The transition to a microcontroller-based approach offers opportunities for enhanced functionality and adaptability, paving the way for future advancements in automatic lighting solutions.Some ten days ago I installed an all-linear automatic night light circuit to control the lights inside the living room. Circuit consists of three op amps-two used as voltage followers and a third as a comparator. As the schematic shows, all user adjustable controls are at the comparator-with one potentiometer to set the trip point and the other

pot to adjust the width of hysteresis band. The sensor circuit is located several meters away at a location where it can have a view of the outdoors without being blinded or fooled by indoor lights at night. The high impedance sensor and low pass filter must have a unity gain buffer (voltage follower) within millimeters/centimeters.

You can`t have it on the main control circuit board meters away. Trust me. I`ve tested this several years ago with and without a buffer and a (unshielded twisted pair) cable. The signal will be degraded and probably unusable without the follower. Notice the low pass filter includes a diode. It performs a very important and essential function. See my other automatic night light circuits for the explanation. Driving large capacitive loads can cause stability problems for voltage feedback op amps. As the load capacitance increases, the feedback loop`s phase margin decreases and the closed-loop bandwidth is reduced. This produces gain peaking in the frequency response, with overshoot and ringing in the step response.

A unity-gain buffer (G = +1) is the most sensitive to capacitive loads, though all gains show the same general behavior. When driving large capacitive loads with these op amps (e. g. , > 100 pF when G = +1), a small series resistor at the output improves the feedback loop`s phase margin (stability) by making the output load resistive at higher frequencies.

(DS21810F, 2008, p. 14) Well, we`re working with essentially a DC signal and I have no idea of how much capacitance there is in the cable, but I just added R3 to be sure. The hysteresis circuit (R5, R6, R7) needs a low impedance source, thus A2 is used as a voltage follower-else R3 will foul up the resistor values for the hysteresis.

For a discussion of hysteresis in single-supply op amps read this. Equations are provided. A push-pull configuration using complementary transistors drives the relay and LEDs. A 12-volt relay is the output amplifier (and high-voltage isolator) which switches the 220VAC load. The relay is some 10 ten meters from the control circuit. Its normally open contacts are connected in parallel with the light`s wall switch-so this switch has to be off for the circuit to turn the load on/off automatically. Green and red indicator LEDs provide feedback when adjusting the pots. The shortcoming of this circuit-and for that matter all ANL circuits-is that the ambient light level at which the load is turned off must be higher than the light level at which it`s switched on.

In other words, incorporating a hysteresis-however small-forces the circuit to turn the load off at a brighter condition than for load switch-on. But in some cases (probably a majority) we want the lights off at the crack of dawn-i. e. , at a darker condition than when it was turned on. Someone may have already done so, but I haven`t yet come up with a way of doing this using linear components/ICs.

I don`t even know where to begin! Using a microcontroller on the other hand seems obvious and the simplest way to implement it. And that`s what I`ve been doing these past two days. Because it`s MCU-based the circuit itself is a no-brainer. The firmware`s where the brain-racking is. I`ve already installed a temporary circuit in place of the above all-analog one and will be checking its performance till week`s end. Given that I`m using an MCU-and all the computing power it`s got-I pared down the sensor subcircuit and eliminated the low pass filter.

Filtering is now performed digitally using algorithms. Pots are gone as well. Trip point is set using a momentary 🔗 External reference