Is low side switching susceptible to accidental grounding through MCU?

Just an electronics theory question.. maybe a silly one. My knowledge of electronics is really at a beginner level so please be gentle :slight_smile:

When controlling peripheral devices on a circuit with low side (ground) switching using a P MOSFET, is it possible for the switching circuit to become grounded accidentally from the MCU BY GPIO pins being used for I2C or SPI communication?

If this can potentially be a significant problem what can be done to prevent it.. happy to be pointed toward informative doc's etc. Just not finding anything on google on my own.

Thanks.

Use an N MOSFET for low side switching, and make sure that it is logic level.

You always have to be careful about accidental contacts between adjacent pins.

Use insulated connectors or carefully solder all connections and before powering up, check for solder bridges or other short circuits with a magnifying glass.

The danger is phantom powering through other pins. If you disconnect 0V from a device and it has other connections that ultimately go to ground then the device will quite likely get a ground connection through the other pins and their protection diodes. If you are switching the power to any device you have to be very aware of what you are leaving connected and consider if it might provide an alternative route for the power into the device.

And yes, low side with N channel MOSFET, high side with P channel MOSFET.

We are sure you know what you are talking about, we do not.

Please, always supply a schematic so we can see what exactly you are referring to.

Most MOSFET switching circuits include a gate resistor to the Arduino, we have one point of isolation there.

mdwelch:
When controlling peripheral devices on a circuit with low side (ground) switching using a P MOSFET, is it possible for the switching circuit to become grounded accidentally from the MCU BY GPIO pins being used for I2C or SPI communication?

Not unless you mean the switched circuit - the switching circuit does the switching, the switched circuit is
controlled by it.

Yes phantom powering is always an issue with a switched circuit, whether its high-side or low-side switched, you
have to ensure that any shared signals are parked in the correct state before powering down (or, best of all,
simply floated).

low side switch = NPN or n-FET
high side switch = PNP or p-FET.
common-emitter/common-source configuration.

Thanks for all the clear explanations.

Will take a few days before I have some spare time to make some schematics. Would be great to get some feedback on them.

All the best!

This is along the lines of what I'm doing. Hopefully it's fairly clear..

Would appreciate some feedback.

Thanks!

About the HX711.
It draws <1uA in power-down mode (PD_SCK pin high), so why switch it's ground pin.

The ESP32 is a 3.3volt processor.
You must use a HX711 board with separate 5volt analogue and 3.3volt digital supply, like the one from Sparkfun.
Or separate/cut the two supplies on the board yourself.

RFID reader? No experience.
SPI and I2C :o
MOSI accidentally connected to VCC? :o

9volt connected to the V-in pin of the ESP32 board :o
That will fry it's 3.3volt regulator.

RFID powered from the same 3.3volt supply? :o

R2 to 3.3volt? :o

I think you need to take a few steps back and start with powering that ESP32 board from a 5volt cellphone charger, connected to the USB socket (not 9volt!).
Then get (or mod) a HX711 board with two supply connections, and power it's analogue part from the 5volt pin of the ESP and it's 3.3volt logic pin from the 3.3volt pin of the ESP.
See if you can get that working before you move on to the RFID module.
Leo..

Hi,

Thanks for your reply.

I'm having major power issues when the EPS32 initiates wifi. With other devices connected to either vin(5v) or 3.3 v from the ESP32 and the board powered via USB it works fine. As soon as I switch to an external power source, I get brown outs and resetting. That's why I'm trying to isolate all of the other components and power them up after the ESP32 is stably connected.

Ive had all of the devices working fine powered through the USB cable and the project was essentially finished until I tried to power it externally, so I'm now tying to wrestle with the best way to do this.

This is actually the first schematic I've made and as you've pointed out theres a few issues :slight_smile:

Wawa:
About the HX711.
It draws <1uA in power-down mode (PD_SCK pin high), so why switch it's ground pin.

The ESP32 is a 3.3volt processor.
You must use a HX711 board with separate 5volt analogue and 3.3volt digital supply, like the one from Sparkfun.
Or separate/cut the two supplies on the board yourself.

Thanks for the info regarding power down mode. It's good to know and I might try to utilize that instead of having the HX711 switched through GND. I actually do have the module that uses 5V VCC and 3.3V logic. I just used the wrong one in the schematic because I was foolishly trying to rush :confused:

Wawa:
RFID reader? No experience.
SPI and I2C :o
MOSI accidentally connected to VCC? :o

Thanks for picking up the MOSI/VCC crossover. My mistake. What is wrong with using SPI and I2C? The module appears to be working well when powered through USB. Is there a potential issue there I should be careful of?

Wawa:
9volt connected to the V-in pin of the ESP32 board :o
That will fry it's 3.3volt regulator.

I'll admit I wasn't too sure about this one. I've read that the onboard regulator can handle up to 20V on vin, but was a little apprehensive about jumping so high (The board is the Esp32 DevKitC WROOM 30pin). I'm waiting on an adjustable power supply so I can start the voltage at 5-6V and crank it up if necessary.

Wawa:
RFID powered from the same 3.3volt supply? :o

It's been working perfectly of 3.3V pin when powered through USB

Wawa:
R2 to 3.3volt? :o

Oops.. This should be connected to GND right... Thanks!

Wawa:
I think you need to take a few steps back and start with powering that ESP32 board from a 5volt cellphone charger, connected to the USB socket (not 9volt!).
Then get (or mod) a HX711 board with two supply connections, and power it's analogue part from the 5volt pin of the ESP and it's 3.3volt logic pin from the 3.3volt pin of the ESP.
See if you can get that working before you move on to the RFID module.
Leo..

Appreciate your advice. As I said I'm just having major dramas getting this project powered externally. I'm hoping if I can get this low-side switching circuit working properly I can get this project deployed and learn a hell of lot in the process :slight_smile:

5-3.3=1.7volt, 9-3.3=5.7volt.
With 9volt on V-in, the 3.3volt regulator has to dissipate more than three times what the board is designed for.
It will most likely shut down and reboot (if you're lucky) because the regulator is getting too hot.
More so during WiFi traffic.

What's wrong with a common 5volt cellphone charger with micro-USB lead.

Must have a closer look at a 30-pin ESP32 (have one), but you can most likely tap 5volt (when on USB supply) from the board for the other devices.
RFID will use a bit of current when a card is presented. Not sure how much.
Post a link to the module used.

Make up your mind how you talk to devices.
I2c or SPI.
Can't do both.
Leo..

When powered through the USB port I do indeed supply 5V from vin to the LCD-I2C module and the hx711 with no problems. Also with the power supplied this way there doesn't seem to be any brown-out issues. This only occurs when I supply external power through vin.

I tried with a brand new 5v/3A power supply and I still get the voltage drop issue and the MCU just resets when it initiates the WiFi adapter (It's a known fault with this module). I was working on the assumption (perhaps naively) that If I can provide a higher voltage on vin (7-9V), I might be able to buffer against the voltage drop.

In regards to comms, I didn't realize concurrent SPI and I2C communication is likely to cause problems.. I certainly haven't noticed any strange behavior by these modules, but haven't done any stress testing as I don't really know how. Time for some more reading..

Thanks Leo

An ESP32, compared to the ESP8266, needs a much better (short/fat) USB lead because of the higher current drain.
Same if you use a cellphone supply or external power to V-in.
Thin wires and/or bad breadboard could stuff things up.

A higher voltage is not the solution.
It is likely adding a problem to another problem.

Try a 470uF electrolytic capacitor from the 3.3volt pin to ground, close to the board.
That will help the build-in 3.3volt regulator bridge the current spikes during WiFi traffic.
Leo..

I've tried 470uF electrolytic on vin and GND to no effect already. Will try on the 3.3 and GND and see if it's Smith's things it as you say.

I'll report back soon