Wemos Mini Ws2812B example

In this example we connect a Wemos Ws2812B RGB shield to a Wemos mini, we will then loop through red, green and blue colors



The WS2812 is a intelligent control LED light source that the control circuit and RGB chip are integrated in a package of 5050 components. It internal include intelligent digital port data latch and signal reshaping amplification drive circuit. Also include a precision internal oscillator and a 12V voltage programmable constant current control part, effectively ensuring the pixel point light color height consistent.

The data transfer protocol use single NZR communication mode. After the pixel power-on reset, the DIN port receive data from controller, the first pixel collect initial 24bit data then sent to the internal data latch, the other data which reshaping by the internal signal reshaping amplification circuit sent to the next cascade pixel through the DO port. After transmission for each pixel,the signal to reduce 24bit. pixel adopt auto reshaping transmit technology, making the pixel cascade number is not limited the signal transmission, only depend on the speed of signal transmission.

LED with low driving voltage, environmental protection and energy saving, high brightness, scattering angle is large, good consistency, low power, long life and other advantages. The control chip integrated in LED above becoming more simple circuit, small volume, convenient installation.

These are also sold as Neopixels


You will need to add the Adafruit Neopixel library to your Arduino IDE – https://github.com/adafruit/Adafruit_NeoPixel

[codesyntax lang=”cpp”]

#include <Adafruit_NeoPixel.h>

#define PIN D2

//the Wemos WS2812B RGB shield has 1 LED connected to pin 2
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(1, PIN, NEO_GRB + NEO_KHZ800);

void setup() 
  pixels.begin(); // This initializes the NeoPixel library.

void loop() 
  setColor(255,0,0,1000); //red
  setColor(0,255,0,1000); //green
  setColor(0,0,255,1000); //blue

//simple function which takes values for the red, green and blue led and also
//a delay
void setColor(int redValue, int greenValue, int blueValue, int delayValue)
  pixels.setPixelColor(0, pixels.Color(redValue, greenValue, blueValue)); 



WS2812B RGB SHIELD for WeMos D1 mini


Please enter your comment!
Please enter your name here