First of all, I'm sorry for the generic topic title but i'll elaborate more about the project so you can understand the context: I'm developing an interactive circuit inspired by the "Simon" electronic game. Most of computing is done by a Raspberry pi, 4B that is responsible for dealing with the inputs from the touch sensor ( AT42QT1070), displaying graphics, playing sounds and all the logic behind the gameplay. This RPI4 is connected to an Arduino Nano using its USB port and communication is made using pyfirmata (Pi side) and firmata (arduino side). Arduino, on the other hand is responsible for controlling 5050 LED Strips. Basically, Arduino receives the proper command from serial and turns on and off the LEDs.
Even though everything seems to work fine: LEDs go on and off as expected. Suddenly the same GPIOs I'm using to connect the touch sensor on the PI are burning their pullup/pulldown capabilities and it seems that it often occurs when inputs fed to the pi are higher then 3.3V, but the sensor is powered up by the rasp itself (from 3.3V port). So, I've rulled out the possibility that the pi could be providing significant higher voltage than 3.3V to itself.
Since the LEDs work on 12V and interface with the Arduino through a IRL540N I'm wondering if it is possible that somehow current is flowing back to the Pi through the USB port. It is important to remind that the only connection between RPI4/Sensors and Arduino/LEDs is a USB cable. I'm running out of ideas and would appreciate any hints or tips about what could be causing the problem and how could I test/solve it.
So far, I'm considering as causes:
Voltage "flowing back" to the PI from the Arduino;
IRL540N malfunction;
Ground shared between different voltages;
PCB bad design;
Possible solutions:
Use a USB isolator;
Isolate grounds for each different voltage;
Change IRL540N;
Am I going in the right direction? How can I debug this?
Cheers!
P.S: It might be irrelevant but one or twice I've touched the sensor input pins and felt a little tickling like a small electric discharge of a capacitor or like electrostatic discharge.
Thanks for your quick reply. By "burning" I mean that PI loses its capability of enabling its internal pulldown/pullup resistors on those pins. As a reference, I've runned the tests proposed here GPIO Internal pull_up stopped working suddenly - Raspberry Pi Forums and failed GPIOs were reported (as you can see in the last image in the main post).
For 12V supply I have a regular 12V 5A power supply.
At turn-on, the gate capacitance of a MOSFET acts initially like a dead short to logic outputs, so you need current limiting resistors between the Nano outputs and the gates. Typical value would be about 150 Ohms.
That does not address the problem of Pi ports burning out.
My guess is that ESDIS the problem. You walk across the carpet (etc.), your body develops a very-high voltage charge and then when you touch metal (or circuitry) you get a discharge and sometimes a shock and a spark. Electronics can be damaged by a discharge that's too small to feel or to make a spark. But, a capacitive-touch input should have built-in protection from that! (You'd still get a discharge and maybe a spark but the circuit should survive.)
Otherwise, you shouldn't touch the Raspberry Pi or the Arduino, or any of your circuity if you are not grounded.
Note that ESD is very-short one-time event (until another charge builds-up). If you are getting a continuous tingle, that's leakage from the AC power line and your power supply is defective and possibly dangerous!
I have a story about that... When I was in high school my mom said she was getting a tingle from the waffle iron. I didn't feel anything but I was wearing sneakers and I knew about electricity so I knew my sneakers might be making a difference... So I reached-over and momentarily touched the water faucet with my other hand... "Blam!" Big jolt through my chest! And I said, "That was stupid!"
I have an Arduino that "died for no reason" and that was probably ESD. I was working on it and it wasn't in a box or anything. I try to touch-ground before touching the circuitry but I don't have a proper ground strap at home. (Good habits but not good practices.) At work, we have ground-straps for our shoes which have to be tested every morning (I actually have ESD-safe shoes) and special conductive floors as well as wrist straps (which I rarely use).
In fact, I think that above mentioned tingle events were due to ESD, but I don't believe that this is the cause of RPI electronic failure. "User touch" is mostly done using plastic covered wires and not directly into the metal terminals, so there is some kind of insulation involved.
For instance: I've tried 2 different 12V power supplies (same specs) and have 2 RPIs with the same problem laying on my bench! When the first one was fried I've changed RPI and power supply and then second PI is "gone" as well.
@jremington ok then, let's assume ESD is the problem. I've already used 2 different 12V power supplies and had the same result with 2 RPIs. Arduino is powered by USB and PI powered by 5V USBC. Which of the power supplies could cause this harm? How to test it? How to solve it?
@jremington ok, I don't have an oscilloscope in hand right now but I'll se what I can do. Would you suggest any preventive changes in the project to mitigate ESD matter?
Well, I'm using a PI output because sometimes the sensor gets weird and I need to "reset" it by turning it off/on again (reset pin is not present at adafruit board).
It seems that PI is able to provide a max of 16mA per GPIO output (even though its not recommended to source that from multiple pins at the same time) and the cap sensor (https://cdn-shop.adafruit.com/datasheets/AT42QT1070.pdf) would draw less than 16ma.