Pass voltage when switch turns off.

Thread Starter

sirchuck

Joined Feb 14, 2016
150
I have a phototransistor, when it's dark my LED turns on. I wan't to do the opposite, when it's dark I want my LED to turn off. What component do I need to change how the phototransistor switch works?

I guess you could think of this like a regular switch. Usually when you toggle the switch on it allows voltage through the switch that powers your device. I want the switch to work normally, but something between the switch and LED to stop the voltage from passing when the switch is on, but allow the voltage when the switch is off.
 

MaxHeadRoom

Joined Jul 18, 2013
28,619
What is the P.T. feeding into right now, all you need to do is perform an inversion, you may be able to do it with the present set up or add a transistor/fet inverter.
Max.
 

Thread Starter

sirchuck

Joined Feb 14, 2016
150
Ok, I think I drew the first circuit wrong, This appears to be the circuit I have that turns off during daytime, and turns on during night time.

I think my first circuit I drew some of emitters incorrectly.

phototransistor2.jpg
I'm going to try some of your suggestions now to see if I can get it working. :)
 

HitEmTrue

Joined Jan 25, 2016
32
That's the same circuit as before...what program are you drawing that with?

If you use digikey's progam, you can use the "export" button to export to PDF or PNG file.
 

Thread Starter

sirchuck

Joined Feb 14, 2016
150
That's the same circuit as before...what program are you drawing that with?

If you use digikey's progam, you can use the "export" button to export to PDF or PNG file.
Ah you are right. I am failing forms today.

I just removed the transistor and the circuit still works by turning the LED on at night, and off during the day.

schemeit-project.png

I don't know if voltages and amps matter to invert when the LED comes on, but i'm running 5v in, 120Ω resistor, Blue Led ( assuming 20ma 3v forward ? )

The public version of the project:
http://www.digikey.com/schemeit/#2p51
You should be able to view it now, I had to close my project before it would finish making it public.
 

Thread Starter

sirchuck

Joined Feb 14, 2016
150
I recommend something like this.





View attachment 101302
Wow that worked perfectly. How did you figure the 4.7k resistor? Could you show the equation you used, and the numbers you used to plug in to that equation? :)

Honestly I never thought a resistor would do it, I know there are probably 100 different ways to accomplish the task though.

After some playing around, at night the LED goes dark as we want. The LED turns on in a range of light, then when it gets too much light it shuts off. So there might be some figuring to do with my particular circuit, but it seems your solution will work once I get everything set to the right values.
 
Last edited:

GopherT

Joined Nov 23, 2012
8,009
Wow that worked perfectly. How did you figure the 4.7k resistor? Could you show the equation you used, and the numbers you used to plug in to that equation? :)

Honestly I never thought a resistor would do it, I know there are probably 100 different ways to accomplish the task though.

After some playing around, at night the LED goes dark as we want. The LED turns on in a range of light, then when it gets too much light it shuts off. So there might be some figuring to do with my particular circuit, but it seems your solution will work once I get everything set to the right values.
It was a wild guess on the resistor value. When I say wild, it is wild within a reasonable range that you would get a feel for once you do this for a while. Do you want a sharp cut-off or is the gradual turn on / off ok for you?
 

Thread Starter

sirchuck

Joined Feb 14, 2016
150
It was a wild guess on the resistor value. When I say wild, it is wild within a reasonable range that you would get a feel for once you do this for a while. Do you want a sharp cut-off or is the gradual turn on / off ok for you?
It's fine, I can tinker with it, now that I can see a way to do it. I'm really just trying to learn it, there is no current practical value for it, so the way it operates now is fine. I'll continue adjusting values and see how it turns out. :) I'm just surprised it worked by adding the resistor.
 

hobbyist

Joined Aug 10, 2008
892
Wow that worked perfectly. How did you figure the 4.7k resistor? Could you show the equation you used, and the numbers you used to plug in to that equation? :)

Honestly I never thought a resistor would do it, I know there are probably 100 different ways to accomplish the task though.

After some playing around, at night the LED goes dark as we want. The LED turns on in a range of light, then when it gets too much light it shuts off. So there might be some figuring to do with my particular circuit, but it seems your solution will work once I get everything set to the right values.
Hi,

I'm going with an assumption, that you have a basic understanding of how to make a transistor turn on.

Look back at your original circuit, Q2 is supplying a path of current from the positive supply through its collector-emitter, to ground to turn on the LED, all this happens as long as a current can flow through R1, into the base of Q2.

R1 is in a place where the positive supply voltage can be applied to Q2's base to turn Q2 on.

IF you put a resistor at the base of Q2 and connect it to ground (neg.), then you begin to allow another path of current to flow, if this resitor has a resistance low enough, it can cause all the current through R1 to bypass Q2's base and make it flow through this resistance.
That would shut Q2 off, and the LED will not light.

Essentially, thats what D1, is doing, when no light hits its base, it has a very high resistance, so most all current through R1 can go through the base of Q2 to turn it on, and the LED lights up.

When enough light hits D1 its effective resistance becomes much lower, allowing most of the current through R1 to bypass Q2's base and flow through D1 to ground.
Q2 will then be shut off and the LED cannot light.

So if you want to change the behavior of the circuit, you need to switch the position of D1, with R1, so that D1 can supply all the base current for Q2, when D1 has light hitting it.

Now you were under the impression that adding the 4.7K ohm resistor did the trick, in making this work, the 4.7K ohm resistor, is a bleedoff resistor, it ensures that when its dark, any small leakage current that could flow through D1, will be bypassed to ground, because the smallest of light could allow D1 to conduct a little bit, so the 4.7K resistor makes sure that that current does not enter the base of Q2, during very dim lighting.

When it gets too much light it shuts off, probably too much base current causing saturation, a resistor at the base would provide some current limiting to allow transistor to remain linear under heavy lighting conditions.

Hopes this helps give you a better understanding of the circuit.
 

Thread Starter

sirchuck

Joined Feb 14, 2016
150
Hello Hobbyist. I'm going to have to re-read your explanation a few more times for it to sink in, but basically you are pointing out that electricity takes the path of least resistance right?

In GopherT's circuit I don't know why the 4.7K resistor even needs to be there, because it's the highest piece of resistance on the circuit and therefor should never allow current to pass through. When 100lux passes current, it turns on the transistor, and current will flow through the transistor avoiding the 4.7k resistor. When 100lux doesn't pass current there is no current to resist anyway.

If you have time would you draw the circuit you think would work? Maybe seeing it visually would help to understand your explanation. It seems like it should be possible to design a circuit that turns one LED on and another LED off during the day, then switch them at night by working with resistances instead of having to add components like more transistors or NAND gates or relays or whatever.
 

hobbyist

Joined Aug 10, 2008
892
Hello Hobbyist. I'm going to have to re-read your explanation a few more times for it to sink in, but basically you are pointing out that electricity takes the path of least resistance right?

In GopherT's circuit I don't know why the 4.7K resistor even needs to be there, because it's the highest piece of resistance on the circuit and therefor should never allow current to pass through. When 100lux passes current, it turns on the transistor, and current will flow through the transistor avoiding the 4.7k resistor. When 100lux doesn't pass current there is no current to resist anyway.

If you have time would you draw the circuit you think would work? Maybe seeing it visually would help to understand your explanation. It seems like it should be possible to design a circuit that turns one LED on and another LED off during the day, then switch them at night by working with resistances instead of having to add components like more transistors or NAND gates or relays or whatever.

Current will divide into paths of resistances, in other words current will always flow through a closed circuit path, no matter how high the resistance is, according to "ohms law". [I=(V/R)] so yes some current will flow through the 4.7K ohm resistor from D1 being turned on, but not enough to starve the base of Q2 from turning on, you could build the circuit without the 4.7K resistor in it, and it will work fine under broad daylight, but under very dim light, the phototransistor D1, could conduct a small current (leakage) which could be enough to cause Q2 to amplify it, and make the LED turn on slightly.

The 4.7K resistor ensures that a small current through D1 is passed to ground instead of entering into Q2's base during very dim lighting conditions.

I'll draw up the circuit that your asking for, and test it on my simulator, if it proves to be more involved then I'll actually build it on a breadboard with real components to check results.
 
Last edited:
Top