As a precursor to creating a PCB using a Nano 33 IOT and which will have Neopixel LEDs on it I am breadboarding a prototype but got strange results when testing the Neopixels. Stripping the test program and breadboard back to basics I am left with
#include <FastLED.h>
const byte NUM_LEDS = 8;
const byte DATA_PIN = A0;
CRGB leds[NUM_LEDS];
void setup()
{
Serial.begin(115200);
while (!Serial);
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
}
void loop()
{
showLeds();
}
void showLeds()
{
for (int ledNum = 0; ledNum < NUM_LEDS; ledNum++)
{
Serial.print(ledNum);
Serial.print("\t");
leds[ledNum].setRGB(7, 0, 0);
FastLED.show();
delay(1000);
}
Serial.println();
for (int ledNum = 0; ledNum < NUM_LEDS; ledNum++)
{
leds[ledNum].setRGB(0, 0, 0);
}
FastLED.show();
delay(1000);
}
The strip of 8 Neopixels is powered from the 5V pin of the Nano 33 IOT, which has the solder bridge connected so that the 5V is supplied directly from the USB input. GND of the Neopixels is connected to the GND pin of the Nano and pin A0 is connected to their Data In pin via a 3V3 to 5V level shifter
Running the program mostly produces mostly the expected result in that pixels are lit red sequentially from one end of the strip to the other then are all turned off. However, quite frequently a pixel will not light, two will light at once or lit pixels will turn off when a later pixel turns on. As expected the printout of the array index looks perfectly normal
I am aware of Nano 33 iot and ws2812b - LEDs and Multiplexing - Arduino Forum and have the development version of the FastLED library installed which the Library Manager identifies as version 3.3.3
Things I have tried:
Deleting and reinstalling the board - no change
Driving the Data In straight from the Nano at 3V3 - no change
A different level shifter - no change
External 5V supply - no change
A different Neopixel strip - no change
Has anyone got any ideas as to the problem or better still a solution ?
More experiments
Added as 1K resistor between the level shifter and the Data In pin - no change
Substituted a standard Nano for the 33 IOT - works perfectly
It looks to me as though there is a timing issue when using the FastLED library and the Nano 33 IOT
Is the fastled an AVR only package ?
From FastLED Platforms
Supported Platforms
One of the goals of this version of the library is to lay the groundwork for making it more easily portable to a wide variety of platforms. At the moment, the library has only been tested and is known to work with AVR and ARM based MCUs that are nominally arduino-compatable. Namely, if the code is built/pushed using some variation of the Arduino application with stock compilers, the library should work. Future versions of the library will support a wider range of platforms and compilers.
Arduino - Pretty much all the official arduino platforms should be supported at this point, including the Due (as of FastLED2.1) and the Yún (as of FastLED 3.0.3) and the Zero (as of FastLED 3.1).
I have FastLED version 3.3.3
Unless I can find a solution soon I am going to put using the 33 IOT aside for my little project which was only a PCB to make connecting to and using the 33 IOT easier for testing in place of a rats nest of breadboard wires that I have at present. When I encountered the problem I thought that it was caused by the combination of the Neopixels, SD card and OLED that I had connected to the board and the sketch o support them, but stripping it back to just the Neopixels the problem persisted
Am I having fun yet ?
Hello UKHeliBob,
I was trying to be helpful and set this up myself but I can't seem to get the same errors as you do. I tried with driving a 12 pixel ring straight off the IoT and with a 5v power source with a 3.3v data and common ground and both seem to work... maybe this was fix between this short time?
Sorry I couldn't help more, I will keep it running for some more time to see if it happens.
Matt
Thanks Matt
What version of FastLED do you have ?
I installed it today to test it so 3.3.3 according to the library manager.
I have deleted my previous copy of 3.3.3 which was, in fact the development version rather than the officially released 3.3.3 version and I have installed it again from the Library Manager so I get the official 3.3.3 version this time
I will report back tomorrow when I have set up the hardware again
The official version 3.3.3 of FastLED has not improved anything so I will continue to look for the reason