0
\$\begingroup\$

I am working on a project in which I am driving 6 ultrasonic sensor 4 of them are NPN (NC) and 2 of them are NPN (NO) ,for safety of the MCU I am using optocoupler EL817 for isolation between sensors and MCU but I am going through very unreliable behaviour of the circuit ,my all sensors work initially but after some time 2 of them does not give proper output voltage I am using pull-up circuitry as mentioned in the figure
, technically when there is input from sensor the output pin of optocoupler give voltage reading LOW and when there is no input from sensor output voltage at the optocoupler output pin will be 3.3V (Vcc) but optocoupler circuit for 2 sensors initially show correct voltage but after some time even there is input from sensor output voltage at optocoupler output pin show (2.9) V but it should show (0.70V) and if I put sensors in LOW voltage from 2.9V change to 3.3V So I think this voltage swing is due to improper calculations of resistors in the optocoupler circuitry Suggest me if is there any other factor . Please suggest me how I can calculate Ic , If , RL and RD for the optocoupler circuit

  1. NPN (NO) sensor operating voltage 10-30 V I am operating at 24V
  2. NPN (NC) sensor operating voltage 10-30 V I am operating at 24V 3.Output current of both sensor <200mA 4.MCU GPIO pin current 8mA
  3. VCC is 3.3 V
  4. In my case input from sensor is 24V and Rd=2.6K and RL=4.7K
\$\endgroup\$
1
  • \$\begingroup\$ Worst case CTR = 50 or hFE = 0.5 so saturation reduces this to 0.05 and RcVdd/RbVcc ratio is too low \$\endgroup\$ – Tony Stewart EE75 Feb 16 at 19:09
1
\$\begingroup\$

With Vcc = 3.3 V and RL = 4.7 kΩ the required optocoupler output current is ~3.3 / 4700 = 0.7 mA. An EL817 without suffix letter has minimum CTR (current transfer ratio) of 50% at an LED current of 5 mA. Therefore the optocoupler LED current needs to be at least 0.7 / 0.5 = 1.4 mA.

However looking at figure 2 in the datasheet we see that at 1.4 mA CTR reduces to ~60% of its value at 5 mA, so we actually need closer to 2 mA. And CTR also decreases as temperature increases, so to guarantee reliable operation in a hot environment we need even more LED current. Finally, the specified CTR is at a Collector voltage of 5 V. To fully saturate the transistor we need even more LED current again.

How much more? That's a tricky calculation. So let's avoid all that and just choose an LED current of 5 mA (which should be more than enough) and then we can use the datasheet numbers directly. At 5 mA the LED drops ~1.15 V. Subtract this from an input voltage of 24 V and we get ~22.9 V across Rd. 22.9 / 0.005 = 4570 Ω, so we choose the nearest standard value of 4.7 kΩ.

But you are using 2.6 kΩ which should be providing ~8.8 mA, much more than you need. So something else must be wrong. Either the input is less than 24 V, or one of the resistor values is wrong, or the MCU is pulling up internally, or the optocoupler is not meeting its spec. You need to do more measurements to find out where the problem lies.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.