This post started out as a request for help, but I think I have figured out my problem. This post is therefore a cautionary tale and an attempt to provide a bit more info on the 5mm Neopixel LEDs.
My project consists of
- -A Trinket M0 for controlling the LEDs. Powered with 5V over USB.
-A level translator that converts the 3V signal from the Trinket to the 5V required by the Neopixels. The level translator is custom PCB with a SN74LVC1T45 chip and a few capacitors. I could not find a single bit level translator in a small form factor for this project. (New product idea for Adafruit ;) )
-A bunch of 5mm Neopixels. I intend to use 16-32 of them eventually, but for now, I am using only two for troubleshooting.
I have read the Uberguide (several times :P), and from what I can tell, the important bits are:
- -Attach a .1uF cap across each pixel's power pins.
-Attach a large capacitor (I am using 1500uF) across the power lines to the pixels.
-Attach a 300-500 ohm resistor between the microcontroller and the first pixel. I used a 470 ohm resistor, as I had it lying around. I ended up using a resistor between each LED. This may not be really required, but it seemed safer. More info on this below.
Code: Select all
import board
import digitalio
import time
import neopixel
def main():
pixel_pin = board.A4
num_pixels = 2
pixels = neopixel.NeoPixel(pixel_pin, num_pixels, brightness=0.2, auto_write=False, pixel_order=neopixel.RGB)
print("starting")
while True:
pixels[0] = (255, 0, 0)
pixels[1] = (255, 0, 0)
pixels.show()
time.sleep(1)
pixels[0] = (0, 255, 0)
pixels[1] = (0, 255, 0)
pixels.show()
time.sleep(1)
pixels[0] = (0, 0, 255)
pixels[1] = (0, 0, 255)
pixels.show()
time.sleep(1)
if __name__ == "__main__":
main()
After replacing the first LED, the signal appears to be correct.
Other things that I tried: Using different value resistors between the LEDs and the translator. Adding larger capacitors (10uF) across the power pins of the LEDs. Neither of these seemed to make a difference. However, as part of the testing, I tried running the system without the resistor between the level translator and the first LED. Upon examination with the scope, this was causing really high voltage spikes at the rising edges of the signal. I speculate that this is the cause of the damaged output driver of the first LED. It did not seem to affect the function of the LED, only the output. On a potentially related note, the level translator I am using has much higher drive strength than the one suggested by Adafruit (24mA vs 8mA). I assumed that higher drive strength would be better, but I am not sure if it would cause the spikes seen without the resistor to be worse.
Has anyone else seen this behavior before? Is there any way to fix this problem, or is that LED scrap?
The problem is intermittent, and I am not convinced that it is gone for good yet. I will update this post if it comes back...