Using WS2812B Addressable RGB LED Strips with Arduinos    Send article as PDF   
This article is about my experiments with the WS2812B LED strip, which is an addressable RGB LED strip. This information should also work with other similar LED strips, such as strips of the WS28XX family, Neopixel strip, among others. The WS2812B addressable LED strip comes in several varieties that differ in size, sealant or LED density. Choose the one that best fits your purpose.

Where to buy?

You can buy the rolls of WS2812B Addressable RGB LED Strips on eBay.

In the following photograpgh you can see my WS2812B LED strip. It comes in lengths from 5 meters long and the LEDs are enclosed in a weatherproof silicone. So, they can be left outside and with the rain and dust, without any problems.


In my opinion, this is the coolest of the many types of LED strips. You can control the brightness and the color of each LED individually. This allows you to produce amazing and complex effects in a simple way.

This LED strip is made from WS2812B LEDs wired in series. These LEDs have a IC built right into the LED which allows for communication via a one-wire interface. This means that you can control lots of LEDs using just one digital pin of your Arduino.

In the following figure you can see the chip inside the RGB LED.


These strips are very flexible, and can be cut to any length you want. As you can see, the strip is divided into segments, and each segment contains one Addressable RGB LED.


You can adjust its size by cutting the strip with a scissors to the preferred length (the proper places to cut the strip are marked).


These strips come with connectors at each end, but I’ve decided to cut the connectors off and solder header pins for easy experimenting. It’s also more useful when you want to connect the strip to an Arduino or to a breadboard.


Powering the WS2812B LED Strip:

The LED strip should be powered using a 5V power source. At 5V, each LED draws about 50mA, when set to its full brightness. This means that for every 30 LEDs, the strip may draw as much as 1.5 Amps. So make sure you select a power source that matches the strip’s needs. If you intend on using an external supply, don’t forget to connect the power supply’s ground to that of the Arduino ground.


For this example, the WS2812B LED strip will be powered using the 5V Arduino pin, as in my case, I’m controlling 14 LEDs. Bear in mind that if you want to control any more LEDs than that, you will need to use an external 5V power supply.

WS2812B with Arduino Schematic

Useful tips:

  • Connect a capacitor of between 100uF and 1000uF, from the positive to ground, which will smooth out the power supply.
  • Add a 220 or 470 Ohm resistor between the Arduino digital output pin and the LED Strip’s data input pin, to reduce noise on that line.
  • Ensure your wires between the Arduino, power supply and the LED Strip are as short as possible to minimize voltage loss.
  • If your strip gets damaged and doesn’t work, check if the first LED is broken. If so, cut it, re-solder the header pins, and all should be working again.


To control the WS2812B LED strip, you’ll need to download the FastLED library.

Installing the FastLED library

  1. Click here to download the FastLED library. You should have a .zip folder in your Downloads folder
  2. Unzip the .zip folder and you should get FastLED-master folder
  3. Rename your folder from FastLED-master to FastLED
  4. Move the FastLED folder to your Arduino IDE installation libraries folder
  5. Finally, re-open your Arduino IDE

After installing the needed library, upload the following code to your Arduino board (this is an example sketch provided in the library examples folder). Go to File > Examples > FastLED > ColorPalette or copy the code below.

Note: you have to change #define NUM_LEDS to the number of LEDs that your strip currently has, in this example 14 LEDs are used.


In the end, this is what you’ll have. Amazing effects like this one:

RGB LED Strip Animation

And this one:

RGB LED Strip Animation

And this one:

RGB LED Strip Animation

And so on (…)

Using an LED Strip Case

These strips usually come with a removable tape, so that you can stick them wherever you want. The problem is that they don’t stick very well, so chances are that you’ll find your strip in the floor the following day.

The solution: I found this strip case that diffuses the light well and you can screw it to a shelf, for example, if you want a permanent solution.

RGB LED Strip Cover

Previous Post
0.96" OLED Display

Using a 0.96 inch OLED Display with Arduino Microcontroller

In this article I will show how to use the small 0.96 inch OLED display with an Arduino Microcontoller board to build a very basic Weather Station. The 0.96 inch ... Read more

Next Post

Powering the LEGO Mindstorms Brick from a 9v Plugpack

I have been asked a number of times too how I power my Stationary and Development Robots from a 9 Volt, 5 Amp D.C. Plugpack connected to the Mains Power ... Read more

Short URL:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Do NOT follow this link or you will be banned from the site!