PIR to Optocoupler circuit 201230

sghioto

Joined Dec 31, 2017
5,390
By far, the most important factor in the success of your sensor is the lens you pair with the sensor.
The TS is not building a PIR he's using a HC-SR505 and the opto is not the problem and you don't need two transistors.
If he would have just wired it up correctly as in post #2 we wouldn't be having this discussion.
 

eetech00

Joined Jun 8, 2013
3,951
The circuit in post #14 is not complicated. I recommend keeping the opto as shown in post #14 (and current loop with twisted wires runs) as it offers some ESD protection. While other components could be used (like TVS), they become expensive if required for many inputs.
 

Thread Starter

allenpitts

Joined Feb 26, 2011
163
Hello eetech00, sghioto, LesJones, DodgyDave and the AAC forum,

Have refactored the breadboard based on feedback from sghioto and DodgyDave.
PIR_to_Optocoupler_2_V_Sources_w Transistor_210104.gif
LED2 is not operating as expected, that is, it does not come on.
Have tried testing the PC817, and LED2 both operate normally in unit tests.
Also tried connecting R2 to the +12v at V2. No luck.

It looks like the PIR side is working because LED1 operates as
expected when a hand wave creates motion at the PIR.

Tried putting a ground jumper wire at the V1 grnd rail and the
positive probe at the PC817 cathode to see if Q1 is sending
voltage when LED1 indicates the PIR is operating.
When LED1 is on the DMM reads .98 volts.
When LED1 is off the DMM reads 10.4 volts.

That seems that is opposite of what is expected. That is,
when LED1 is on the expected outcome is that there
would be a voltage from Q1 that would saturate the photoresistor
in the PC817 and light LED2.

Either way would not the difference between .98 and 10.4
volts turn on the PC817?

Is there some way to troubleshoot PC817 operation?

Thanks.

Allen in Dallas
 

LesJones

Joined Jan 8, 2017
4,190
Measure the voltage between the cathode (Black negative meter lead.) and the anode (Red positive meter lead.) DIRECTLY ON THE PINS OF THE PC817 both with LED1 illuminated and not illuminated. Please show us the test that you used to verify that the PCF817 was working.
Your reasoning is wrong about the expected voltages between the ground rail and the cathode of the PC817 (Which is connected to the collector of Q1) When LED 1 is on the transistor Q1 is conducting between it's emitter and it's collector (So there is a low voltage between them.) which means there is voltage across the IR LED in the PC817 and R2 as one end of R2 is connected to +12 volts (V2). So there will be current passing through R2 and the IR LED in the PC817. When LED 1 is not illuminated Q1 is not conducting so your meter reading is 12 volts minus the voltage drop across R2 and the IR LED due to the very small current drawn by your meter. This voltage drop is 12.0 volts - 10.4 volts = 1.6 volts. (I would have expected it to be closer to 1.0 volts.)

The readings directly on the anode and cathode pins of the PC817 will be more meaningful.
Short the collector pin to the emitter pin on the PC817. Does L2 light ?

Les.
 
Last edited:

sghioto

Joined Dec 31, 2017
5,390
Either way would not the difference between .98 and 10.4
volts turn on the PC817?
It should but maybe the current through the opto is too low. Change R2 to 1K and see if that works.
The .98 volt reading when the PIR is activated actually seems high. My test with a 2N3904 reads less then .1 volt

Is there some way to troubleshoot PC817 operation?
Yes very easily. First do as LesJones mentioned above, short the collector and emitter of the PC817. This will the test to see if LED2 is connected properly and working. If that works then connect the cathode to ground on VR2. If the opto is good then LED2 should light. If dim reduce the value of R2. If it doesn't light then the opto is bad.
 

Thread Starter

allenpitts

Joined Feb 26, 2011
163
Hello eetech00, sghioto, LesJones, DodgyDave and the AAC forum,

Finally got the circuit to work.

Little red faced about the solution. Using the fritz marked PIR to Optocoupler 2 V Sources w Transistor shown
in post #23 and the excellent instructions from LesJones
Measure the voltage between the cathode (Black negative meter lead.) and the anode (Red positive meter lead.) DIRECTLY ON THE PINS OF THE PC817
it was discovered that when the leads of the PC817 were pushed down with the DMM probes the LED2 came on, which is the designed operation. So it was surmised that the leads on the PC817 were so skinny that they did not work well with the
breadboard.
Opto_breadboard_photo_210109_450_x_600.jpg

So a socket was used in the breadboard to seat the PC817. Man, its always the simple thing that trip me up.

So thanks for the feedback. This thread comes to a close.

LesJones asked how the PC817 were unit tested.
Simple_isocoupler_test_210105_neg_at_emitter.jpg
This circuit lights D1 enough to be seen easily in ambient light.
Experimenting with the circuit this was tested.
Simple_isocoupler_test_210105_neg_at_collector.jpg

It would seem that these two circuits are electrically equivalent. But with the voltage source connected to the PC817 collector the LED, D1, is much dimmer.

So it was said that this thread would be closed. But perhaps one more question please. Why is the LED so much
dimmer when the voltage source connected to the PC817 collector?

Thanks.

Allen in Dallas
 

eetech00

Joined Jun 8, 2013
3,951
Hello eetech00, sghioto, LesJones, DodgyDave and the AAC forum,

Finally got the circuit to work.

Little red faced about the solution. Using the fritz marked PIR to Optocoupler 2 V Sources w Transistor shown
in post #23 and the excellent instructions from LesJones

it was discovered that when the leads of the PC817 were pushed down with the DMM probes the LED2 came on, which is the designed operation. So it was surmised that the leads on the PC817 were so skinny that they did not work well with the
breadboard.
View attachment 227260

So a socket was used in the breadboard to seat the PC817. Man, its always the simple thing that trip me up.

So thanks for the feedback. This thread comes to a close.

LesJones asked how the PC817 were unit tested.
View attachment 227263
This circuit lights D1 enough to be seen easily in ambient light.
Experimenting with the circuit this was tested.
View attachment 227264

It would seem that these two circuits are electrically equivalent. But with the voltage source connected to the PC817 collector the LED, D1, is much dimmer.

So it was said that this thread would be closed. But perhaps one more question please. Why is the LED so much
dimmer when the voltage source connected to the PC817 collector?

Thanks.

Allen in Dallas
I don’t see how D1 can be seen at all.
In both schematics D1 is connected backwards so no current will flow.
 

ElectricSpidey

Joined Dec 2, 2017
2,779
" It would seem that these two circuits are electrically equivalent. But with the voltage source connected to the PC817 collector the LED, D1, is much dimmer. "

That's because the two circuits are not "electrically equivalent " The one with the battery connected to the collector is in a follower configuration and the other is in a switch configuration, and the battery is connected backwards in the bottom image.

Oh yea, and what eetech00 said.
 

LesJones

Joined Jan 8, 2017
4,190
For the LED D1 to light in both circuits it must be the opposite polarity to that shown in the drawings. The two circuits are not equivalent but not for the reason ElectricSpidey states. The term emitter follower has no meaning as there is no connection to the base of the phototransistor. In the second circuit the emitter and collector connection are sawpped over in terms of polarity. A transistor will normally work to some extent with the collector and emitter reversed but the gain is much lower and the emitter to base reverse breakdown voltage is much less than the collector to base reverse breakdown voltage.

Les.
 

ElectricSpidey

Joined Dec 2, 2017
2,779
"Emitter Follower" is just another term for "Common Collector".

Both configurations are valid for a phototransistor depending on how it's being used.

In this case, when directly driving a load as a switch the common emitter configuration is preferred.
 

BobaMosfet

Joined Jul 1, 2009
2,113
Hello eetech00, sghioto, LesJones, DodgyDave and the AAC forum,

Finally got the circuit to work.

Little red faced about the solution. Using the fritz marked PIR to Optocoupler 2 V Sources w Transistor shown
in post #23 and the excellent instructions from LesJones

it was discovered that when the leads of the PC817 were pushed down with the DMM probes the LED2 came on, which is the designed operation. So it was surmised that the leads on the PC817 were so skinny that they did not work well with the
breadboard.
View attachment 227260

So a socket was used in the breadboard to seat the PC817. Man, its always the simple thing that trip me up.

So thanks for the feedback. This thread comes to a close.

LesJones asked how the PC817 were unit tested.
View attachment 227263
This circuit lights D1 enough to be seen easily in ambient light.
Experimenting with the circuit this was tested.
View attachment 227264

It would seem that these two circuits are electrically equivalent. But with the voltage source connected to the PC817 collector the LED, D1, is much dimmer.

So it was said that this thread would be closed. But perhaps one more question please. Why is the LED so much
dimmer when the voltage source connected to the PC817 collector?

Thanks.

Allen in Dallas
The reason it's low is because you're not transferring enough current through the PC817. The datasheet states it only begins to transfer more than 50% at 5mA on the base.

1610310458621.png

12-1.3 / 10000 = I
10.7 / 10000 = I
0.001.07mA on the base is where you're above schematics are at.

Instead, try using a 4N35:

1610310662901.png
 
Top