Pass voltage when switch turns off.

Discussion in 'General Electronics Chat' started by sirchuck, Feb 23, 2016.

  1. sirchuck

    Thread Starter Member

    Feb 14, 2016
    51
    2
    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.
     
  2. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,542
    2,369
    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.
     
  3. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    5,797
    1,103
    Post a schematic of your circuit. We're not psychic ;).
     
  4. ian field

    Distinguished Member

    Oct 27, 2012
    4,415
    784
    If its feeding a text book 2 transistor Schmitt trigger - just move the LED from one collector load to the other.
     
  5. sirchuck

    Thread Starter Member

    Feb 14, 2016
    51
    2
    Sorry, I should have sent along a copy of my circuit.

    http://www.digikey.com/schemeit/#2p3y

    Ian, I'm not sure what you mean by one collector load to another, do you mean just attach the LED to the phototransitor's collector instead of the transistors collector?
     
  6. GopherT

    AAC Fanatic!

    Nov 23, 2012
    6,043
    3,807
    That digikey site is unique to you. I just see a blank page. Try a screen capture of the circuit. Post the image.
     
  7. sirchuck

    Thread Starter Member

    Feb 14, 2016
    51
    2
  8. GopherT

    AAC Fanatic!

    Nov 23, 2012
    6,043
    3,807
    Swap R1 and D1.

    Also, put L1 on the collector side of the NPN transistor - between collector and + power. (right now it is on the emitter side - between emitter and ground, which is not so good).
     
  9. HitEmTrue

    Member

    Jan 25, 2016
    32
    9
    Also, a resistor may need to go in series with L1.
     
    GopherT likes this.
  10. GopherT

    AAC Fanatic!

    Nov 23, 2012
    6,043
    3,807
    @sirchuck

    Yes, I missed that completely - I was focusing on your sensor.

    You need to tell us the amperage of the LED, forward voltage of LED and voltage of power supply so we can help calculate the size of resistor in series with the LED.
     
  11. sirchuck

    Thread Starter Member

    Feb 14, 2016
    51
    2
    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. :)
     
  12. HitEmTrue

    Member

    Jan 25, 2016
    32
    9
    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.
     
  13. sirchuck

    Thread Starter Member

    Feb 14, 2016
    51
    2
    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.
     
  14. GopherT

    AAC Fanatic!

    Nov 23, 2012
    6,043
    3,807
    I recommend something like this.





    image.jpg
     
  15. sirchuck

    Thread Starter Member

    Feb 14, 2016
    51
    2
    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: Feb 23, 2016
  16. GopherT

    AAC Fanatic!

    Nov 23, 2012
    6,043
    3,807
    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?
     
  17. sirchuck

    Thread Starter Member

    Feb 14, 2016
    51
    2
    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.
     
  18. hobbyist

    Distinguished Member

    Aug 10, 2008
    764
    56
    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.
     
  19. sirchuck

    Thread Starter Member

    Feb 14, 2016
    51
    2
    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.
     
  20. hobbyist

    Distinguished Member

    Aug 10, 2008
    764
    56

    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: Feb 25, 2016
Loading...