Playing with Arduino and PC817 optocoupler - Voltage measurement doubt - Page 1
Forum section: electronics / beginners

author: dav
author_rank: Regular Contributor
timestamp: January 22, 2017, 11:00:10 am
content: I was playing with Arduino and a PC817 optocoupler.Simple circuit: using an Arduino digital pin, I wanted to switch on and off a 5mm LED via an optocoupler.So, digital pin -> 220R resistor -> pin1 optocoupler (internal LED anode)pin 2 optocoupler (internal LED cathode) -> GNDand+5V (external power supply) -> pin 4 optocoupler (collector)pin 3 optocoupler (emitter) -> 220R resistor -> 5mm LED -> GNDLOW level on Arduino digital pin -> 5mm LED offHIGH level on Arduino digital pin -> 5mm LED onOkThe question:Let's measure the voltages on the 2nd side of the circuit across the components, in both working conditions.HIGH:Vce= 0.2VV across the resistor: 2.7VV across the LED: 2VOkLOW:Vce= 3.5VV across the resistor: 0VV across the LED: 0VWhat's happened to Ohm's law???I tried to disconnect all components on the first side of the optocoupler and took again the voltages in LOW case.Same as beforeWhere I'm wrong?

author: danadak
author_rank: Super Contributor
timestamp: January 22, 2017, 12:07:17 pm
content: Post a schematic with part numbers on devices, eg. optocoupler, soforum can help you.Regards, Dana.

author: radiogeek381
author_rank: Regular Contributor
timestamp: January 22, 2017, 01:19:33 pm
content: This is a really cool question. And the answerlies in how you did the measurement.Remember that your DMM has a finite resistance.It isn't the ideal meter that we imagine in theory.Let's say that your meter has a 10Mohm effectiveresistance between + and - leads. Then when youhad the meter across the C and E pins on the optocoupler you read 3.5 V. That works out to 3.5/(10*10^6)or 350 nA through the meter.This is big enough, compared to the dark current --spec'd at 100nA max -- that the meter is disturbingthe measurement. It is dumping an additional 350nAinto a diode whose resistance at that point may bereally really big. (Note that a diode is NOT aresistor -- it's current follows an exponentialcurve.)Small changes in diode current can lead to bigchanges in voltage. If you get I1 at a voltage V1,and I2 at a voltage V2,V2/V1 is about 20 to 40 times the ln of (I2/I1)(At low voltages, the multiplier is closer to 40.)so if the current goes up by a factor of 10, thevoltage may rise by a factor of 50 or even 100!In your case, if your DMM has a resistance of 1M ohm,the ratio of the current will be at least 35:1.But the leakage on the optoisolator has no min spec.If the max is 100nA, it isn't unreasonable to expectsome devices to get to 10nA. That's a 350:1 ratioIn that case, 40 * ln(350) = 23440 * ln(35) = 142So, if V1 was 1.5 V, then the voltage you mightmeasure across the diode could be as low as6 mV or as high as 11mV.And that voltage gets lower, given that the DMMis "bleeding" some of the current away from thediode.You're on a steep curve.

author: Ian.M
author_rank: Super Contributor
timestamp: January 22, 2017, 01:21:06 pm
content: +1. <snip> explanation: Radiogeek did it better!If you re-measure everything with the meter negative permanently connected to 0V (GND) and take differences to get the voltage across each part, it will all make sense and follow Ohm's law with no surprises

author: dav
author_rank: Regular Contributor
timestamp: January 23, 2017, 07:43:19 am
content: I did other tests:first side of PC817 openVce: 3.5VV across the 5mm LED: 0Vthen, with my Brymen DMM on the optocoupler, I simultaneously took the voltage across the LED (using my Fluke).Well, inserting the 2nd DMM, both voltages instantaneously changed!Vce: 3.5VV across the 5mm LED: 1.4V2nd test:I used my Fluke to take the DC current in the circuit and my Brymen for measuring Vce.Well, without inserting the brymen, I=0When I took the Vce, the current change to 0.4uA.

author: chrisl
author_rank: Regular Contributor
timestamp: January 23, 2017, 09:41:49 am
content: Try to keep the load (LED) on the collector side of PC817, not on the emitter side.5V -> 220 ohm -> LED -> PC817 pin 4PC817 pin3 = GND.

author: Ian.M
author_rank: Super Contributor
timestamp: January 23, 2017, 09:59:30 am
content: It doesn't matter whether you use the opto's phototransistor on the high side or the low side of the load. It can go *anywhere* in a series circuit as long as the polarity is correct.As the PC817 base isn't brought out, the output side is effectively a two terminal device. If the base was brought out, it could still be used on the high side, but in high EMI environments, protecting the base against noise pickup would be more problematic.

author: dav
author_rank: Regular Contributor
timestamp: January 23, 2017, 01:17:19 pm
content: Another test:I setup my Korad power supply limiting the current to 20mA and do a sweep from 0 to 2V, with 0.01V steps, directly powering the 5mm LED (with my Fluke in series for current measurement).Well, at 1.4V on Korad display, my Fluke exactly measures 0.4uASo, it's exactly as radiogeek suggested:my Brymen DMM drains 0.4uA which flows in the LED, estabilishing a 1.4V voltage across it.Input resistance of my Brymen is really:3.5V / 0.4uA = about 9Mohm