1
\$\begingroup\$

I plan to power some WS2812 NeoPixel LEDs via an external 5 V wall adapter and use an Arduino Nano for data only, but Adafruit (NeoPixel vendor) mentions:

If powering the pixels with a separate supply, apply power to the pixels before applying power to the microcontroller. Otherwise they’ll try to power “parasitically” through the data line, which could spell trouble for the microcontroller.

They also suggest a 300 - 500 Ω resistor on the Arduino's data pin and the data input on the first LED to help prevent voltage spikes.

How do I work around this constraint so that I don't always have to remember to first plug in my 5V and then plug in the USB to the Arduino? I would like to be able to plug in the Arduino before the 5V.

\$\endgroup\$
4
  • \$\begingroup\$ Doesn't the 300-500 ohm resistor already protect from the MCU giving power via IO pin to the LED input? The datasheet does not state how much clamping current the input pin can tolerate though. Can you simply make the MCU to detect when LEDs are powered up, \$\endgroup\$
    – Justme
    Aug 14, 2022 at 22:38
  • \$\begingroup\$ A brute force simple solution would be to use a small relay powered from the Arduino’s supply and switching the led strip data line. Another suggestion might be to use something like a 1N4004 diode from the led strip 5V to the Arduino 5V. When you power the led strip, the Aruduino gets powered as well. That might back power the USB which is probably not kosher but I’ve yet to have any ill effects. \$\endgroup\$
    – Kartman
    Aug 14, 2022 at 23:34
  • \$\begingroup\$ @Justme I'm not knowledgable enough to determine if that 300-500 ohm resistor does that job already but that's what I initially thought - they still state that warning "apply power to the pixels before applying power to the microcontroller." after recommending the resistor. \$\endgroup\$ Aug 14, 2022 at 23:58
  • \$\begingroup\$ @Kartman thanks, I'll need to research your relay idea more as I don't know enough to picture that in my head but seems straightforward. \$\endgroup\$ Aug 15, 2022 at 0:02

1 Answer 1

0
\$\begingroup\$

Add a series resistor to protect the MCU. Use a value that will not allow the maximum current rating of the MCU to be exceeded. I use MCUs with 3.3V I/O, so I have a voltage translate in-between, but it has the same issue. 3.3/20mA = 165 ohms. I use 180 ohms, but anything slightly larger would work also.

\$\endgroup\$
4
  • \$\begingroup\$ Does the 300 - 500 ohm resistor already do that? (It's in a series between the MCU data pin and data for the LED). \$\endgroup\$ Aug 15, 2022 at 0:05
  • \$\begingroup\$ Yes, the series resistor has several purposes. Any MCU pin that can drive a single LED will be fine driving into 300 ohms. \$\endgroup\$
    – Mattman944
    Aug 15, 2022 at 0:09
  • \$\begingroup\$ Thank you, so just to confirm my thinking, this issue is already solved for by the series resistor and their warning only applies if NOT using a resistor. They make it sound like the issue is still present even with the resistor. Would you agree with that? \$\endgroup\$ Aug 15, 2022 at 0:18
  • \$\begingroup\$ Yes, the resistor fixes both issues. \$\endgroup\$
    – Mattman944
    Aug 15, 2022 at 2:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.