Maker Pro
Maker Pro

Photo Sensor Project Question

Hello, new to the forums here and somewhat of a newbie to electronics. I have a project I'm working on and was hoping to get some help with the electronic components. So here goes....

I bought 5' of this LED Strip: LED Strip, a 12v 12w 1A Power Supply, and this RGB Controller: RGB Controller. Everything works great, I've even been able to cut the LED Strip into sections and solder wires between the sections. The part I'm having trouble with is that I want to add a photo sensor, photoresistor, or phototransistor to have the LED's turn on automatically when the room gets dark. Through investigation I've found that there are many ways to do this, but it appears one of the simplest methods seems to utilize an NPN transistor as seen here:
Circuit1.jpg

I've tried this circuit with success using this kit: Electronic Snap Kits
Juvenile I know but like I said I'm a beginner and it was on sale at Radio Shack :p
So how do I integrate this NPN transistor schematic into my project with:
A) The electricity being supplied by the 12v 12w 1A Power Supply and/or RGB controller instead of 2 AA batteries.
B) The LED being a 5' strip or RGB LED's instead of a single LED.
C) The resistor, NPN transistor and photo sensor being bought from Fry's or Radio Shack.
:confused:

Thanks in advance!
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Firstly, your circuit does not have a resistor to limit the current through the LED. That is a bad thing, but I realise that this is only to illustrate what you're trying to do.

There are a number of things to consider.

1) You should probably want the circuit to turn the LEDs on and off quickly (i.e. they are either on or off, not half on or off) so as to reduce power dissipation.

2) You need to ensure that the light detector cannot "see" your lights or you will have undesirable behaviour.

In the reverse order, the second one is simply a placement and.or shielding issue. The first objective is best met with a device having high gain and some hysteresis.

Hysteresis in such a circuit means that the light level required to turn the lights on is significantly less than that required to turn them back off again. This means that as it slowly gets darker, the light will turn on, but a minor increase in light (say from changes in light caused by moving clouds) will not turn it off very easily. This produces an effect of the light turning on as it gets dark, and then turning off as it gets light. Without this effect the light may turn on and off many times as the light level hovers at the switching point.

Here is a comparator circuit with hysteresis.

You could connect your resistor and photo sensor to the input (the same way that it's connected to the base of the transistor in your circuit) and use the output to drive an N channel mosfet to turn your load on and off.

You will probably want to make the resistor (the one in series with the Photo sensor) in your circuit variable so that you can adjust the light level.
 
Steve, thank you for your quick response.

Doesn't the power supply and/or RGB Controller provide the LED Strip with the correct resistance?

As for your things to consider:
1) That's a good idea. Is power dissipation a bad thing... as in, will it shorten the life of one of the components? Or are you saying it will just 'waste' electricity?
2) The light detector will definately not be able to 'see' the lights.

You could connect your resistor and photo sensor to the input (the same way that it's connected to the base of the transistor in your circuit) and use the output to drive an N channel mosfet to turn your load on and off.
Can you please explain this a little further? Would the photo sensor and resistor then be in series with the LED Strip?
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Doesn't the power supply and/or RGB Controller provide the LED Strip with the correct resistance?

Yes, but in the simple circuit you showed, you have a simple LED. I noted in passing that this circuit should have a resistor in series with the LED, but indicated that it was not an important consideration because that circuit was only used by you to show your basic idea.

As for your things to consider:
1) That's a good idea. Is power dissipation a bad thing... as in, will it shorten the life of one of the components? Or are you saying it will just 'waste' electricity?

It will cause the transistor that turns the lights on and off to get hot. If it is either fully on or fully off then the power goes where you want it (into the lightds) and is not wasted as heat. It means that you don't have to provide a heatsink (or perhaps provide only a small one)

2) The light detector will definately not be able to 'see' the lights.

good.

Can you please explain this a little further? Would the photo sensor and resistor then be in series with the LED Strip?

Break that circuit of yours in two. Imagine cutting the wire between the junction of the resistor and photoresistor and the base of the transistor. Into this gap, insert the circuit I linked. Then change the transistor from a transistor to an N channel MOSFET.
 
I'll research how to use the Comparator and N channel MOSFET, thanks.

Since my LED's are RGB they have 4 wires powering them (+, R, G & B) from the RGB Controller, as opposed to the simple + and - side of a single color LED which is shown in my simple diagram above. Does this screw up my plan? Do I only have to worry about the + wire? Or does all of the photo sensing, MOSFET'ing, etc... have to occure before the RGB Controller?
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Where you show the LED in your circuit is where you would place whatever you connect 12 volts to, presumably the controller.
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
No, where you have the LM311 you need the ENTIRE circuit that was in that link I posted.

The 100K resistor you show should be replaced with a 10K resistor in series with a 1M pot (that should be a reasonable value)
 
Top