Ttl pic16f88

Discussion in 'General Electronics Chat' started by aGpLT, May 6, 2010.

  1. aGpLT

    Thread Starter Member

    Jan 21, 2010
    128
    0
    Hello everyone, i have one question. I am using ITR8402 optical interrupter and in output i get 1.7V, (0.7V - when interrupted.) So my question is : Will my uC get information correctly ? are these outputs enough for uC to recognize low and high impulse ?
     
  2. BMorse

    Senior Member

    Sep 26, 2009
    2,675
    234
    Can you post a circuit on how you have this device connected in a circuit?
    Sounds like the phototransistor is not turning on or off all the way.
    B. Morse
     
  3. aGpLT

    Thread Starter Member

    Jan 21, 2010
    128
    0
    in circuit i have indicator and i see when my led turn on always when i interrupt when it turn off. i think everything is working. here is circuit: http://www.ipix.lt/desc/88258441/ as you see there is one gnd near output, its my mistake, ignore it.
     
    Last edited: May 6, 2010
  4. BMorse

    Senior Member

    Sep 26, 2009
    2,675
    234
    try it like this instead....

    OPTOCOUPLER WIRING.png

    B. Morse
     
  5. aGpLT

    Thread Starter Member

    Jan 21, 2010
    128
    0
    ah i see, my big mistake :> what about that resistor ? what value to choose ?
     
    Last edited: May 6, 2010
  6. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Do you mean for R1?

    R1 = (Vsupply - Vf_LED) / Desired_LED_Current

    Make sure you don't exceed the rating of the optointerruptor's output. You'll probably be OK if you stay below 2/3 of it's rating.
     
  7. BMorse

    Senior Member

    Sep 26, 2009
    2,675
    234
    That would depend on the LED you are using, for a general rule of thumb, for 5 volts I use 330 - 470 ohm, 12 volts I use 1K - 4.7K but it all depends on the LED you have in the circuit.

    B. Morse
     
  8. aGpLT

    Thread Starter Member

    Jan 21, 2010
    128
    0
    So my voltage is 5V i used 330 ohm resistor and checked my voltage output, without interruption output is 1.3V when interrupted voltage go 0V. So main problem for voltage drop is R1, y ?
     
  9. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Wait a minute, that won't work right.

    Try it this way instead:

    [​IMG]

    Your TTL out to your uC should have a range of 0.63v to 5v.

    With the way you were doing it before, the LED was causing too much of a voltage drop.

    Adding a transistor to drive the LED gets around that problem.

    You may need a pull-down resistor from the base of the transistor to the emitter (ground). 3k to 5k should work fine.

    If you don't have a 2N2222, a 2N3904, 2N4401, or many other NPN general purpose /small signal/switching transistors will work just fine.
     
    aGpLT likes this.
  10. aGpLT

    Thread Starter Member

    Jan 21, 2010
    128
    0
    I inserted 1.2kohm resistor and i got 3.2V output i think its enough for uC to recognize for high.
     
  11. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    If you follow the new schematic, you will be well within the TTL specifications.
     
  12. aGpLT

    Thread Starter Member

    Jan 21, 2010
    128
    0
    Thank You for help :) still i edited circuit a little bit. Because i got different results when i measured, OUTPUT: without interruption - 1.9V with interruption 5.3V. So i experimented to find out what value of resistors i need. And got got this circuit (below). OUTPUT: without interruption - 0.8V with interruption 5.3V.
    [​IMG]
     
Loading...