LED Nightlight That Turns on in the Dark

103,277

111

60

Published

Introduction: LED Nightlight That Turns on in the Dark

My first instructable! This is something I originally made for a friend who's still using it. It works very nicely at adding a nice ambient light to a dark room. I made this instructable because I decided to make one to stick in the bathroom at my house.

It's a small easy to build circuit that will, as the title says, turn an LED on when it's dark and turn it off when there's light, making it a perfect night light. It runs on a 12v wall adapter, so you won't need to worry about replacing a battery.

Step 1: What You Need

So here's what you need for this project:

[Soldering iron, of course... and solder]

- 100k Resistor
- 1K Resistor
- NPN Switching transistor (2N4401)
- Photo Cell
- 3v LED
- 12v wall adapter (look around... I'm sure you've got one somewhere!)

Optional:

- Small circuit board (makes it easier!)
- SPDT Switch (for complete disconnection)

Step 2: The Schematics

As said previously, the circuit is very simple.

The transistor switches what happens with the LED. Without it the LED would turn on when the lights are on and that'd be useless. The 100k resistor limits how much light is needed to turn it off, and the 1K resistor limits the amount of voltage going to the LED.

You can experiment with different resistor values. In this project I used two 100K resistors because I wanted the night light to be more sensitive and stay off in most ambient light. You could very easily replace these with a variable resistor, like a small trim pot, to let you determine the sensitivity whenever you'd like. You could also change the 1K resistor, but a lower value may make the maximum brightness a little too bright for a night light.

I also used 3 white LEDs for this project instead of one (which didn't work out as well as I'd hoped, stick to one).

Step 3: Putting It Together

Following the schematics is pretty straightforward. The pictures below show the process, including the traces on the bottom of the little circuit board I used.

Step 4: Give It Power!

Now you'll want to take your 12v adapter, and measure out the length of wire you want. The way I set it up, the little circuit board rests right on top of it when it's plugged in so the LED shines up the wall and gives the room a nice glow. Once you've got it at a good length, strip the wire a bit so you can easily solder it in place.

This is important! You'll want to make note of the polarity of each wire and where they go. The one with the white stripe is the positive and the solid black is the negative. Once you've established polarity, just wire it up according to the schematics.

[If you choose to add an on off switch, simply wire the switch between either the positive or negative wire and the board)]

Step 5: Plug It Up - You're Done!

Plug it in and cover up the photo cell, unless you're in a dark room. The LEDs should come on! Whoooooo. Now you can just find a way of getting the board on top of the adapter. I drilled two holes in the top of the adapter and screwed it in place, but I can't say I recommend this :P Hot glue works just fine.

4 People Made This Project!

Recommendations

  • Oil Contest

    Oil Contest
  • Creative Misuse Contest

    Creative Misuse Contest
  • Clocks Contest

    Clocks Contest

60 Discussions

Hello. We've made this nightlight for a project. We followed the schematics but the light doesn't turn on in the dark and even if there's light. Is there maybe something we did wrong? The only different thing we used in the project is that we made use of a 12v LED although I don't think it will make much difference? Thanks very much.

Is there any way i could add a potentiometer to it so make it dimmable?

nice

hey how many volts does this pull trying to work out a way to change to run of a solar recharged battiry ?

2 replies

is there any alternative for the 2N4401 transistor, i can't find it in stores...

thanks in advance

Rachit

5 replies

The 2N4401 suggested is rated at 600mA Ic current. The LED in the picture consumes about 20mA at 3V. Even you use a high-power 1W LED, of course too bright for a night light, the LED will only consume about 280mA current. In case the LEDs connected are those small one rated at 20mA, you can use any small NPN transistor.

However, resistors value needed to adjust. For the transistor to turn on, the LDR (Photo Cell) has to establish a potential difference of 0.7V. With 12V power supply and 100kΩ resistor, the LDR will create 0.7V at roughly 6kΩ resistance. The transistor will only switch off in very bright environment. On the other hand, when 6V is used, the transistor will turn off when the resistance of the LDR drops to 12kΩ. Whether your circuit will work as expected depends on the specification of the LDR used.

This is what you need to do. Wait until the light intensity of your room drops to the level that you want the LED to turn on, measure the resistance of the LDR. Use this formula to calculate the value of the 100k resistor needed for your circuit.

Resistance of resistor = (Supplied Power x LDR Resistance) / 0.7

Assume LDR = 80kΩ, Power = 12V; Resistor = 80 x 12 /0.7 = 1371kΩ. Then you need to use a 1.3MΩ resistor in place of the 100kΩ shown in the circuit.

However, it creates another problem, with a 1.3MΩ resistor connected, the maximum base current will reduce to about 10uA, and a darlington transistor or two regular transistors are required to amplify the current to 20mA.

All in all, it's not an easy job. In case you really want to build this circuit, give me the measured resistance of the LDR decribed above and the supplied voltage you intend to use, I will then give you the circuit with all the correct component values. If you have some small transistor (NPN or PNP) already in hand, give me the numbers.

Hello, im using a home made arduino to power an led matrix of about 120 leds. Anyways i would like to have the arduino shut off in light, on in night. I would like to set this up inbetween the 5 volt regulator and the atmega chip. Any idea what reaistance i should use so my atmega still works fine at night? ( its a 24x6 matrix for my 5 year old ). Thanks!

Brightresistance(10lux)(k):30-90
Dark resistance(m):5
GL5516 LDR

Use a 2n2222. Almost any PNP will work.

Play around with the resistors. You can probably replace the 1k with a 500ohm. Don't know for sure though

Only reason I replied is because I stumbled across this tutorial while searching for a nightlight tutorial for a friend.

Cheers.

I made this for my 6v 500ma solar panel. It charges a small battery(4.2v about 1ah, so small) and I connected the circuit to my battery, but the led was not powerful enough. and the power draw when the light is in off state is too high. my battery didnt charge like it was used to without the circuit.

inst aide of LED'S we can connect '0'watt bulb

and inst dide of 12volts we can connect to AC 230volts

plese help me in this

1 reply

This is a DC circuit and relies upon Direct Current. Ac current flows in the form of a sine wave and as such would not work using this particular design. Also, the resistors are all 1/4 watt, you would need much larger watt resistors to power an ac bulb, and a much higher current photo resistor.