Automatic Night Light

About: Electronics have always been fascinating to me. Things that get my attention are clocks, lamps, motion activated devices, light activated devices, laser intruder alert systems,solar and wind power, voltage i...

My night light does not begin glowing until the ambient light in the room is very dim. Others I've seen on here begin glowing when the light in the room is still fairly bright. If your night light comes on when the light in the room is still bright you're going to be wasting a lot of the electricity in your battery. Another feature is the use of the 9 volt battery using the built-in 5 volt regulated power supply. My thinking here is by powering the night light with a 9 volt battery it should operate for quite a while before the battery will need to be replaced.

Step 1: What You Will Need


  • SPST on/off switch
  • LM7805 Voltage Regulator
  • 0.33uF ceramic capacitor
  • 0.1uF ceramic capacitor
  • 820R ohm resistor
  • 100k resistor
  • LED - Bright red is easier on sleepy eyes but white will probably be brighter

  • LDR: also known as a Photocell - Photo Resistor - Light Dependent Resistor
    Bright Resistance (10Lux) (KΩ): 10-20Dark Resistance (MΩ): 1

  • 9 volt battery snap

  • 9 volt battery

  • Breadboard for testing

Step 2: The Circuit Schematic

This is the complete circuit. I used CadSoft's Eagle schematic design software and the LDR symbol is a little different from the LDR symbols I've seen on other schematics. If you are interested in using the Eagle software I recommend reading the Instructable by westfw on where to obtain and using the software. And he also provides a couple of useful links.

Step 3: The Voltage Regulator

I built the voltage regulator first and then tested it to make sure it was actually putting out 5 volts. As the 9 volt drains it will maintain the correct voltage this night light needs to operate correctly. I really think it should be able to go for quite some time before the battery will need to be replaced.

Step 4: The Completed Circuit

Here's a close-up of the completed circuit. You can see it's really very simple. In the picture where the LED is lit I have placed a Sharpy pen cap over the LDR to put it in complete darkness. I plan to make some birthday and Christmas gifts using this circuit. Maybe find a Statue of Liberty model where the LED can be placed in the torch Lady Liberty is hoisting up in the air. Another couple of ideas I've had are to place the night light in a tiny house so the glow comes through the windows, or a little campsite with the LED in the campfire. You should be able to come up with some great ideas too!



  • Trash to Treasure

    Trash to Treasure
  • Tape Contest

    Tape Contest
  • Arduino Contest 2019

    Arduino Contest 2019

19 Discussions

And of course a 2N2222 NPN transistor will
work in this circuit just as well as the 2N3904. The main difference
between the two transistors is the amount of amperage they can handle.
If you'd like to see a page comparing the two in depth visit:

2N3904 vs 2N2222


3 years ago

what is the work of SPST when it is automatic ?


4 years ago on Introduction

Nice project, good explanation!

Some fundamental concepts to clear possible misunderstandings you may have.

In term of power consumption, the higher the supplied voltage, the higher is the power consumed by the circuit. Hence, if you want to save battery power, the supplied voltage should be as close as possible to the working voltage of the LED plus voltage drop by the transistor.

Power consumed by the circuit depends on supplied voltage. Assume the LED consumes 20mA at 2.2V, with a 9V battery, the circuit consumes (9 x 0.02)W = 0.18W. The 7805, the LED limiting resistor and the transistor (Vce) will together consume (9 - 2.2) x 0.02W = 0.136W; the LED only consumes 0.044W.

If you use 3V, the LED still consumes 0.044W, but the whole circuit consumption will reduce to 3 x 0.02W = 0.06W. And you need to adjust the value of R1 and R2.

5 replies

Thank you so much JohnL8 for taking the time to help me out with the information. I have learned some things since I wrote this Instructable but I really have so much yet to learn, and of course the more I know, the more I realize how much more there is yet to learn! One area that is really hard me to calculate/learn/understand is figuring the correct voltage to apply to the base of transistors. I think my biggest problem there is figuring the correct values to use in the equation.

I have the same feeling that a little more I know (learn) the more I am confused. And then I realize only because I am looking at one small corner of an huge iceberg. Learning is a lifelong task.

For your circuit, first thing is to decide what power supply voltage is connected to the transistor. Although the 7805 may not be necessary in your circuit, and If you still want it there for experimentation, then we start with 5V.

For 2N3904 or any small transistors, it has to establish a base-emitter voltage (Vbe) of 0.65-0.80V for collector-emitter (ce) conduction. Current drawn by the LED used is comparatively small and we can assume we need a Vbe of 0.65V. That means we need the LDR to establish 0.65V in a particular ambient room light to turn on the transistor.

LDR has different specifications, so next is to measure its resistance at the light level you want the LED turns on. Assume xΩ. R2 and LDR form a voltage divider connected to 5V, we need to calculate R2 (yΩ) in terms of xΩ. Therfore, we have: 5x / (x + y) = 0.65; and y = 6.69x. So if the measured x is 100kΩ, then R1 will be 669kΩ, and a standard 680kΩ resistor can be used. Simply to say, the LED will then turn on at the exact light level you want, when the resistance of LDR increase to 100kΩ. Now there is a problem.

With 5V and 780kΩ, the current is 6.4uA, we need an amplification of 3125 times to get 20mA to light up the LED fully, and 2N3904 is incapable to do that. And we need either a darlington transistor or two small regular transistors to do the job.

Readers may complain about the LED turns on too early or too late, precisely not at the light level expected, simply because components interact with one another. Lately, I drew a similar circuit. If interested, I can attach as image.


Reply 4 years ago on Introduction

A darlington setup is fine, but you can also use an N-channel MOSFET to do the job. Replace R2 with a variable resistor (maximum value equal to LDR's "dark" resistance) to make the circuit adjustable so you can fine-tune it to your room's ambient light levels.


Here's Youtube video I have watched a countless number of times and it seems i learn something new with each viewing.

Tutorial: How to design a transistor circuit that controls low-power devices

For example I have 4 sets of two LEDs in parallel. Four of the LEDs are blue and use 3.4 volts and 20 mA and the other four are red and take 2.4 volts and the same current. I use an 82 ohm resistor for the blue and 68 ohm for the red. I have several types of transistors I can use in this project, 304 NPN, PN2222A, BC547 and I can also use a various input volatges as well. I want to trigger this with a PIR which has a signal voltage of 3 volts which I think will be much more than I will need to cause the transistor to complete the circuit. I guess I just need to figure my Ic current which is what will run from base to emitter? And to figure that I need to know the wattage of the four combined LEDs? And then also there's the .7 used by the transistor itself. Anyway, good thing I have the rest of my life to learn this!


4 years ago on Introduction

Which component(s) do I need to change in order to change the light sensitivity?

2 replies

It's the R2 100k resistor that controls how much ambient light will set off the night light. If you replace it with a lower value resistor (for example a 47K resistor) the LED will glow even though the room light is still plenty bright enough for you see around the room.


4 years ago

Neat ! Love it! I think it is cool and will try it'


4 years ago

cool ideas for usage of the set up. and seems simple enough for a non- electronic minded person like myself could do. yes i am a knuckle dragger ( industrial mechanic).