Switchable pull-up resistors

Thread Starter

jwfx

Joined Jan 15, 2025
13
I’m working on a multi-function output for a device that needs to support both Wiegand (open collector, 0V to 5V with a switchable 1K pull-up) and RS-232 (-15V to 15V).

I’ve implemented the switchable pull-up and Wiegand functionality, but I'm running into an issue: when RS-232 drives -15V, Vce across the Wiegand NPN becomes -15V and a small current (a few mA according to the simulation) flows from the collector into the RS-232 transciever.

Is this safe for the transistor?

For a P2N2222A, the V(br)ceo is minimum 40V, but does this also apply in the reverse direction?

Here's the Circuit JS simulation I've been using: https://www.falstad.com/circuit/cir...x9A8bQjxIukb6Hv6Yk1nWDZsGKIBvjmRhJPhUgQBobBAA

Normally only either wiegand, wiegand + pull up or RS-232 will be enabled - RS-232 and wiegand (or pull up) will not be enabled simultaneously.

Thanks!
 

AnalogKid

Joined Aug 1, 2013
12,043
The switchable pull-up seems a bit complex. Why can it not be a single PNP transistor?

Also, is the control for it really a SPST physical switch, or a driven signal that pulls down to 0 V when off? Actually, that question applies to both switches.

AND - Reference Designators - !

ak
 

crutschow

Joined Mar 14, 2008
38,316
The switchable pull-up seems a bit complex. Why can it not be a single PNP transistor?
How would that work when the RS-232 output goes to +15V?
For a P2N2222A, the V(br)ceo is minimum 40V, but does this also apply in the reverse direction?
No.
The collector base junction will conduct with a negative voltage and turn on the BJT in the reverse direction.

You could add a Schottky diode in series with the collector to block the negative voltage.

If you don't want the forward drop voltage of the Schottky when the BJT is on, then you could use back-to-back, logic-level N-MOSFETs controlled by an PNP BJT in place of the NPN and diode (below):

1745934130145.png
 
Last edited:

Thread Starter

jwfx

Joined Jan 15, 2025
13
Also, is the control for it really a SPST physical switch, or a driven signal that pulls down to 0 V when off? Actually, that question applies to both switches.
The switchable pull-up and Wiegand signals will be driven by GPIOs on an RP2040. The pins are high-impedance on startup (leakage ~1 µA) until configured as outputs, at which point I can drive them high or low.

AND - Reference Designators - !
Circuit JS doesn't seem to support reference designators, but I've recreated the schematic in KiCad:
1745936205239.png
There will be two identical circuits: one for Wiegand 0 / RS-232 TX / RS-485 A, and one for Wiegand 1 / RS-232 RX / RS-485 B. The UART transceiver I'm using supports both RS-232 and RS-485.

You could add a Schottky diode in series with the collector to block the negative voltage.

If you don't want the forward drop voltage of the Schottky when the BJT is on, then you could use back-to-back, logic-level N-MOSFETs controlled by an PNP BJT in place of the NPN (below):

View attachment 348073
I didn't even think of that! It makes sense that using a bidirectional switch (like I have for the pull-up) would work here too, thank you!

Is there an IC that has any of this built in? I'm concerned about the number of discrete components needed for this (I'm aiming for this to be as compact as possible).

I did look at using an analog switch IC, but from what I can tell, I'd need to supply -15V/+15V to switch RS-232. Even if I just switched the Wiegand side (between the Wiegand and RS-232/485), it doesn't seem like I can find an analog switch that would be pleased with -15V/+15V on a disabled output.
 

crutschow

Joined Mar 14, 2008
38,316
Further thought:
You could use a PNP to replace the upper MOSFET pair as AK suggested, but also with an added Schottky diode in series with its collector to block the +15V from the RS-232 signal.

You could also eliminate the upper NPN if you can invert the control signal with 0V to the PNP base resistor turning it ON and 5V turning it OFF.

So the tradeoff in package count would be a dual-MOSFET with a BJT, or a BJT with a diode.
 
Last edited:

Thread Starter

jwfx

Joined Jan 15, 2025
13
Further thought:
You could use a PNP to replace the upper MOSFET pair as AK suggested, but also with an added Schottky diode in series with its collector to block the +15V from the RS-232 signal.
Ideally the pull-up is as close to 5V as possible to allow for longer cable runs (Wiegand sees anything below 4V as "low").

Here's the latest version:

1745947348512.png
And the simulation of it: https://www.falstad.com/circuit/cir...jmxGilOqrQJm0s20DJCX1eBbDbHoti9WIaxHjAkTgGwQA

Am I right in thinking that pull-up/down resistors are not needed on the MOSFET gates when using them back-to-back due to the body diodes providing paths to 5V (P-channel) and GND (N-channel) through the 10k resistors (R1 and R16)?

Thanks for the help with this, I feel like I've learned a lot :D
 

crutschow

Joined Mar 14, 2008
38,316
Ideally the pull-up is as close to 5V as possible to allow for longer cable runs (Wiegand sees anything below 4V as "low").
The Schottky diode only adds about a 200mV drop.
Am I right in thinking that pull-up/down resistors are not needed on the MOSFET gates when using them back-to-back
You don't need any additional resistors, if that's what you mean.
The pull-down to zero Vgs is actually the 10kΩ resistor between the MOSFETs' sources and gates.

Note that the WIEGAND signal is now inverted (+5V in is off) but I assume that's not a problem(?).

You could increase the value of R2 and R5 to 10kΩ since the collector current of those transistors is low.
 
Top