Using IRL540N to control 5050 LED strips (12v powered) - "Burning" pi GPIO internal pullup/pulldown?

Hi!

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.


Hi,

"burning", what do you mean?
What have you got as your 12V supply for the LEDS?

Can you post schematic of Pi with cap sensors please.

Thanks.. Tom... :smiley: :+1: :coffee: :australia:

Hi Tom!

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.

Hi,
Thanks for the info.

What cap sensors are you using on the Pi, can you post a schematic?

Tom.... :smiley: :+1: :coffee: :australia:
PS. I'm off to bed, very very late here... :sleeping: :sleeping: :sleeping: :sleeping:

Hey Tom!

I'm currently using AT42QT1070 as a sensor.

Here are the schematics:

Full schematic:

Thank you for your support, hope you'll be able to share some insights after some good sleep! :slight_smile:

Cheers!

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.

Thanks, @jremington! I'll add those current limiting resistors. Thanks!

My guess is that ESD IS 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).

@DVDdoug Thanks for your reply!

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. :confused:

If a series 150R resistor is added, it should be located between the gate and 1k.

In fact change 1k to a higher value too, ~10k .

I would be very surprised if ESD, or a malfunctioning power supply is not the problem.

Except for the missing current limiting resistors, there are no obvious problems with the schematic diagram. (The wiring and PCB are separate issues).

@LarryD Could you explain why a 10k resistor instead of a 1k?

@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?

The 1k/10k is used to hold the MOSFET OFF during the time when the Arduino pins are set to INPUT i.e. during power up.

After this time, the sketch makes the pin an OUTPUT which will be either HIGH or LOW.
From here on, the 1k/10k is not needed.

If you leave the resistor at 1k, it will consume 5v / 1k = 5mA of current when the pin is HIGH.

If you use a a 10k resistor, it still is effective at power up time, but consumes only 5v / 10k = .5mA, 10 times less than the 1k.

1 Like

Use an oscilloscope to examine all parts of the circuit for electrical noise, unexpected voltages, etc.

@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?

Thanks @LarryD, its pretty clear now. I'll "upgrade" the resistors.

Hi,
Why are you powering the cap sensor from a Pi output?
What current is drawn by the cap module?
What is the current rating of the Pi output?

Thanks.. Tom... :smiley: :+1: :coffee: :australia:

Hey, @TomGeorge! Welcome back!

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.

It has been pointed out to me ("Burning" pullup/pulldown internal resistors using IRL540N to control 5050 LED strips (12v powered) - Raspberry Pi Forums) that, according to the datasheet, it would be recommended to add 4k7~20k resistors in series with cap sensor outputs in order to mitigate ESD, even though it seems that it wouldn't explain how the cap sensor board would damage the PI GPIOs.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.