Electronics > Projects, Designs, and Technical Stuff

Pi 3D printer low side switch -- protecting IO?

(1/2) > >>

microbug:
I'm using an N-channel MOSFET (IRL40B209) to turn my 3D printer on and off with a Raspberry Pi running Octoprint. The printer runs on 24V at up to 15A and the MOSFET switches the low side of the input to the printer mainboard (SKR Mini E3 V1.2 -- schematic. I'm connecting to RX2 and TX2.). The MOSFET gate is controlled by a GPIO pin that goes through a 3.3V to 5V logic shifter:

(BJT is a 2N3904).

This was all working fine, but when I connected the UART pins from the Pi to the printer board, the Pi got quite hot and died (red light but no green activity light, and nothing on HDMI). It's worth noting that Octoprint initialises the GPIO on startup so the UART pins were probably actively pulled low by the Pi.

My guess for the reason is that there are rail protection diodes inside the Pi's GPIO block and somehow the UART pins on the printer mainboard were connected to 24V when the board was off. The mainboard UART input goes straight into an STM32F103 on the mainboard (no external pull-ups). 3.3V is provided by an AS1117 powered from an AOZ1282 buck converter, which has a P-channel MOSFET inside it. Maybe the STM32F103 was sourcing 24V from its GPIO protection diodes and the Pi was getting it?

TLDR:
My Pi is dead. I have ordered two more. Is it worth persisting with this (e.g. putting 10k resistors on the UART lines to try and limit current, or any other suggestions you have) or is it just a bad idea all round to connect push pull GPIO to something powered from 24V while it's switched off low side?

microbug:
Doing some googling, perhaps I should just use a P-channel FET and switch it high side. I can use a resistor divider to keep Vgs from going too low.

langwadt:
use a relay on the high side instead

MarkR42:
Yes, Raspberry Pi IO pins are not very tolerant of too many volts or other problems, you will probably kill the chip if anything isn't quite right.

Suggestions: I like the idea of a relay on the high side, but you will probably need a mosfet to drive the relay (switch the low side of that, of course)

Also remember (I've been got by this before) that there are a few IO pins on the Pi which pull high at boot, which can't be overridden, so don't use those.

As another option, consider a usb serial dongle instead of the Pi's built-in UART, it's more hardware but will probably be more electrically robust.

Renate:
Yow! |O Switching low side!
If the power supply is grounded then when the low side switch is open then the "ground" (and various connections) out of the 3DP will be at +24V !

Navigation

[0] Message Index

[#] Next page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod