Blinking Nightlight (by Request)




Instructables user Pagemaker provided a link to a generic blinking circuit using a 555 timer, and requested info on how to incorporate a photoresistor to enable the circuit to turn off in daylight. In addition, Pagemaker wanted to use more that one LED. His original posting is HERE. This instructable will show you how to do just that.

Step 1: Looking at the Initial 555 Circuit

The first step in creating the blinking nightlight was to analyze the original circuit, which can be found here.

There are a number of websites that will teach you everything you need to know about 555 timers, so I'll leave that to others. Here are a two of my personal favorite sites on 555 timers that will get you started:

Basically, depending on what external components (resistors and capacitors) we use, we can change the rate of blinking.

Step 2: Calculating the Desired Resistor Value for Our LEDs

LEDs are current-driven. They require a current in order to operate. The average red LED has a normal operating current of about 20 mA, so that's a good place to start. Because they are current-driven, the brightness of the LED depends on the amount of current flow, and not the voltage drop across the LED (which is about 1.5-1.7 volts for your average red LED. Others vary).

This sounds great, right? Let's just pump a ton of current through, and we'll have super-bright LEDs!

Well... in reality, an LED is only able to handle a certain amount of current. Add much more than that rated amount, and the magic smoke starts leaking out :(

So what we do is add a current-limiting resistor in series with the LED, which fixes the problem.

For our circuit, we'll have 4 LEDs in parallel. We have two options for our series resistor(s):

Option 1 - Place a resistor in series with each LED

With this option, we treat each LED separately. To determine the series resistor value, we can simply use the formula:

(V_s - V_d) / I = R

V_s = Source voltage (In this case we're using two AA batteries in series, which is 3 volts)
V_d = The voltage drop across our LED (We're figuring about 1.7 volts)
I = The current we want running through our LED in Amps
R = Resistance (the value we want to find)

So, we get:

(3 - 1.7) / 0.02 = 65Ω

65 ohms is not a very standard value, so we'll use the next size up, which is 68 ohms.

PROS: Each resistor has less power to dissipate
CONS: We have to use a resistor for EACH LED

I checked this value in the following way:

I measured each LED for resistance, and determined each was about 85 ohms. Adding that to the resitor value gets us about 150 ohms on each of the 4 parallel nodes. The total parallel resistance is 37.5 ohms (remember that resistance in parallel is lower than resistance of any single node).

Because I = E/R we can determine that 3V / 37.5Ω = 80mA

Divide that value by our 4 nodes, and we see that we're getting about 20 mA through each, which is what we want.

Option 2 - Place a resistor in series with the entire group of 4 parallel LEDs

With this option, we'll treat all of the LEDs together. To determine the series resistor value, we have to do a bit more work.

This time, using the same value of 85Ω per LED, we take the total parallel resistance of our LEDs (without and additional resistors), and we get 22.75Ω.

At this point, we know the current we want (2mA), the source voltage (3V), and the resistance of our LEDs in paralles (22.75Ω). We want to know how much more resistance is needed to get the value of current we need. To do this, we use a bit of algebra:

V_s / (R_l + R_r) = I

V_s = Source voltage (3 Volts)
R_l = LED resistance (22.75Ω)
R_r = Series resitor value, which is unknown
I = Desired current (0.02A or 20mA)

So, plugging in our values, we get:

3 / (22.75 + R_r) = 0.02

Or, using algebra:

(3 / 0.02) - 22.75 = R_r = 127.25Ω

So, we can put a single resistor of about 127Ω in series with our LEDs, and we'll be set.

PROS: We only need one resistor
CONS: That one resisor is dissipating more power than the previous option

For this project, I went with option 2, simply because I wanted to keep things simple, and 4 resistors wehre one will work seems silly.

Step 3: Blinking Several LEDs

At this point, we've got our series resisitance, we can now blink several LEDs at once using our original timer circuit, simply by replacing the single LED and series resistor with our new series resistor and set of 4 parallel LEDs.

Below, you'll see a schematic of what we've got so far. It looks a little different than the circuit on the original link, but it's mostly just appearances. The only real difference between the circuit at and the one in this step are the resistance value for the current-limiting resistor, and the fact that we now have 4 LEDs in parallel, rather than just a single LED.

I didn't have a resistor of 127 ohms, so I used what I had. Normally we'd prefer to approximate upwards, selecting the next largest resistor value in order to ensure we don't let too much current through, but my next closest resistor was MUCH larger, so I chose a resistor slightly below our calculated value :(

We're making progress, but we still only have a bunch of blinking lights. On the next step, we'll make it turn off in daylight!

Step 4: Making It a Nightlight

Enough with simple blinking! We want it to work at night, and stay off during the day!

Alright, let's do it.

We need a few more components for this step:
- A photoresistor (sometimes also called an optoresistor)
- An NPN transistor (most any will do. I can't even read the label on the one I picked, but I was able to determine it's NPN)
- A resistor

A photoresistor is simply a resistor that changes it's value depending on how much light is applied. In a bighter setting, the resistance will be lower, while in the dark, the resistance will be higher. For the photoresistor I have on hand, the daylight resistance is about 500Ω, while the resistance in darkness is nearly 60kΩ, quite a large difference!

A transistor is a current-driven device, whcih meand that in order for it to operate correctly, a certain amount of current must be applied. For this project, nearly any general purpose NPN transistor will do. Some will work better than others, depending on the amount of current required to drive the transistor, but if you find an NPN, you should be good to go.

In transistors, there are three pins: the Base, emitter and collector. With an NPN transistor, the base pin must be made more positice than the emitter in order for the transistor to work.

The general idea here is that we want to use the resistance of the photoresistor to adjust how much current is allowed to flow through the LEDs. Because we don't know the exact current required for our Transistor, and because you may be using a different photoresistor than me, the value of your resistor in this step (R4 in the picture below), may be different than mine. This is where experimentation comes in. 16k was just about perfect for me, but your circuit may require a different value.

If you look at the schematic, you'll see that as the resistance value of the photoresistor changes, so too does the current through the base pin.

In dark conditions, the value of resistance is very high, so most of the current coming from V+ on the 555 Timer (V+ is the positive voltage) goes both directly to the base of the transistor, making it operational, and to the LEDs.

In lighter conditions, the lowered value of resistance in the photoresistor allows much of that current to go from V+ on the timer directly to DIS. Because of this, there's not enough current to drive the transistor and the LEDs, so you don't see any blinking lights.

Next we'll see the circuit in action!

Step 5: Lights (or Not), Camera, Action!

Here's the resulting circuit, hurriedly made on a breadboard. It's sloppy and ugly, but I don't care. The circuit worked exactly as designed. You'll note that the original circuit we worked from lists a 2.2uF tantalum capacitor. I didn't have one on hand, and used an electrolitic capacitor instead, and it worked alright.

You will notice in the video that there is a duty cycle of about 90% (the lights are on 90% of the time, and blink off for 10% of the time). This is due to the external components (resistors and capacitors) attached to the 555 timer. If you're interested in changing the duty cycle, please review th links I provided earlier. If there's interest, I'll write up an instructable on it.

Hope this instructable was helpful. Feel free to make any corrections or ask any questions. I'd be glad to assist where I can.



    • Pets Challenge

      Pets Challenge
    • Fandom Contest

      Fandom Contest
    • Frozen Treats Challenge

      Frozen Treats Challenge

    16 Discussions


    5 years ago on Step 5

    sir can i put 12 DC power source for this circuit?


    9 years ago on Introduction

    can I use it with a 12v power supply and 30 - 40 LEDS?


    10 years ago on Step 3

    You seem to have the LEDs in your schematic wrong. I was wondering how they would light up reverse biased like that; the circuit you linked to has the cathode connected to the discharge pin. How much current can the discharge pin sink? I know that the 555 usually can only handle a small amount of current on its output pin, so an external transistor is needed for driving a lot of LEDs, but how many can it drive in this configuration?

    3 replies

    Reply 9 years ago on Introduction

    Mate Jack, I loved your circuit but , and i just have a small doubt, i think it will be easy far you to answer, im using what you done, but im trying to make it blink once a second (like turn lights on a car), you wrote.. “Basically, depending on what external components (resistors and capacitors) we use, we can change the rate of blinking.“ So could you please help me to decide which (capacitor or resistor) to change to make it blink faster? .. i will really appreciate it. Thanks mate.


    Reply 10 years ago on Introduction

    Thanks for the catch on the LEDs. I've got to go to work today, but when I get back home, I'll fix the schematic. Not sure how I managed to screw up the orientation there :( Regarding the source/sink of the TLC555, the nominal parameters for this chip are 10mA Source and 100mA Sink, but it can operate up to 100mA Source. A better choice for the 555 timer would be the SA555, which can both source and sink up to 200mA, allowing a bit more flexibility in our design. I stuck with the TLC555 in the writeup, because that was the one originally used, and it provide enough current for the 4 LEDs, but not much more than that.


    9 years ago on Introduction

    Thank you Inventor Jack for this. It gives good information and a useful "apatite wetter" for u C's.

    1 reply

    Reply 9 years ago on Introduction

    I forgot to mention I want to make a flasher for my cat "Gerald" so I can see where he is lurking in the shadows at night. We keep him inside at night to help protect the wild life. We live in inner Melbourne city, but you still get those deadly brown snakes in the street lanes. Never far from the wild in Australia!


    10 years ago on Introduction

    what would the resistor values be if I used a 9v battery instead?


    Reply 10 years ago on Introduction

    Don't get me wrong, uC's are awesome. I play with them all the time. But sometimes it can be much more satisfying to work through a problem without resorting to the microcontroller. Also, many people don't have a programmer or the experience to use one. There's also the argument that using a micro to blink a few LEDs is like using a slegehammer to pound a tack. Why throw so much unneeded power at a simple problem? Hope none of this sounds offensive. I just don't understand why many people choose the micro as their first choice in most everything electornics-related. Use the right tool for the right job/situation.


    Reply 10 years ago on Introduction

    its not offensive but i have done alot with other electronic devices and im learning how to use microcontrollers. if you want to get started with microcontrollers read this instructibleit tells you how to build a programmer and use it for pretty much free the only thing thats not free is the microcontroller but you might be able to find a free sample somewhere and it shows you how to make a LED blink


    10 years ago on Introduction

    I really appreciate you doing this. I'm going to order some parts and try to get it going. Couple of questions... what resistor value would you use to make it blink twice per second? and does this circuit draw power when its light? Also, how hard would it be to make the same circuit that would make use of rechargeable batteries and a solar panel to charge in the daytime? Thanks again...


    10 years ago on Step 1

    Thanks for the write up. I have been interested in a doing something like an led throwie, but turns on at night and blinks to conserve power. It would be helpful to see the entire circuit (with photoresistor and npn).

    1 reply

    Reply 10 years ago on Introduction

    I added an image in the last step which labels each component for easier identification. Hope that helps. Also, in step 4, the second image shows the entire schematic.