I wrote about this system before. But I will focus my questions now on “ESD protection” direction. I have an SPI based system in which a Raspberry talks with a GPIO expender device using SPI communication. The chip reads and/or writes ‘0’/’1′ and send it to the Raspberry by bus. Expander GPIOs ci…circuit-designraspberry-pispigpioesd
Eugenia SuarezUps! sorry I forgot drawing it, but there is a 100nF capacitor! so sorry!@Justme I’ve read a lot of literature about this the last 3 days, and one of the ways for protecting in front of just what you say: programming errors and inputs being configured as outputs, was R series. So I put series resistors at every GPIO pin. It has two functions: current limitation in case of mistakes and improvement against ESD. Someone suggested me to use from 10K up to 200K. But I know there is users that has been used 200Ohms when inputs have push buttons
tlfong01There seems some confusion. Let me clarify. (1) ESD usually destroys components when a human handling the components (a) before the component is inserted into the circuit, AND (b) the human is not earthed and he at the same time carries electrostatic charge. If your components are already in circuit, then there is no ESD problem. / to continue, …Perhaps you are talking about two other things: (1) power mains surge. When there is a black out because of mains overloading (what you say “over consumption”, too many air cons say) tripping over MCB. And when everybody switches on/off at the same time afterwards, there might be surges/spikes from building’s nearby sub station. These spikes might be over 220V’s peak and resets the Rpi. Usually there should be no harm to Rpi because it gets only 5V power from adapter, not directly from mains, / to continue, …And there is another thing called “back EMF”. If you are using Rpi to control inductive loads, like motor, solenoid or fan, perhaps by using 5V relay or SSR. Then when switchin off (a) the relay, and/or (b) the motor or solenoid, there might be a back EMF which is a voltage spike, sometimes a couple of time of the original power supply, causing current flow back to the Rpi’s circuit. This back EMF is usually minimized by using (i) “flyback” diode, (ii) optoisolation circuits. But the spikes might travel through the ground lines and trigger/reset the Rpi. / to continue, …And “latching up” is another thing. Take Rpi for example, if one Rpi GPIO pin is in input mode, and the GPIO pin is connected through a series resistor to a 5V source. Then there is a 5% chance that “latching up” might happen, frying the Rpi’s GPIO pin circuit, or shortening the Rpi’s life. / to continue, …To get a rough idea of “latching up”, you might like to read my answer to the following question: (1) “Rpi3 might have been fried by wrongly connected DHT11 temparature sensor – Rpi SE Latching up Q&A”: raspberrypi.stackexchange.com/questions/96560/…. Cheers.some random comments. (1) If you are using MCP23S17, then you are using Rpi’s MOSI, MISO, CS to talk to MCP23S17. If what you are referring as GPIO, are MCP23S17’s GPIO pins, then don’t worry, because any spike, back EMF stuff will first fry MCP23S17, and Rpi hiding behind should be “safe”. (2) Usually when a Rpi or MCP23S17 GPIO is in output mode, and you want to protect it from shorting to ground, or shorting to another GPIO output pin and so they are fighting each other, then the usual trick is to use a series resistor, say 330R or 470R. / to continue, …Using 10K is OK if your GPIO is to control a MOS device with high impedance input. But if the device is BJT, then the biasing resistance is usually 220R to 1k, then using 10k series to protect GPIO is a bit overdoing. Just casually talking aloud, my apologies for the typos. Ah, bed time. See you tomorrow.Ah, I forgot that your Rpi also uses GPIO pins to set the address pins (A0 to A2) of the MCP23S17, but that should not cause any problem. A safe way is just tie those A0 to A2 pins direct to Vcc and/or Ground. Cheers.(1) One more thing, about the MCP23x17 reset pin. When playing with MCP23x17, I found that the chip from time to time go crazy, and I need to push the manual reset button which I install because I find very useful in debugging. I do suspect that MCP23x17 is very noise sensitive, so might go crazy if your SPI/I2C connecting wires are very long (> 60cm). (2) Another thing is that I find it a good idea of not connecting MCP23x17’s interrupt pin direct to Rpi. Instead you use Rpi to loop the MCP23s17 interrupt status registers. Cheers.
Eugenia Suarez@tlfong01I’m afraId that human users will do the wires connections. So according to you ESD could be happen easily. Is it?@tifong well, as I said MCP GPIOs OUTPUTS will write ‘0’ and outputs could be wire-connected to the MCP GPIOs inputs (detecting contact between two wires connection) or not (not connected to anything = detecting isolation between two wires). Inputs will be connected to outputs. So, despite a single pole wires it is a CMOS technology. For sure, every chip address will be the same during the entire life cicle so I will configure them by VCC and GND. We don’t need INTs for our application. And my last comment: continue..is that something was triggering the overheating after working fine during hours and most of people says to me that it seems a latch up due spikes or ESD. When I have 1uF capacitor within VDD-GND it happened twice. Suddenly started getting too hot, consumptions goes from 3W to 6W (so seems a short circuit consumption). It only stops when MCP reset is done (it is one of the things that happens when latch up occures). I changed 1uF for 100nF and it seems not to happen after 2 days working. The cause of triggering the undesired situation is unknown for me. Thanks a lot for your time@tlfong01 I want you to clarify one more thing: When I talk about GPIOs I’m not refering to Raspberry GPIOs, so I mean MCP device GPIOs. Overheating is happening to MCP device and I would like to prevent my PCB components going fryed. System needs not to easily fail at this way.
tlfong01(1) About ESD thing. You might have noticed that the vendors usually ship components in metallic plastic bags, and also on metallic sponges. That is for anti static. The operators in the assembly and testing factories wear antistatic writs bands like this: “AliExpress Adjustable Anti Static Bracelet PVC Wrist Electrostatic ESD Discharge Cable Strap Hand with Grounding Wire”: aliexpress.com/popular/ground-strap.html. I am a hobbyist playing with cheap components, and I never bother, because the chances of catching the ESD virus is very very small.It is in the old days when electronic components were expensive that people bothered. Or you stay in a very dry country, wearing poly/plastic/nylon clothes then you need to bother. Of course everybody has a chance of struck by lighting. Perhaps you should google further for a piece of mind.(2) I always recommend newbies NOT to use the Rpi’s 5V or 3V rail to power MCP23S17 or other peripheral devices, but use an external power supply, at least for prototyping stage. This way, if MCP23S17 gets crazy, the Rpi still sits happily. So I just manually reset MCP23S17 and no need to reset Rpi, the shows goes on.(3) What you are saying about overheating is a bit worrying. MCP23S17 cannot handle big currents. I usually use buffer chips to handle big currents. If you are overloading all the 16 GPIO output pins with big current, then you will be in big trouble. Let me check the MCP23S17 datasheet to confirm. I will be back in a minute. BTW, I am a bit long winded, so let us go to the chat room and carry on later.Just now I skimmed the datasheet and made a summay: “MCP23S17 / MCP23017 Datasheet – MicroChip”:
(1) Total power = 700 mW
(2) Max current VSS pin = 150 mA
(3) Max current into VDD pin = 25 mA
(4) Input clamp current = ±20 mA
(5) Output clamp current = ±20 mA
(6) Max output current sunk by any output pin = 25 mA
(7) Max output current sourced by any output pin = 25 mASo you see, if you load 6 GPIO pins with 25mA, then total current is over the Vss pin 150mA limit. I usually the 8 big guy chip ULN2803A to do all the heavy work:ULN2803A Darlington Transistor Arrays – TI
https://www.ti.com/lit/ds/symlink/uln2803a.pdf?ts=1596094372948&ref_url=https%253A%252F%252Fwww.google.com%252F. Each of the 8 big guys can handle 500mA, …Ah, coffee time. So see you later. Cheers.