PNP/NPN detection circuit

Hey Bob.

Apologies for the late replayed I’ve been away on holiday.

Came back with fresh eyes and decided to measure the current through the LEDs and I can confirm there is no current flowing without an input.

You are likely correct that the small current I seen was being used by the comparator and other areas possibly.

Needless to say I’m happy the first design without R9 and R10 work exactly how I want it to.

I have since removed the LEDs and inserted some optocouplers which are connected to an Arduino with OLED

Thanks again for your help.

2 Likes

Hi Larry
All good. If you are not inclined to follow up the R9 and R10 behaviour that is OK. Be aware though tat with very high impedance inputs left floating you might experience the occasional strange happening from time to time.

Fitting R11 and R12 should get rid of any minute LED illumination. If you replace the LRDs with Opto Couplers you might get some intermittent strange switching as some of these couplers are pretty sensitive and operate with very small currents.
Cheers Bob

1 Like

Good call on R11 and R12 to kill that minute LED glow. It’s always those tiny leakage currents that drive you crazy during testing! If Larry does switch to Opto Couplers later, he’ll definitely want to be careful with that sensitivity Bob mentioned—intermittent switching is the worst to debug.

1 Like

These 3-wire 24 V sensors are a bit tricky because the output is never really floating, it’s always sitting at +24 V or 0 V. That’s why simple LED circuits keep half-working even when nothing’s detected. Instead of high/low, has anyone tried just checking whether the output source is PNP (current sinks) or NPN (current sources) and seen both LEDs stay off when idle?

1 Like

Hi Olivia

I think you have the NPN and PNP action reversed.

NPN is current sinking. Open collector/drain. You can actually “OR” several sensors by connecting the outputs together creating a “Wired OR” situation..
A pull up resistor (load) to an external source is required; Output is LOW active.

PNP is voltage sourcing, ie; high side switching. For a similar “OR” situation you need a diode in series with each “output”.
The internal voltage is supplied at the output when active ; Output is HIGH active
Cheers Bob

2 Likes

Thanks a lot for the correction and the clear explanation, Bob. I appreciate you sharing the details it’s really helpful and clarifies the NPN vs PNP behavior well. Cheers!

1 Like