Introduction: Light Sensor
in this instructable we will make a "darkness detector", which will put on 2 led's when it gets dark.
• 2 x LED's ( Light Emitting Diodes).
• 1 x NPN BC547 transistor.
• 1 x 10k Ohm potentiometer.
• 1 x 38k Ohm resistor.
• 1 x 10k Ohm photocell.
• 1 x 4,7 Uf capacitor. ( not necessary )
• 1 x Button cell battery holder.
Step 1: Scematic
This is the scematic, i will explain how this works a bit here.
The first thing you see is the Voltage divider.
This is the first line straight down from the left, which contains:
1 x 38k Ohm resistor ----> 1x 10k Potentiometer ----> 1x 10k photocell.
The transistor theory and math'O voltage divider:
In this case we are using the transistor as a Switch.
The BC547 will turn fully on when it gets an 0,6 Volts input to the base (B), which is the transistor's "threshold voltage".
The led's will not emit much light before the transistor get's 0,6 Volts input to it's base pin.
The voltage divider's task is to keep the voltage well below 0,6 Volts , before it is completely dark.
A little voltage divider math:
This is the formula:
Vout = Vin * R2 / (R1 + R2)
Lets forget about the pot meter right about now, and call the photocell R2.
so the resistor = R1
and the photocell = R2
Vin = 3V
The photocell has a resistance of 10k Ohm ( 10 000 Ohm ) when it's completely dark.
Following the formula we can figure out the voltage into the Base ( B ) of the transistor.
Vout = 3V * 10 000 / ( 10 000 + 38 000 )
Vout = 0.625 Volts.
So when it is completely dark the voltage into the Base of the transistor will be 0.625 Volts, just over what we need so the led's will turn on when it is completely dark.
This is why we add the pot meter, cause the math is extremely simple, and the pot meter just allows us to regulate the Darkness / Light sensitivity a bit as we want by increasing and decreasing the resistance on either side.
I put the capacitor there for stability, you don't really need it, i just put it there cause i have so many of em.
As you see i've used 2 leds and one resistor (This is a fault), when working with bigger batteries you would, use a resistor for each and one of them, this to protect them, but also to make shure one led doesn't draw all the power from the others.
but the button cell battery wont harm the led's anyway as it does not have the power to do it, and both leds light up just as bright, so i just put a 68 Ohm resistor on two leds in parallel.