Ttl pic16f88

Thread Starter

aGpLT

Joined Jan 21, 2010
128
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 ?
 

BMorse

Joined Sep 26, 2009
2,675
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
 

Thread Starter

aGpLT

Joined Jan 21, 2010
128
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
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:

SgtWookie

Joined Jul 17, 2007
22,230
ah i see, my big mistake :> what about that resistor ? what value to choose ?
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.
 

BMorse

Joined Sep 26, 2009
2,675
ah i see, my big mistake :> what about that resistor ? what value to choose ?
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
 

Thread Starter

aGpLT

Joined Jan 21, 2010
128
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
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 ?
 

SgtWookie

Joined Jul 17, 2007
22,230
Wait a minute, that won't work right.

Try it this way instead:



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.
 

Attachments

Thread Starter

aGpLT

Joined Jan 21, 2010
128
If you follow the new schematic, you will be well within the TTL specifications.
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.
 
Top