1

I'm trying to drive a 5V 200mA fan from a PCF8574 powered by 3.3 V. For context, I asked a separate question about using active low vs high on this expander, and @Justme recommended using a high-side PNP (instead of a low-side NPN with a PNP driver), driven low by the GPIO.

You could use a single 200 mA PNP transistor or P-FET as a high-side switch from the GPIO to drive the fan.

Note: JM said single PNP, inferring to me that the base would be connected to the GPIO, unless perhaps this wasn't considering the voltage difference?

A single PNP would be desirable as I'd like to reduce the number of BJTs in my circuit.

However, I read in an answer to a question about PNP high-side switching that you shouldn't connect the base of the PNP to a device which has a lower voltage, as you'll fry the device.

There is a temptation to think that we could do the same trick with an PNP transistor as shown in Figure 1b. The problem is that the emitter-base junction is always forward biased. This will apply the 12 V to the chip output and destroy it or, if there are protection diodes on the output, the current will flow through the protection diodes into the micro-controller supply (shown as 5 V in this case). The effect of this current flow is to turn on Q3 and the load can not be switched off.

So, should you insert an NPN between the PNP to protect the GPIO, as you would on a micro? I'm scratching my head here wondering if I'm missing something or if I'm misinterpreting JM's tip.

PCF8574 with high side PNP

ocrdu
  • 8,705
  • 21
  • 30
  • 42
Nick Bolton
  • 2,043
  • 8
  • 31
  • Note that *some* 3.3 V devices may have pins which are 5 V tolerant, so the single-PNP could work with those devices. Yet, such devices could also have a power-application requirement (3V must come up before 5V.) – rdtsc Nov 04 '22 at 18:55
  • If it is ever possible for 3.3 to be absent when 5 V is present, then you MUST use two transistors, otherwise the PCF8547's de-energized output will sink current and turn on the PMOS or PNP transistor. NOTE: I don't know what a PCF8547 is, but the vast majority of all electronic devices will sink current through their outputs when the IO voltage is not present. – user57037 Nov 05 '22 at 07:43
  • I would for sure use PMOS not PNP. Not sure why you are favoring PNP in this case. – user57037 Nov 05 '22 at 07:44
  • 1
    I strongly suggest that you use two transistors (preferably one NMOS and one PMOS). You can use BSS138 for the NMOS. For the PMOS, you want one with a low Rds(on) rating specified at Vgs = -4.5 V. In your case with a 200 mA load, I think you want Rds(on) to be 100 mOhms or something less. There should be lots of options. These transistors are pretty small. – user57037 Nov 05 '22 at 07:50
  • Another option is to power the PCF8574 with 5 V and use a level shifter on the I2C signals so that you can control the bus expander from a 3.3 V I2C source. Then you could use a single PMOS high side switch. – user57037 Nov 05 '22 at 18:06
  • What if R2 was high enough to block the voltage? Like in a common gate circuit. – Nick Bolton Nov 06 '22 at 10:59

6 Answers6

3

Yes, definitely insert the NPN transistor. Otherwise if you try to use the 3.3V GPIO the PNP base will leak into the GPIO and never turn off.

(Note: your diagram shows the GPIO being powered by 5V. I assume you meant for that to be 3.3V.)

hacktastical
  • 49,832
  • 2
  • 47
  • 138
  • Thanks for clarifying. Is there a way to use a single transistor in this scenario? Or is it always going to require either two on the high side or low side? Maybe there's a way to use a P-FET? Though how would I saturate the gate with only 3V3? – Nick Bolton Nov 04 '22 at 18:30
  • 1
    You not only have to prevent the leak path, but also guarantee that the base is biased fully off, which means above 4.3V (5V-Vbe). So you don’t have a choice, you need the NPN level shifter if you want to switch high-side. Low-side could use just the NPN. – hacktastical Nov 04 '22 at 18:34
  • Unfortunately, I can't just use an NPN (assuming you mean single low side NPN) since the PCF8574 can only source 300uA, and I need about 2.5mA to saturate the base. It can however sink 25mA. If you meant just use the NPN for the PNP base high side, then... ah, ok, if that's the way it has to be! – Nick Bolton Nov 04 '22 at 18:36
  • 1
    You don’t really need to saturate the base of the NPN because it’s driving another another base. But you can use a FET, like a 2N7002 or BSS138, instead of the NPN. – hacktastical Nov 04 '22 at 18:42
  • Would 3V3 be enough to saturate the gate with 5V at the drain? And would you put the FET high or low side? I guess low side N-FET would be fine if the gate saturates fully. – Nick Bolton Nov 04 '22 at 18:44
  • 1
    Yes. Both those FET types have Vgs thresholds of about 1.5V – hacktastical Nov 04 '22 at 19:08
  • Cool, and... high side P-FET or low side N-FET? Edit: I guess that's it's own question... I'll do some reading: https://www.baldengineer.com/low-side-vs-high-side-transistor-switch.html – Nick Bolton Nov 04 '22 at 19:20
  • 2
    It depends on the requirements of your load. If the load doesn’t have to connect any other signals then low side can work (like a two wire fan for example). Otherwise, high side is preferable. – hacktastical Nov 04 '22 at 19:25
3

If you can tristate the pin and it is 5v-tolerant*, it will work with just the PNP and a base resistor:

  • pin low turns the PNP on
  • pin high turns the PNP on
  • pin tristate turns it off

* as noted by mkeith, your bus expander is not 5V tolerant, so this will not work in this specific case.

tobalt
  • 18,646
  • 16
  • 73
  • The datasheet for the bus expander says that the output pins should be kept below VCC + 0.3 V. So if VCC is 3.3 V as the OP shows, then the pin is NOT 5 V tolerant. If VCC can be increased to 5 V, then all is well. But in that case, the inputs must be level shifted to 5 V too to insure correct logic levels. – user57037 Nov 05 '22 at 08:25
  • > "your bus expander is not 5V tolerant" -- thanks for highlighting this. Unfortunately, I learned this the hard way (before asking my question) and fried a couple of expanders. – Nick Bolton Nov 05 '22 at 11:27
2

Not a product recommendation, but in my case there are multiple loads to drive from the GPIO and the aim is to reduce the BOM, so I'm considering that using a Darlington array IC might be one approach.

Darlington array

Block diagrams

Gotcha: Watch out for the ULN2002; it has a 7V Zenner at the base of each Darlington, as it's "designed specifically for use with 14-V to 25-V PMOS devices" on the input. In other words, it won't work with low voltage (i.e. 3V3 or 5V) TTL at the inputs. I mistakenly ordered this part without realising, so to use this part in my circuit I'd have to use PMOS to drive the inputs, which in my case partly defeats the aim of BOM reduction.

ULN2002

(Image source: Texas Instruments ULN200x datasheet)

SamGibson
  • 17,231
  • 5
  • 37
  • 58
Nick Bolton
  • 2,043
  • 8
  • 31
  • `I'm considering that using a Darlington array IC might be one approach. .. Gotcha: Watch out for the ULN2002`: "(Jay:) No, Holden McNeil--what's important here is that " you seem to be having a lot of fun in this series of three posts, https://electronics.stackexchange.com/questions/641165/is-active-high-or-low-preferred-for-driving-loads-with-the-pcf8574/641267#641267, https://electronics.stackexchange.com/questions/641283/how-do-i-drive-a-10-v-high-side-pfet-with-only-3-3-v-logic, and **this.ref**. Congrats! – V.V.T Nov 06 '22 at 04:48
  • How deep can I dig? – Nick Bolton Nov 06 '22 at 07:27
  • 1
    dunno. Call 811 – V.V.T Nov 06 '22 at 09:16
1

Do the same as with the expander driving a LED from 5V. Same thing really.

I believe you wanted active low because IO expander defaults to high (under the specified conditions).

If there is 2V drop from Veb and something else to expander pin, it will work. High will be off and low will be on.

You can add a LED, or a few diodes. Transistor is a good idea too.

Justme
  • 127,425
  • 3
  • 97
  • 261
1

This is how I would do it. PMOS M2 should be chosen to have minimal voltage drop at your load current. I think your load current is 0.2 amps, right? So maybe we should specify that Rds(on) for M2 should be 100 mOhm or less. Often, power MOSFETs list Rds(on) at different gate voltages. We want to see Rds(on) of less than 100 mOhm at Vgs 4.5 volts. Sometimes for PMOS the datasheets say -4.5 Volts to kind of emphasize that it is PMOS and that the gate should be BELOW the source to turn it on.

The diode D1 is probably not needed. If the load is inductive or if there are long wires between M2 and the load, then D1 may be a good idea. It is to prevent voltage spikes when M2 is turned off. But most likely M2 will turn off so slowly that there will be no inductive spike in the first place.

schematic

simulate this circuit – Schematic created using CircuitLab

user57037
  • 28,915
  • 1
  • 28
  • 81
  • What's the advantage of using a high side PMOS instead of a low side NMOS in this case? Or, would either approach work fine? Does a high side PMOS introduce less resistance? – Nick Bolton Nov 05 '22 at 11:48
  • 1
    Low side can work, however, I have had enough problems with low-side switches over the years that I usually just go straight to the high-side whenever possible. The problem with low-side switches is that it is very easy to overlook some type of sneaky ground connection that bypasses your switch and causes your load to turn on or at least leak when you weren't expecting it. If you do a low side switch you can probably get away with just using one NMOS (but not the BSS138... it is not a good fit for a 200 mA load). – user57037 Nov 05 '22 at 16:55
  • Hmm, yes, sneaky ground shorts. Hence specialised high side load switch ICs. – Nick Bolton Nov 05 '22 at 22:26
  • You can use the ICs too. I always just use PMOS. – user57037 Nov 05 '22 at 23:11
0

It should be possible to switch a 5 V load using 3.3 V logic and a PMOS device with a gate threshold such that it is fully ON at 5 V and OFF at 5-3.3 = 1.7 V. I chose a MOSFET with Vto = 2.4 V. I added a voltage divider so that the output pin would never see more than 3.3 V, but that is optional.

PMOS Switch 3.3V to 5V

PStechPaul
  • 7,195
  • 1
  • 7
  • 23
  • possible yes, but given the large variation in FET threshold voltage, would require hand selection. – tobalt Nov 05 '22 at 07:08
  • 1
    This is playing with fire. You need something that is guaranteed to be on when Vgs = -3.3 V and guaranteed to be off when Vgs = -1.7 V, and then when you add in the other variations (like min and max for the 5.0 and 3.3 V rails including normal temperature variation) and it is very unlikely to work well. – user57037 Nov 05 '22 at 07:46
  • Actually I guess I stated it wrong. Guaranteed to be on when Vgs = -5 V. So not that requirement is easy to satisfy. I am more worried about finding something that is guaranteed to be off when Vgs = -1.7 V. All these little SOT-23 PMOS switches for high-side bus switching have very low gate threshold voltages, some as low as -0.8 V. – user57037 Nov 05 '22 at 08:07
  • I don't think the margins are that close. When the input is low, the gate voltage is -5V, which will turn on any logic level rated MOSFET. And when the output is high, the gate voltage is -1.7V, so a device with a threshold of -2V to -3V should work just fine. Once you choose a suitable device, the threshold should not vary all that much. – PStechPaul Nov 05 '22 at 08:10
  • The Vgs(th) must be above 2 V over temp and unit-to-unit variation AND Rds(on) at 5 V must be 100 mOhm or less. I am not confident both of those requirements can be satisifed in one transistor. But if so, then I agree. It will work. As long as 5 V is never powered when 3.3 V is absent. – user57037 Nov 05 '22 at 08:12
  • If the 3.3V logic input is missing (or tristated), the voltage divider will set the gate to -1.7V, so it will be off. – PStechPaul Nov 05 '22 at 08:19
  • Sorry for the back and forth. But most likely, the unpowered output of the bus expander will pull the gate down to one diode drop above ground. So in the absence of 3.3 V rail, the PMOS will turn on. – user57037 Nov 05 '22 at 08:23
  • 1
    Vgs(th) min for the Si7465DP is 1 V at 25 C. – user57037 Nov 05 '22 at 08:34
  • I stand corrected. Quite a few MOSFETs have minimum threshold voltages as low as 1 volt, even some like IRF7201 that have minimum typical curves starting at 3V. In fact, that spec shows only the minimum. Makes it rather difficult to design with such wide specs. I wonder how much variation is usually found? – PStechPaul Nov 06 '22 at 06:16