Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe

Automatic Night Light Control

By Mainak Maji, Kolaghat, India June 24, 2011

[[wysiwyg_imageupload:1508:]]

Mr. Mainak Maji is student of Electrical Engineering from College of Engineering and Management, Kolaghat, India

 


 

Automatic night light control system needs no manual operation for switching ON and OFF when there is need of light. It detects itself whether there is need for light or not. When darkness rises to a certain value then automatically light is switched ON and when there is other source of light i.e. day time, the light gets OFF.
In the project we use light detecting resistor as a light sensor & a NAND gate for detection of high level or low level of voltage to energize the RELAY coil which is used to interface the control circuit with the external light source.
Wastage of power is not desirable in any system. So it is very much economic to have this arrangement so that power is not wasted during day time where manual operation is not possible. Though we can use it in our daily life also for the betterment of our system.
While dealing with this project we faced a problem that the light remained on or off depending upon the presence of any other light source. If we want to make the light off in night hours when there is no need of light, or after switching off the light if we want to make the light on again it was not possible with the circuit investigated earlier. As we don’t want any manual operation we have an arrangement of doing this by means of sound (like clapping sound).This mechanism makes the circuit is more flexible.
By means of this circuit we can control any other electrical appliances as we use the double pole double throw relay switch.
Again for economic operation it is very much helpful and it is very much easy and cheap to make the circuit for house hold purposes.
The operation and operating characteristics of the components which are used in the circuits are briefly outlined below-
LDR
LDRs or Light Dependent Resistors are very useful especially in light/dark sensor circuits. Normally the resistance of an LDR is very high, sometimes as high as 1000 000 ohms, but when they are illuminated with light resistance drops drastically.
The figure above  shows that when the torch is turned on, the resistance of the LDR falls,allowing current to pass through it.
When a light level of 1000 lux (bright light) is directed towards it, the resistance is 400 (ohms).
When a light level of 10 lux (very low light level) is directed towards it, the resistance has
 risen dramatically to 10.43M (10430000 ohms).

 

Power Supply

For 12v power supply we have used 12 v step down transformer, bridge rectifier, 12   regulator.
Transistor
Transistors are commonly used as electronic switches, for both high power applications including switched-mode power supplies and low power applications such as logic gateS
In a grounded-emitter transistor circuit, such as the light-switch circuit shown, as the base voltage raises the base and collector current rise exponentially, and the collector voltage drops because of the collector load resistor. The relevant equations:
VRC = ICE × RC, the voltage across the load (the lamp with resistance RC)
VRC + VCE = VCC, the supply voltage shown as 6V
If VCE could fall to 0 (perfect closed switch) then Ic could go no higher than VCC / RC, even with higher base voltage and current. The transistor is then said to be saturated. Hence, values of input voltage can be chosen such that the output is either completely off, or completely on. The transistor is acting as a switch, and this type of operation is common in digital circuits where only “on” and “off” values are relevant.
Transistor Amplifier
• How do we use the transistor as an amplifier?
• First, we must connect it appropriately to the supply voltages,input signal, and load, so it can be used
• A useful mode of operation is the common-emitter configuration. 
To make a practical circuit, we have to add bias and load resistors to ensure the transistor is at the desired operating point.
The resistors connected to the base ensure that the BE junction is forward biased. They effectively form a potential divider to reduce the voltage supplied to the base.
The emitter resistor work with the base resistors to stabilise the operating point with respect to  variations in B due to component variation and temperature by providing negative feedback.
Finally, the collector resistor provides the load.
Assume Ib is small so can be neglected.
•Current through base resistors is 20/(110+10)=1/6 mA
•Voltage at base =1/6 * 10 =1.7V
•Therefore EB junction is forward biased
•Voltage at emitter = 1.7-0.7=1.0V
•Current Ie = -1.0mA
•Current Ic = -aIe = -Ie =1.0mA
•Voltage at collector =  20 -1*10=10V
•We usually set the collector voltage to be halfway between Vcc and 0V.
A signal, such as music from a CD player, is applied to the input.
• Let’s examine what happens when such a signal increases the base voltage by Vin.
• The emitter voltage is always 0.7V below Vb, so if Vb changes by Vin , so does Ve.
• Thus the emitter current increases by Vin /Re.
• But Ic=-aIe=-Ie, so it also increases by Vin /Re.
• Thus the voltage at the collector will increase by -Vin RL/Re (that is, it will decrease)
• In this case RL/Re is 10, so the circuit amplifies the input voltage signal by a factor of -10.
• In general, the gain is -RL/Re. The negative sign indicates that a increase in input voltage leads to a decrease in output voltage.

 

555 Monostable Multivibrator
A monostable circuit produces a single output pulse when triggered. It is called a monostable because it is stable in just one state: ‘output low’. The ‘output high’ state is temporary.
The duration of the pulse is called the time period (T) and this is determined by resistor R1 and capacitor C1:
 

 

Time period, T = 1.1 × R1 × C1

 

T   = time period in seconds (s)
R1 = resistance in ohms
C1 = capacitance in farads (F)
The maximum reliable time period is about 10 minutes.
 
Why 1.1 The capacitor charges to 2/3 = 67% so it is a bit longer than the time constante (R1 × C1) which is the time taken to charge to 63%.
Choose C1 first (there are relatively few values available).
  • Choose R1 to give the time period you need. R1 should be in the range 1k to 1M , so use a fixed resistor of at least 1k in series if R1 is variable.
  • Beware that electrolytic capacitor values are not accurate, errors of at least 20% are common.
  • Beware that electrolytic capacitors leak charge which substantially increases the time period if you are using a high value resistor – use the formula as only a very rough guide!
Monostable Operation

The timing period is triggered (started) when the trigger input (555 pin 2) is less than 1/3 Vs, this makes the output high (+Vs) and the capacitor C1 starts to charge through resistor R1. Once the time period has started further trigger pulses are ignored.

The threshold input (555 pin 6) monitors the voltage across C1 and when this reaches 2/3 Vs the time period is over and the output becomes low. At the same time discharge (555 pin 7) is connected to 0V, discharging the capacitor ready for the next trigger.
The reset input (555 pin 4) overrides all other inputs and the timing may be cancelled at any time by connecting reset to 0V, this instantly makes the output low and discharges the capacitor. If the reset function is not required the reset pin should be connected to +Vs.
Power-on Reset or Trigger
It may be useful to ensure that a monostable circuit is reset or triggered automatically when the power supply is connected or switched on. This is achieved by using a capacitor instead of (or in addition to) a push switch as shown in the diagram.
The capacitor takes a short time to charge, briefly holding the input close to 0V when the circuit is switched on. A switch may be connected in parallel with the capacitor if manual operation is also required.

Edge-triggering

If the trigger input is still less than 1/3 Vs at the end of the time period the output will remain high until the trigger is greater than 1/3 Vs. This situation can occur if the input signal is from an on-off switch or sensor.
The monostable can be made edge triggered, responding only to changes of an input signal, by connecting the trigger signal through a capacitor to the trigger input. The capacitor passes sudden changes (AC) but blocks a constant (DC) signal. For further information please see the page on capacitance. The circuit is ‘negative edge triggered’ because it responds to a sudden fall in the input signal.
The resistor between the trigger (555 pin 2) and +Vs ensures that the trigger is normally high (+Vs).
Flip Flop
Another variation on a theme of bistable multivibrators is the J-K flip-flop. Essentially, this is a modified version of an S-R flip-flop with no “invalid” or “illegal” output state. Look closely at the following diagram to see how this is accomplished: 
What used to be the S and R inputs are now called the J and K inputs, respectively. The old two-input AND gates have been replaced with 3-input AND gates, and the third input of each gate receives feedback from the Q and not-Q outputs. What this does for us is permit the J input to have effect only when the circuit is reset, and permit the K input to have effect only when the circuit is set. In other words, the two inputs are interlocked, to use a relay logic term, so that they cannot both be activated simultaneously. If the circuit is “set,” the J input is inhibited by the 0 status of not-Q through the lower AND gate; if the circuit is “reset,” the K input is inhibited by the 0 status of Q through the upper AND gate.
When both J and K inputs are 1, however, something unique happens. Because of the selective inhibiting action of those 3-input AND gates, a “set” state inhibits input J so that the flip-flop acts as if J=0 while K=1 when in fact both are 1. On the next clock pulse, the outputs will switch (“toggle”) from set (Q=1 and not-Q=0) to reset (Q=0 and not-Q=1). Conversely, a “reset” state inhibits input K so that the flip-flop acts as if J=1 and K=0 when in fact both are 1. The next clock pulse toggles the circuit again from reset to set.
The end result is that the S-R flip-flop’s “invalid” state is eliminated (along with the race condition it engendered) and we get a useful feature as a bonus: the ability to toggle between the two (bistable) output states with every transition of the clock input signal.
There is no such thing as a J-K latch, only J-K flip-flops. Without the edge-triggering of the clock input, the circuit would continuously toggle between its two output states when both J and K were held high (1), making it an astable device instead of a bistable device in that circumstance. If we want to preserve bistable operation for all combinations of input states, we must use edge-triggering so that it toggles only when we tell it to, one step (clock pulse) at a time.
The block symbol for a J-K flip-flop is a whole lot less frightening than its internal circuitry, and just like the S-R and D flip-flops, J-K flip-flops come in two clock varieties (negative and positive edge-triggered):
Nand Gate
NAND means NOT AND,i.e. the AND output is NOTed.So,a NAND gate is a combination of an AND gate and a NOT gate. In fact NAND is a contraction of the word NOT-AND.
The output is logic 0 level, only when each of the input assumes a logic 1 level. For any other combination of inputs, the output is a logic 1 level.
 Truth Table
    INPUT
 
OUTPUT
                   A
B
X
                   0
0
1
                   0
1
1
                   1
0
1
                   1
1
0
 
 A TWO INPUT NAND GATE

Relay 

A relay is an electrically operated switch that isolates one electrical circuit from another. In its simplest form, a relay consists of a coil used as an electromagnet to open and close switches contacts. Since the two circuits are isolated, a lower voltage circuit can be used to trip a relay, which will control a separate circuit that requires a higher voltage or amperage. A 12-volt relay requires 12 volts direct current (DC) to energize the coil
Switch contacts on a relay can be in one of two states, normally open (NO) or normally closed (NC). When the coil is at rest and not energized (no current flowing through it), the switch contacts are given the designation NO or NC. In an open circuit, no current flows, such as a wall light switch in your home in the down position when the light is off. In a closed circuit, metal switch contacts touch each other to complete a circuit, and current flows, similar to flipping up a wall light switch to the “On” position. 

 

How the Circuit Functions?
Using LDR  

A single NAND gate, a PNP transistor and few other passive components are the only things needed to construct this useful gadget. The circuit description can be understood from the following explanation:

As shown in the diagram a single NAND gate N1 from the IC 4093 is configured as an inverter and a voltage monitor.
  • A reference voltage can be set at its input with the help of VR1. This adjustment will set the level of darkness at which the system will change state.
  •  A LDR (Light Dependant Resistor) which is also connected at the input of N1 is used to sense a difference in light levels. A LDR is in fact a resistor which changes its value with a change in the intensity of light falling on it.
  • In the absence of light or when its dark, the LDR offers an infinite resistance and thus the input of N1 is kept at logic high due to the voltage received through VR1. This means that at this instant the output of N1 is logic low, the relay is activated through T1 and the lights (load) connected to the relay contacts are switched ON.
  • With an increase in the ambient light the resistance of the LDR will gradually fall and after a certain level the input of N1 will become logic low. Immediately its output will go high switching OFF the transistor, the relay and the lights.
  • Capacitor C1 has been kept to avoid the relay from chattering during twilight threshold levels.

LDR & Sound Control

In order to make the light off during night we can use the following scheme. For that we have to use another relay coil. The normally closed contacts are used here just after the 10k resistance which fed the signal to the BJT, as a switch. Now as the switch is closed the circuit will function normally. But if we energize the coil of the second relay it will disconnect the circuit and the light will off. Again if we de-energize the coil it will make the circuit close and light will glow. We can simultaneously do the operation thereafter. A clapping sound is used for the operation of the relay coil.

 

Theory of Operation
Figure 1 shows the block diagram of the Sound Activated Switch. It consists of a transistor amplifier, a transistor switch and two types of digital circuits, a one-shot and a flip-flop.

The Transistor Amplifier

A waveform is created when hands are clapped together. The MIC senses this waveform and couples it to the base of T2 by capacitor C2 (refer to schematic diagram). The transistor is configured as a common emitter amplifier since the AC signal is bypassed to ground by resistance. The transistor amplifier is set for a gain of 50, so the waveform is amplified 50 times. Capacitor C3 couples the amplified waveform to the input of the first digital circuit.
The One-Shot / Monostable Multivibrator
A one-shot, or monostable multivibrator, is a circuit that, once triggered, will switch its output logic level. The output will remain at this new logic level for a predetermined period of time, after which the output will switch back to its previous logic state. This output pulse is then coupled to the input of the flip-flop.
Here the 555 timer serves as monostable multivibrator.
The Flip-Flop / Bistable Multivibrator

A flip-flop, or a bistable multivibrator, is a circuit whose output logic level changes when a pulse is applied to the input. The output will remain at its logic state until the next pulse is applied. The only two possible output states for a flip-flop are logic 1 and logic 0.

Here we use IC 4027 (J K flip-flop) to make bistable multivibrator.
The Relay Switch
As explained earlier the relay will operate as a switch. The relay will be connected in normally ON position. As per the clapping sound the amplifier will amplify it and monostable multivibrator gives a shot to the flip-flop to energize the relay coil. As a result the connection will go on to normally OFF position. So the light will be in OFF condition until another clapping sound will make the flip-flop into off state. As a result the light will glow again.

Pin Diagram of IC’s Used

Implementation
[[wysiwyg_imageupload:13664:]]
The entire circuit of this 12 volt day night switch can be built over a small piece of general PCB and the whole assembly along with the transformer may be housed inside a good looking ABS plastic enclosure. Only the LDR has to be fixed over the box so that it can sense the ambient daylight.
Take due care to position the LDR in such way that no other stray light or the light which it’s controlling is able to be incident on it, or else it may produce false switching and may start oscillating. The best position would be to install the unit at a point much higher than the lights which are controlled by it.
This automatic night light system may also be appropriately used to control building porch lights, neon signs, large advertising displays, gallery lights and also as automatic house interior decorative lights. Thus this simple inexpensive circuit should not only be able to relieve you from the headache of timely switching the particular lights but also will result in quite an economical way of using them.

 

A Suggested Modification
After making it off in the night by means of clapping noise, the light remains in off state though another night comes in the very next day. To
make the light on we have to make another clapping noise. This is a difficulty of our circuit. Normally our circuit performs at the start when it is
set to low level. So to make the perform correctly we have to set it to a low level at each time of start of the operation. In this way the problem
may be eradicated.
Discussion
We faced problem while energizing the relay coil. A voltage nearly equal to 12 V was required to switch the position from normally ON to normally OFF position of the relay.But using one LDR it is not sufficient to vary the voltage between 7 V and 12 V.So, we use two LDR in order to have sufficient voltage drop. In the circuit we use 12V for the operation of BJT.In order to match this voltage level a NAND gate , whose operating voltage is 12V, was chosen.
Conclusion
We all know the importance of saving electric power. But ironically at times we find the street lights ON even during day time. This clearly shows how irresponsible one can be. So instead of depending on individuals, why not take the help of electronics and find a solution to get the work done automatically? A simple circuit of an automatic night light described in this article can very accurately switch ON a load (street lights for example) when darkness falls and switch it OFF when dawn breaks.

 

 

Circuit Diagrams

Automatic-Night-Light-Control1


Filed Under: Electronic Projects
Tagged With: ldr, light, nand gate, night light control
 

Next Article

← Previous Article
Next Article →

Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

EE TECH TOOLBOX

“ee
Tech Toolbox: Internet of Things
Explore practical strategies for minimizing attack surfaces, managing memory efficiently, and securing firmware. Download now to ensure your IoT implementations remain secure, efficient, and future-ready.

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


RSS EDABOARD.com Discussions

  • High Side current sensing
  • Multiple DC/DC converters and a single input source
  • MOSFET thermal noise in Weak vs Strong inversion
  • Xiaomi Mijia 1C Robot problem of going backwards while working
  • Will this TL084C based current clamp circuit work?

RSS Electro-Tech-Online.com Discussions

  • Curved lines in PCB design
  • using a RTC in SF basic
  • Parts required for a personal project
  • Wideband matching an electrically short bowtie antenna; 50 ohm, 434 MHz
  • PIC KIT 3 not able to program dsPIC

Featured – RPi Python Programming (27 Part)

  • RPi Python Programming 21: The SIM900A AT commands
  • RPi Python Programming 22: Calls & SMS using a SIM900A GSM-GPRS modem
  • RPi Python Programming 23: Interfacing a NEO-6MV2 GPS module with Raspberry Pi
  • RPi Python Programming 24: I2C explained
  • RPi Python Programming 25 – Synchronous serial communication in Raspberry Pi using I2C protocol
  • RPi Python Programming 26 – Interfacing ADXL345 accelerometer sensor with Raspberry Pi

Recent Articles

  • AC-DC power supply extends voltage range to 800 V DC
  • Infineon’s inductive sensor integrates coil system driver, signal conditioning circuits and DSP
  • Arm Cortex-M23 MCU delivers 87.5 µA/MHz active mode
  • STMicroelectronics releases automotive amplifiers with in-play open-load detection
  • Convection-cooled power controller integrates EtherCat connectivity

EE ENGINEERING TRAINING DAYS

engineering

Submit a Guest Post

submit a guest post
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy

Search Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe