I've seen plenty of 3v3 circuits that are 5v tolerant, but I'm wondering if I can make something that is 12v tolerant. Basically I have a numato 128 gpio expander and there are so many wires that one bad connection can blow a pin. I would like to make it so that any pin can turn 3v3 on and off or be an input but if 12v accidentally touches the pin I don't want it to blow up. The best I can come up with is possibly an optoisolator or a buffer like the cd4050. I'm having a hard time wrapping my head around how these parts work since I have never used them. Does this make any sense? Am I on the right track?
\$\begingroup\$
\$\endgroup\$
3
-
\$\begingroup\$ How fast do you need the input to switch? Can you accept that the protection circuit fries instead of the IO? \$\endgroup\$– pipeCommented May 9, 2020 at 6:46
-
\$\begingroup\$ @pipe It can switch slowly \$\endgroup\$– bob mcgrathCommented May 10, 2020 at 4:54
-
1\$\begingroup\$ Same idea as ESD diodes except that while the series resistor is optional for ESD, in this case you MUST add a series resistor to limit the current for the diodes since the events you expect to clamp can last for prolonged periods of time: electronics.stackexchange.com/questions/483959/… \$\endgroup\$– DKNguyenCommented May 10, 2020 at 5:03
Add a comment
|
2 Answers
\$\begingroup\$
\$\endgroup\$
5
If you don't need the 3v3 GPIO to drive something with large current, but just use them as voltage outputs, you can simply add a 10k resistor in series for each pin to ensure that the internal IO expander clamping diodes don't get burnt out when 12v are applied. Then you can usually connect a pin to a higher voltage for a short time without adverse effects ((12-3v3)^2/10k = 7.57mW on the clamping diode).
-
1\$\begingroup\$ or possibly put a outwards pointing diode parallel with the resistor if higher current is needed. \$\endgroup\$ Commented May 9, 2020 at 7:06
-
\$\begingroup\$ @Linards Will this only work for outputs, or will is work for 3v3 inputs too? \$\endgroup\$ Commented May 9, 2020 at 15:16
-
\$\begingroup\$ This works for both inputs and outputs. It's actually better when you use this technique on an input, since you don't waste as much energy on the resistor (though Jasen's mentioned workaround helps with output mode efficiency). I advise you to look at the internal schematic of the chip to see how my proposed solution works - it relies on your chip having internal clamping diodes that prevent and IO pin from going above VCC or below GND. \$\endgroup\$– LinardsCommented May 9, 2020 at 18:31
-
\$\begingroup\$ @Linards but is it bidirectional or will I have to decide if a pin is an input or an output? I have extra gpio expanders so if I go through the effort of protection my IO, I would like to be able to use the same solution on other projects. If not Ill just make due. \$\endgroup\$ Commented May 9, 2020 at 18:48
-
\$\begingroup\$ It depends on what you need to drive. A resistor is a passive unipolar device, it doesn't behave differently based on it's insertion direction, thus this works on inputs and outputs. If you need the output to provide larger currents, you can add an outward-directed diode in parallel to the resistor. \$\endgroup\$– LinardsCommented May 10, 2020 at 8:54