Nano 33 BLE does NOT work with Adafruit_NeoPixel

Tried 2 separate Nano 33 BLE Rev 2 with same code and even tried different pins. The NeoPixel would not follow the data signal, just a very high bright white. Was using example strandtest code, which I included. My plan was to use the FastLED library, but the code wouldn't complile and later learned that the Nano 33 BLE isn't compatible with the FastLED library (per FastLED GitHub) for unknown reasons. So I switched to AdaFruit library and just so I could learn the syntax, picked an relatively easy example so I could learn. After a day of trying, I tried a regular Nano and it worked perfectly. Code below. Please inform your customers of this issue and in the meantime work to resolve it. I purchase 4 of these and a central part of the project is controlling the leds on the NeoPixel Jewel and 2 rings. I'm down to a week before the project is due and now I have to rethink everything including bluetooth since the Nano doesn't have bluetooth. Dilemma. Hopefully this is something that has been seen in the past and there is a fix? Please advise. Thank you.
Note that I do have a level shifter from 3.3 volts to 5 volts for the data line. Power to the NeoPixel was coming off the 5 Volt bus.

#include <Adafruit_NeoPixel.h>
//#include <Nano33BLE_System.h>
//#include <VolAnalyzer.h>
//#include <ArduinoBLE.h>

#ifdef __AVR__
  #include <avr/power.h>
#endif

#define LEDPIN 3


// Parameter 1 = number of pixels in strip
// Parameter 2 = Arduino pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
//   NEO_RGBW    Pixels are wired for RGBW bitstream (NeoPixel RGBW products)
Adafruit_NeoPixel strip = Adafruit_NeoPixel(7, LEDPIN, NEO_GRB + NEO_KHZ800);

// IMPORTANT: To reduce NeoPixel burnout risk, add 1000 uF capacitor across
// pixel power leads, add 300 - 500 Ohm resistor on first pixel's data input
// and minimize distance between Arduino and first pixel.  Avoid connecting
// on a live circuit...if you must, connect GND first.

void setup() 
{
  
  strip.begin();
  strip.setBrightness(50);
  strip.show(); // Initialize all pixels to 'off'
}

void loop() 
{
  // Some example procedures showing how to display to the pixels:
  colorWipe(strip.Color(255, 0, 0), 50); // Red
  colorWipe(strip.Color(0, 255, 0), 50); // Green
  colorWipe(strip.Color(0, 0, 255), 50); // Blue
//colorWipe(strip.Color(0, 0, 0, 255), 50); // White RGBW
  // Send a theater pixel chase in...
  theaterChase(strip.Color(127, 127, 127), 50); // White
  theaterChase(strip.Color(127, 0, 0), 50); // Red
  theaterChase(strip.Color(0, 0, 127), 50); // Blue

  rainbow(20);
  rainbowCycle(20);
  theaterChaseRainbow(50);
}

// Fill the dots one after the other with a color
void colorWipe(uint32_t c, uint8_t wait) {
  for(uint16_t i=0; i<strip.numPixels(); i++) {
    strip.setPixelColor(i, c);
    strip.show();
    delay(wait);
  }
}

void rainbow(uint8_t wait) {
  uint16_t i, j;

  for(j=0; j<256; j++) {
    for(i=0; i<strip.numPixels(); i++) {
      strip.setPixelColor(i, Wheel((i+j) & 255));
    }
    strip.show();
    delay(wait);
  }
}

// Slightly different, this makes the rainbow equally distributed throughout
void rainbowCycle(uint8_t wait) {
  uint16_t i, j;

  for(j=0; j<256*5; j++) { // 5 cycles of all colors on wheel
    for(i=0; i< strip.numPixels(); i++) {
      strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));
    }
    strip.show();
    delay(wait);
  }
}

//Theatre-style crawling lights.
void theaterChase(uint32_t c, uint8_t wait) {
  for (int j=0; j<10; j++) {  //do 10 cycles of chasing
    for (int q=0; q < 3; q++) {
      for (uint16_t i=0; i < strip.numPixels(); i=i+3) {
        strip.setPixelColor(i+q, c);    //turn every third pixel on
      }
      strip.show();

      delay(wait);

      for (uint16_t i=0; i < strip.numPixels(); i=i+3) {
        strip.setPixelColor(i+q, 0);        //turn every third pixel off
      }
    }
  }
}

//Theatre-style crawling lights with rainbow effect
void theaterChaseRainbow(uint8_t wait) {
  for (int j=0; j < 256; j++) {     // cycle all 256 colors in the wheel
    for (int q=0; q < 3; q++) {
      for (uint16_t i=0; i < strip.numPixels(); i=i+3) {
        strip.setPixelColor(i+q, Wheel( (i+j) % 255));    //turn every third pixel on
      }
      strip.show();

      delay(wait);

      for (uint16_t i=0; i < strip.numPixels(); i=i+3) {
        strip.setPixelColor(i+q, 0);        //turn every third pixel off
      }
    }
  }
}

// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
  WheelPos = 255 - WheelPos;
  if(WheelPos < 85) {
    return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  }
  if(WheelPos < 170) {
    WheelPos -= 85;
    return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  }
  WheelPos -= 170;
  return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
}

What voltage do the LEDs work at, how are they powered and what voltage does the Nano 33 output ?

I would be interested in seeing a schematic of your project

.. technically, what responsibility does the Arduino company have to ensure compatibility with a third-party library with its board? These are outside people coding the FastLED library. It's not an Arduino official library.

And if Adafruit_NeoPixel works but FastLED doesn't, then clearly it's a bug in FastLED in regards to that board that can be fixed -- not something impossible.

Adafruit NeoPixel jewel schematic (2).pdf (470.8 KB)

Note that Fritzing software doesn't have the Nano 33 BLE, but the pinout is identical to the 2040 Connect, so I used it as a substitute for the schematic. Resistor is actually 300 ohms. Capacitor is 1000 microFarads. Level shifter is a HiLetgo 3.3V to 5V bidirectional. I got the same result without the level shifter, but figured the 3.3 signal wasn't enough for the 5 volt power source so put in a the level shifter.

That also means the title of the topic is wrong. It does with Adafruit_NeoPixel according to your accounts.

Also you can link in the original issue

I guess you don't have to, but since it is included in the IDE library, it would be nice and save your customers that buy directly from you some time and headaches. Probably wasn't appropriate in a Forum, but thought people should know and would likely save some technical support time in the long run.

What is included in the IDE library?
I think you are misunderstanding how some things work. Also, we have not seen a wiring diagram, so there is still a very good chance the wiring is wrong.
What specifically is 'missing' from the NANO 33 BLE that causes it to not work with a NeoPixel. My Xmas lights use an UNO and there is just 1 pin involved. I am sure the NANO 33 BLE has a pin available as well.

Yes, I expect it will work with an UNO or any of the AVR chipset. I thought I dropped a Fritzing schematic in reply to a previous Samaritan trying to help. I'll drop it again in this reply. There is a lot I don't understand, but I took the exact same code, swapped to an AVR Nano (vs Mbed Nano 33 BLE) and it worked immediately. I just had to swap pins because while D2 is PWM capable on the Nano 33 BLE, it is not on the Nano AVR. So I changed to pin D3 and the code worked exactly like it should. I am aware that the Nano 33 BLE uses 3.3 volts instead of 5 volts like the Nano AVR, so I added a level 3.3V to 5V level shifter. It didn't make a difference so that wasn't the problem. In the schematic, C1 is 1000 microFarads, and R1 is 300 ohms. Perhaps I have the level shifter wired wrong as I am new to it's use. Also note that although the Fritzing schematic says Arduino Nano RP2040 Connect, the pinouts are exactly the same as the Nano 33 BLE and Fritzing didn't have the Nano BLE but the wiring is the same.

In the Arduino IDE Library Manager, the Adafruit_NeoPixel is included. What I may not understand is how these things are vetted. I know the Adafruit library works, at least with the AVR boards as does the FastLED library. I couldn't get the code with the FastLED library included to even compile, and I learned by going to FastLED's Github site that this is a known issue. So I checked to see if the Adafruit NeoPixel library worked with the Nano 33 BLE, and it said yes. Perhaps it is a wiring issue, and I genuinely hope it is. This piece of code resides in 1 of 4 microcontrollers I was planning on connecting via BLE. Something simple like passing a single byte was all I needed with 3 central devices (client) and 1 peripheral device (server). I will have to use UART in lieu of BLE for the controller that is doing the LED work if I go with the AVR Nano, which is fine but requires 3 wires I didn't want to run because I will be wearing the devices.

Adafruit NeoPixel jewel schematic.pdf (475.3 KB)

Neither FastLED nor Neopixel library require PWM to work with LEDs.
This remark alone demonstrates how little you understand the subject. It's okay, everyone did when they were just starting out.
However, it's hardly worth blaming Arduino if you don't understand how the hardware works. Most likely, the cause of your problems wasn't library incompatibility, but an error you made while assembling the circuit or compiling the code.

1 Like

A Fritzing documents your intentions, we need to see a hand drawn diagram of where each wire starts and ends and label all non obvious parts.
There are several boards smaller or the same size as a NANO with Bluetooth/BLE.

I took a look at your voltage shifter. I have strong suspicions that it will not work. You are attempting to lift yourself by your bootstraps. Use a proper 3.3V PSU and a 5.1V PSU. A battery labelled 5V, as you have in your diagram, will only be 5V for a few seconds, then it will drop. Since 5V is the minimum for VIN and 18 the Max, I would start with enough so that it stays above 5V for a long enough time, and you can also use a 5V to 3.3V converter for your 3.3V PSU. NEVER use a board as a PSU, those pins only deliver a few milliAmps.
Maybe use an 11.1V Lipo but first do an energy audit to see how many AH you need.
OR
Switch to a board better suited to your needs. My short list would be
PICOW 2
XIAO esp32-s3
Wemos D1 Mini ESP32
and more from Adafruit, Sparkfun etc.

Hi @caclem. I see there is a report of a regression in the "Adafruit NeoPixel" library's support for the Nano 33 BLE boards starting from version 1.14.0 of the library:

I found that when I tried running your sketch with the latest version 1.15.1 of the library, the LEDs only lit up white. However, I found that it displaying the patterns as expected when I used it with version 1.13.0 of the library.

The workaround will be to install the compatible version of the library. I'll provide instructions you can follow to do that:

  1. Select Sketch > Include Library > Manage Libraries... from the Arduino IDE menus to open the "Library Manager" view in the left side panel.
  2. Type Adafruit NeoPixel in the "Filter your search..." field.
  3. Find the "Adafruit NeoPixel" entry in the list of search results.
  4. You will see a drop-down version menu at the bottom of the entry. Select "1.13.0" from the menu.
  5. Click the "INSTALL" button at the bottom of the entry.
  6. Wait for the installation process to finish, as indicated by a notification at the bottom right corner of the Arduino IDE window:

    ⓘ Successfully installed library ...

Arduino IDE will periodically display a notification that offers to update the library for you:

Updates are available for some of your libraries.

If you click the "INSTALL MANUALLY" button in the notification, a list of each of the libraries that have available updates will be shown in the Arduino IDE Library Manager. It is generally a good idea to keep your libraries updated since the updates might provide important enhancements or bug fixes. So you should look through the list and update other libraries if appropriate, but you should avoid accepting the update for the "Adafruit NeoPixel" library.

1 Like

And then remember to Not update the library - till the rev is > 1.15.0

1 Like

Thank you. This is a helpful response. I will follow your instructions. It is greatly appreciated.

No it was the version of the library that did not work. It has been regressed back a few versions. It isn't the code. The code was pulled straight from the example code. I wasn't blaming anybody. I just stated that if there is a known incompatibility with frequently used libraries it should be documented. It saves everyone time. I have had difficulty with this particular board with multiple things including serial communication associated with the bootloader and then later discovering it doesn't work with FastLED. I switched to Adafruit's library, only to find it didn't work (current library) either. So yes, I felt a little frustration.

For my edification, please explain to me how you can change the brightness and color of an LED with a discrete on/off signal without signal modulation.

I don't claim to be an expert at any of this. I am trying to learn. I regret the comment about Arduino documenting better what boards work with what libraries. I did look it up before deciding on what boards to purchase for my project, but obviously wasn't thorough enough.

This worked. LEDs are doing exactly what they are supposed to. You are a hero!! Thank you.

You are welcome. I'm glad it is working now.

The Arduino company checks libraries for basic compatibility with Arduino IDE before accepting them for inclusion in Library Manager:

https://github.com/arduino/library-registry/blob/main/FAQ.md#what-are-the-requirements-for-a-library-to-be-added-to-library-manager

These checks are also performed on each release of the library:

https://github.com/arduino/library-registry/blob/main/FAQ.md#what-are-the-requirements-for-publishing-new-releases-of-libraries-already-in-the-library-manager-list

(meaning that even if a library is accepted, individual bad releases of that library are rejected and so those versions won't be offered by Library Manager)

However, these checks only ensure the library has the correct structure and metadata to allow it to be recognized by Arduino IDE. They do not guarantee actual functionality of the library. Due to the great diversity of the Arduino ecosystem, and the complexity of testing embedded systems, it is not feasible to create a general purpose system to perform automated testing of arbitrary libraries.

It would require a very significant amount of resources to validate each of the ~8000 libraries in Library Manager, and to repeat that validation for each of the releases of each of those libraries that are constantly being produced by the library developers. Although the Arduino company does dedicate resources to the development and maintenance of the Library Manager infrastructure, and supporting the library maintainers and end users of that infrastructure, the company is not able to dedicate the level of resources required to validate the actual functionality of the thousands of 3rd party libraries. Such validation is the responsibility of the individual library maintainers.

Library maintainers are not all equal in their level of diligence. As the maintainer of the Arduino Library Registry, I can tell you that sadly some are utterly lazy and incompetent, not makingz even the most minimal effort at validating their library. We are probably seeing an increase in the number of that sort of library in this era of people without any software development experience overly relying on AI-driven "vibe coding" as a shortcut instead of putting in the work to actually learn the art, though incompetent and lazy work was certainly seen long before ChatGPT came out.

Adafruit is definitely at the other end of the spectrum. They employ highly competent and dedicated professional developers to write and maintain their hundreds of libraries. However, Adafruit's development resources will generally be dedicated to support for Adafruit products. The library may be intended to support the use of NeoPixels with an array of dozens of distinct board architectures, and they have set up infrastructure to verify that the library at least compiles for all the target boards, but they may not have the resources to wire up the actual hardware and verify runtime functionality for every single one of the 3rd party boards the library may be used with, for every release of the library.

The modulation is handled by the driver chip that is incorporated into the "NeoPixel". The Arduino board only needs to send a signal to the chip that tells it the brightness values for each of the LEDs. Once it receives that signal, the chip in the NeoPixel drives the LEDs autonomously without any need for further control from the Arduino board until such time as the program running on the Arduino board needs to change the brightness of a NeoPixel by sending a new signal.

There is information about how NeoPixels work here:

"NeoPixel" is actually just a brand name created by the Adafruit company for the Worldsemi WS2812 (and for the Shenzhen LED Color Co. SK6812 clone they use interchangeably with the WS2182). So if you want more information than is provided in that guide, and are finding what you need when using the "NeoPixel" search keyword, use "WS2812" instead so that you don't unnecessarily limit your results to those for Adafruit's branded products specifically.

2 Likes

Thank you for the informative and well written response!!

1 Like