Xiao using FastLED to control ws2812b

Hi everyone,

I tried the FastLED blink example (that tries to turn on and off the 1st LED on ws2812b) on the Xiao but the LED was not blinking. The same circuit setup and program works on an Arduino uno. Any idea? Thanks.

Setup like this:

  1. Xiao pin D3 as data pin connected to DIn on the ws2812b with a 330ohm resister in between.
  2. Xiao connected to PC thru type-c USB.
  3. ws2812b 5V power by an external power supply.


Input logic has to be VCC -.5V/+5V. Since you are supplying 5V vcc to the strip the Xiao’s logic voltage of 3.3v would not be recognized by the LED. The reason it works with the Arduino Uno is the Arduino Uno has 5v logic pins. This setup should work but you would need to reduce the power voltage supplied to the strip down to around 3.8V or lower. Example would be using a LiPo battery rated at 3.7V.

Hope this makes sense.

Thanks. I will try it out.

FastLED.h doesn`t support SAMD21 CPU.

This is not my original work but thought it may help someone if they wanted to use FastLED.

To get FastLED working you need to verify you are have the latest update to both the seeeduino boards as well as the FastLED library.

After verifying you have the most up to date versions of both.

Navigate into the FastLED library on your computer. Typically in C:\users<user name>\documents\arduino\libraries

you will want to navigate in the FastLED folder into the platforms then arm, then into d21, then edit the file called “fastpin_arm_d21”

Scroll down to around line 100 and paste this, and save.

#elif defined(SEEED_XIAO_M0)

#define MAX_PIN 10

_FL_DEFPIN( 0, 2,0); _FL_DEFPIN( 1, 4,0); _FL_DEFPIN( 2,10,0); _FL_DEFPIN( 3,11,0);

_FL_DEFPIN( 4, 8,0); _FL_DEFPIN( 5, 9,0); _FL_DEFPIN( 6, 8,1); _FL_DEFPIN( 7, 9,1);

_FL_DEFPIN( 8, 7,0); _FL_DEFPIN( 9, 5,0); _FL_DEFPIN(10, 6,0);

#define SPI_DATA 9

#define SPI_CLOCK 8


Seeeduino xiao fastled|690x261

Again this is not my work on the pin assignments. And they technically should be included in the latest version of FastLED but for some reason the master files haven’t had the modification as of this writing.

1 Like

I don’t quite understand. Currently, FastLED is used in XIAO. Is there any problem?

So checking further into it today it appears if you use the library manager in the ArduinoIDE to download the FastLED library even though you tell it to download the latest version it does not contain the pin structure for the xiao. If the FastLED library is downloaded from github directly there appears to be no problem.

Sorry for the confusion.

I’m sorry but do you mean if I download the latest FastLED library from github it should work on the xiao that it has nothing to do with the 3.3V vs 5V I/O difference? Thanks again.

Thank you! I’ve been battling with this and you’ve just solved my issue.

I can confirm: the signal voltage is not an issue, the lacking pin assignments is.

I’m new to this kind of thing. I’ve done the correction and uploaded the code. Should my wiring be LED gnd to Xiao gnd, LED 5V in to Xiao VCC, LED data in to Xiao pin 10 (as defined in my sketch code)?

Thank you @ssbirkenfeld for the pin structure fix; that solved the main issue I had (getting it to turn on at all). I have Seeeduino running the demo reel on an LED strip. It turns on and operates but the light changes are not smooth at all. This is not my first time running the demo reel so I know what its supposed to look like and it is very jittery.

Any ideas?

rough image of the build below: