Skip to content
Hibiiro

HIBIIRO

Getting Started with a 16-Bit WS2812B Addressable RGB LED Ring and Arduino

Introduction

Instead of adding an OLED screen to my project, I wanted a circular LED indicator UI—so I picked up a 16-LED WS2812B addressable RGB LED ring (available in 8, 16, 24, 35, and 45-LED sizes).

Parts & Environment

  • 1× Arduino Uno R3 (or compatible board)
  • 1× 16-LED WS2812B Ring Module
  • 3× Jumper Wires
  • Arduino IDE 2.3.4 with Adafruit_NeoPixel v1.12.3

Wiring Diagram

Only three connections are required: 5V, GND, and DIN (connected to Arduino digital pin D6). You can also daisy-chain DOUT to the DIN pin of additional rings—though if you chain many LEDs at high brightness, check your wire gauge and current draw with our AWG Wire Ampacity & Voltage Drop Calculator and use an external 5V power supply.

Arduino Uno to WS2812B LED ring wiring diagram

Sample Code

Based on the official Adafruit NeoPixel example, with BRIGHTNESS set to 10 so the LEDs aren’t blindingly bright on the workbench:

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

#define PIN        6
#define NUMPIXELS 16
#define BRIGHTNESS 10

Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
#define DELAYVAL 500

void setup() {
#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
  clock_prescale_set(clock_div_1);
#endif

  pixels.begin();
  pixels.setBrightness(BRIGHTNESS);
}

void loop() {
  pixels.clear();

  for(int i=0; i<NUMPIXELS; i++) {
    pixels.setPixelColor(i, pixels.Color(0, 150, 0));
    pixels.show();
    delay(DELAYVAL);
  }
}

Once uploaded, the green LEDs light up one by one clockwise around the ring. Next, see how to control this ring interactively in Controlling a 16-LED NeoPixel Ring with an Arduino and Analog Joystick!