I cannot seem to get LEDStrips to work with the provided Code. Here is what I have tried so far:
- A set of NeoPixels from Adafruit
- A Strip of WS2813 LED from the Internet
- A different Strip of WS2812 LED from a different Vendor
I always test with a strip of 5 LEDs , but I have also tried the NeoPixels with a Strip of 4.
Tests were done on NodeMCU ESP-32S – on two separate boards from independent vendors
Tested with uPyCra V 1.0 and the v1.10 Firmware, both obtained from the Links in the Course
Whenever I run any variation of the Neopixel code on any other Pin than Pins 22 and 23 nothing at all happens.
On pin 22 and 23 the LEDs flicker in a random color pattern while loading the code on the board and running the boot sequence. After that, in the main.py , I run:
import machine, neopixel import time p=22 n=4 np = neopixel.NeoPixel (machine.Pin(p), n) #At this Point, the Strip is powered up in a random array of colors, so i run for i in range (0,4) np[i] = (0,0,0) np.write() sleep(1.0)
Every second there is SOME random color change in several LEDs of the strip, but they never turn off.
I have also tried several other color variations, working with the np.fill((0,0,0)) function, and setting the timing value in the .NeoPixel (Pin,int,timing) function to either True or False with no success.
I tried controlling the NeoPixel with a PWM input Signal with different frequencies and duty cycles. Every time i change frequency and/or duty cycle, there is a change in the strips color pattern.
This also works on other Pins than 22 and 23.
I refuse to believe that 3 separate vendors sold me defective NeoPixel Strips, or that both ESP32 boards from two different vendors should be defective. Even more so because the Problems are consist across boards.
Has anyone experienced similar Problems/sees what I am doing wrong/knows of an independent library to drive NeoPixels/knows of a way to troubleshoot this problem?
Or asked differently: has anyone successfully managed to get these things running ? If so, how did he do it?
I also dispose of an Arduino R3, an Arduino Nano, and an STM32 board and intend to see if I can get any of the Strips running on a different board in the Arduino IDE as soon as I can, to see if the LED Strips really aren’t defective.
I have tried to troubleshoot this for hours now, any help would be greatly appreciated
It is very strange that you’re getting that behavior with different strips and with different ESP32 boards.
The codes we provided were tested by us. So, we know they worked at the time of publishing.
Also, I’ve just tested now, and it is working fine for me.
What is the code that you’re testing?
The code you’ve posted misses a : at the end of the for statement (it was probably a copy/paste problem).
Also, the last line should be:
Note that that the strips have a Data in and Data out. Please check that you’re connecting the data pin to the Data in of the strip.
The code you’ve provided works fine for me after adding the colon (:) (it puts the pixels off without problem).
Can you provide more details?
the time.sleep and the colon error where indeed mistakes I made while writing my post, as I was rewriting the code from the top of my head. The code running on the ESP32 was correct (though I did double Check today).
I tried the NeoPixels on an Arduino Uno R3 with the Fastled.h library and they work just fine.
Given that the code doesn’t seem to be the issue either, since it is working on your end, there are two possibilities remaining that I can currently think of:
-Both the ESP32 Boards I tested with are faulty
-The NeoPixels, which are designed for 5V aren’t responding properly to 3.3V logic levels
Looking into this topic I found this link to a post on the Adafruit Website:
This sounds a lot like the problems I have been having. To check if this is the case, I ordered a few logic level converters from amazon. These will probably arrive around the end of the week, so I should be able to pick them up and confirm if this is a possible solution to the issue at the latest by the end of this week if all goes well.
@Sara If this is the case however, I wonder what LEDs you are working with/ where you are sourcing these/what makes it so that it is working for you? Could you perhaps share pictures of your setup?
Since I intend to build quite a lot of these circuits, it would be really great if there was a way to get around using logic level converters, both space an pricewise, so I would still really like to get to the bottom of this.
The article lists to long of a wire connection or driving to many LEDs at once as possible reasons. However, I am driving only 5 LEDs and all that separates the ESP32 from the first Pixel is about 2 CM of copper wire and a two hole distance on a breadboard. I don’t think you can get much more minimalistic than that without hardwiring the Neopixels to the board.
Here is also a link to the Neopixels I am currently testing with:
As mentioned before, I also have two 5m ribbons of WS2813 an WS2812 LEDs respectively, which are showing the same issues. However, these were provided by chinese vendors, and the links to those are no longer available. However, they are exhibiting pretty much exactly the same behavior both on arduino and ESP32.
Since those strips are meant to be used in the final project, I do not want to cut them unnecessarily. I have a 5 LED Strip from each of those ribbons, but will limit any further testing to the 25 available neopixels and those two 5 LED strips until I have a suitable power supply available to test the entire 5m strip for defects.
What other details can/should I provide you with?
Hi again Ben.
What you described can be the issue. I know that the Strip needs a 5V signal. So, ideally you should use a level shifter. I’ve controlled these LEDs with and without level-shifter before, and they worked in both scenarios. So, we didn’t mention the level-shifter in our examples, to make the projects and instructions simpler.
In our “20 Easy Raspberry Pi Projects” book. We used an LED strip with level-shifter (but it also worked without it). The level shifter we used was one like this: https://www.ebay.com/itm/221919114584
In our projects, we control WS2812B LEDs from chinese vendors. The following are the ones that we used, test and that work.
Once you have your level-shifter, let me know if it solves the problem.
It works with the logic level converters, had to order two kinds though because I didn’t really know my way around these things. I really think you should include a section about this issue in the course, especially since you already are aware of the issue. Furthermore I’d imagine that total beginners to microcontrollers might not even know at all that there is such a thing as logic level shifters.
Since I have tested 3 different kinds of adressable RGB-LEDs, and it didn’t work for any of them, I really think this is a valid issue