Photo transistor help

Discussion in 'The Projects Forum' started by shaun577, Nov 15, 2011.

  1. shaun577

    Thread Starter New Member

    Nov 15, 2011
    4
    0
    Hi,

    I am having a bit of trouble getting my phototransistor encoder going. I have attached the circuit I have been using. The circuit is going but it's not outputting a low enough voltage when the phototransistor is dark. I need the voltage to swing from below 0.8v to over 1.6v to ensure the schmitt trigger triggers properly. Currently I can get the output to swing from about 1v to the supply voltage which is fine for the high triggering but not low enough for a low trigger.

    I am using this Ir led/phototransistor pair to read an encoder wheel.

    I have spent the last few hours trying to figure this problem out but with no success. Any suggestions would be much appreciated:)
     
    • Doc2.pdf
      File size:
      122.4 KB
      Views:
      51
  2. Adjuster

    Well-Known Member

    Dec 26, 2010
    2,147
    300
    The phototransistor voltage falls low when it is illuminated, not when it is dark.

    To get a lower minimum voltage, try reducing R1 so that the LED gets more current. Don't go too far, as yopu don't want to exceed the LED maximum current. Depending on the LED Vf, 330Ω or 270 might get you 10mA, which might be OK.
    Best to check the device datasheet though.
     
  3. KMoffett

    AAC Fanatic!

    Dec 19, 2007
    2,576
    231
    Why is the output of theU1A inverter connected to ground?

    Ken
     
  4. MrChips

    Moderator

    Oct 2, 2009
    12,449
    3,365
    Try replacing the inverter with a CMOS gate. Any type of gate might do, eg. CD4069 inverter. With a CMOS gate you can increase R2 to a much larger value. Try 100K or 220K.
     
  5. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    A CD4093 is a quad Schmitt-trigger NAND gate; you can tie a gates' two inputs together to make an inverter out of it.

    The CD40106 is a CMOS equivalent of the 74xx14.

    Note that the pin outputs of the 4000 series are not necessarily the same as the 74xx series logic ICs.

    We don't know what the typical Vf of your LED is at it's rated current.
    If you know what the typical Vf @ current rating is, you can calculate what the value of R1 should be as:
    R1 >= (Vsupply - Vf) / DesiredCurrent

    Just for example:
    You are using 5v for Vsupply
    Let's just say that you were using an IR LED that had a Vf of 1.2v @ 20mA.
    Substituting:
    R1 >= (5v-1.2v) / 20mA
    R1 >= 3.8 / 0.02
    R1 >= 190 Ohms

    Here is a table of standard decade resistor values:
    http://www.logwell.com/tech/components/resistor_values.html
    Looking in the green E24 columns, you will find that 190 is not a standard value.
    180 Ohms and 200 Ohms are the closest. You can go with a single 200 Ohm resistor; 180 Ohms would be too low.
    You could also go with a 100 Ohm and a 91 Ohm resistor in series, which would give you 191 Ohms.
    You could also use two 360 Ohm resistors in parallel, which would give you 190 Ohms.
     
    Last edited: Nov 15, 2011
  6. John P

    AAC Fanatic!

    Oct 14, 2008
    1,634
    224
    Turn your circuit on its head, with the phototransistor connected to V+ and the resistor to Gnd (but don't reverse the transistor). Now instead of having a swing 1-5V it will be 0-4V. Problem solved.

    Oh, obviously the output will be inverted. Just use 2 inverter gates on the output instead of 1, if that's an issue.
     
  7. MrChips

    Moderator

    Oct 2, 2009
    12,449
    3,365
    No. R2 at 20K-ohm is not low enough to pull the input of a TTL gate LOW.
    You need to sink 0.4mA to bring Vin to below 0.5 V. R2 would have to be less than 1K-ohm.
     
  8. shaun577

    Thread Starter New Member

    Nov 15, 2011
    4
    0
    Thanks for your help. I have tried your suggestions and have found a couple of things.

    I calculated the value that R1 should be. R1= (Vcc-vf)/Imax of led
    R1=(5-1.3)/60mA
    R1=61Ω so I used a 120Ω in parallel with a 130Ω

    The output of the schmitt trigger is not meant to be connected to ground, my mistake, it is actually connected to a digital input of my arduino microcontroller.

    After trying the suggestion to "turn the circuit on it's head" and experimenting with several different resistor values it is better but still won't go below 1v. If I disconnect the schmitt trigger and just read the ouput voltage with no load on the phototransistor the output swings nicely to just above zero and back up to almost supply:confused: This is what I want to happen but as soon as I connect up the schmitt trigger again it won't go below 1v
     
  9. John P

    AAC Fanatic!

    Oct 14, 2008
    1,634
    224
    Good grief, TTL. I just glimpsed an inverter there and assumed it was a 74HC14. Throw out that old stuff and get CMOS!

    And edited to say, what's the function of the inverter anyway, if you're driving a processor pin? I'm not an Arduinoist, but on PIC processors the digital inputs often have the Schmitt trigger function built in. You might check and see what the Arduino has.
     
  10. MrChips

    Moderator

    Oct 2, 2009
    12,449
    3,365
    Like I said, the load presented by a 74LS14 is too high. Try a CMOS gate instead.
     
  11. shaun577

    Thread Starter New Member

    Nov 15, 2011
    4
    0
    I will try a CMOS gate. I don't think the arduino has schmitt triggered inputs. I tried it without using the schmitt trigger chip and the input to the micro jumped up and down and was not stable enough.

    I am using the Ir led/receiver to count an encoder wheel. The inverting part of the schmitt trigger doesn't matter. It wouldn't matter if it was inverting or not for my purposes.
     
  12. MrChips

    Moderator

    Oct 2, 2009
    12,449
    3,365
    You can try this:

    [​IMG]


    I don't know if this will work but it may be worth a try. Any small signal NPN transistor should work. You may have to experiment with the values of R1 and R2.
     
  13. shaun577

    Thread Starter New Member

    Nov 15, 2011
    4
    0
    Replacing the TTL chip with a CMOS chip was all that was needed. Works like a charm now.:) Thanks for all the help
     
Loading...