# optocoupler on PIC

#### milen

Dec 20, 2009
17
I have a 12V signals that I need to get to PIC port.
The thing is that I would like NOT gate. Meaning that when there will be voltage present on foto diode there will be no voltage on PIC input and vice versa.
Will ILQ5 optocoupler be fine. Can I use below schematics found in datasheet, and I use 1kohm resistor instead?

Last edited:

Dec 20, 2009
17

#### Resqueline

Jul 31, 2009
2,848
Yes, and 1k is the lowest resistance you can use there, 10k will usually also work well but switching speed may suffer.

#### milen

Dec 20, 2009
17
Yes, and 1k is the lowest resistance you can use there, 10k will usually also work well but switching speed may suffer.

The max current through ILQ5 collector is 50mA so min resistor value will be (5V / 50mA) 100 ohm. And if you look at the datasheet schemes, there are 75ohm resistors.

This isn't really inportant. However I wish to minimize my power consumption since this will be powered by batteries so 10k pull up must work? And 2.2k on the diode side for 12V signals inputs so 5mA cuurent will flow through diode must work also?

How slow switching are we talking about at 10k? usec, msec, sec?

#### Resqueline

Jul 31, 2009
2,848
The max current through ILQ5 collector is 50mA so min resistor value will be (5V / 50mA) 100 ohm. And if you look at the datasheet schemes, there are 75ohm resistors.
You're after saturated switching, to get well defined logic levels for your PIC, right? Then the 50mA is quite irrelevant for you.
If you really look at the datasheet you'll find that the Current Transfer Ratio is 50%, and the diode current is max 60mA, which means the transistor can't ever remain in saturation up to more than 30mA. If you look at the scheme you refer to you'll also find that it says non-saturated switching. You won't get a 5V logic swing in this mode, but this is how you get the fastest switching speeds.

This isn't really important. However I wish to minimize my power consumption since this will be powered by batteries so 10k pull up must work? And 2.2k on the diode side for 12V signals inputs so 5mA current will flow through diode must work also?
Referring to the above, if you spend 5mA on the diode you get 2.5mA from the transistor. Any currents & resistor values can be chosen, as long as it will be able to drive your PIC input, but observe that the CTR varies with diode current, temperature, age, & from device to device. You'll need to study the figures in the datasheet closely to get the exact numbers, but you'll also need to design with minimum CTR in mind, not typical.
Use the 25deg.C curves (but disregard the 25deg. statement in fig.8, it's for 70deg.C).

How slow switching are we talking about at 10k? usec, msec, sec?
If you look at page 7 in the datasheet you'll find the propagation delays directly related to the collector resistor value; tpLH=50us & tpHL=1.5us @ 10k. This translates to a max frequency of 19.4kHz.

Replies
8
Views
310
Replies
10
Views
595
Replies
2
Views
505
Replies
2
Views
676
Replies
14
Views
3K