Introduction: Simple Light Sensor With an LED (Analog)


In this instructable I'll show you how to make a simple light sensor with an LED.

Basically this circuit just turns on the LED, when it's exposed to light. For me this circuit is kind of useless because you can't do much with this, but I think that someone could find this useful.

Step 1: Choosing the Components

Component list:

  • 2 x 560 ohm resistor
  • 10k ohm resistor
  • A small solar cell (I took mine from an old solar powered garden light)
    • The operating voltage on my solar cell (according to its datasheet) is about 4.0 volts, even though I got 6.0 volts when I measured it. That's why I using 5.0 volts as the operating voltage for my calculations. (My solar cell's datasheet: )
  • A red LED
    • You can use different colors if you want but you'll have to calculate the resistor value again for a different LED.
  • BC 337-25 transistor (You can use a different transistor if it has the same electrical properties)
  • A 12 VDC transformer
    • I took my transformer from a old laptop charger which provides me 12 volts and max. 4.5 amps.
  • A solder protoboard

Edit: I noticed that my transformer outputs 20 volts instead of 12 volts. If you use 20 volts your circuit, please use 1k ohm resistor for your LED. I am really sorry about my mistake.

Calculating the resistor values

You can skip this part if you don't want to know / if you already know, how to calculate the resistor values for the components.

So first we need to calculate the resistor value for the LED with this formula: Rl = (Uin - Ul) / IL

  • Uin = Input voltage (We're using 12 volts.)
  • Ul = LED operating voltage (red LED has a operating voltage of 1.7 - 2.0 volts.)
  • IL = LED operating current (LEDs often use a operating current of 10 - 15 mA but I'm using 20 mA in my calculations.)

(12V - 2V) / 0.020 A = 500 ohms

So we need a 500 ohm resistor. I'm using E12-series resistors so I don't have a 500 ohm resistor. That's why I'm using a 560 ohms instead.

Before we calculate the resistor for the transistor, we need to know a couple of things about the transistor we're using:

  • Min. hFE = Minimum current gain (You can look up the current gain values from the datasheet but I'm using 100 in my calculations.)
  • Ic = Collector current (The amount of current what the collector gets. In this case it gets about 20 mA because of the LED.)

Now we can to calculate the resistor for the transistor. We can do that with this formula: Rb = Uin - Ube / Ib

Uin = Input voltage (As I said earlier, my solar cell provides about 5 volts, so we're using that value.)

Ube = Collector-emitter voltage (Usually the voltage is about 0.5 - 0.7 volts. We're using 0.7 volts.)

Ib = Base current (We need to calculate the base current for the minimum hFE value.)

Formula for the minimum hFE value: Ib = Ic / hFE

0.020 A / 100 = 0.0002 A = 0.2 mA

So 0.2 mA is the minimum amount of current we need for the transistor to operate. I doubled the minimum current value because I want to make sure that the transistor opens when it needs to. That's why I'm using 0.4 mA in my calculations.

(5.0V - 0.7V) / 0.0004 A = 10 750 ohms

So we need a 10.75 ohm resistor. In E12-series the closest one is 10k ohms but I wanted some more resistance just in case the transistor doesn't blow up, so I'm using 10k ohm and 560 ohm resistor in series. (10k ohm+ 560 ohm = 10.56k ohm.)

You can also use a 12k ohm resistor if you want.

Step 2: Soldering the Components

Now we need to solder the components to the protoboard. Above is the arrangement and the circuit diagram I used. You can change the arrangement it if you want.

I soldered the transformer to the board using two thinner wires because the original wires were too thick for the board. When you're done soldering the the transformer's wires, be sure to insulate it. Please use heat-shrink tubing to insulate the wires. I didn't have any tubes left, so I insulated the wire with electrical tape and heated it.

And be sure that you don't make any cold joints while soldering. Cold joints aren't good for your circuit.

Step 3: Test You Circuit

When your done soldering, you can test your circuit by plugging it into the wall. The LED should turn off when the solar cell is covered and it should turn on when the solar cell is exposed to light.

Remember that it's your own responsibility if something bad happens with your creation!