Table of Contents
Overview
In this quick tutorial learn how to interface WS2812b Neopixel ring with ESP32 microcontroller. WS2812B NeoPixel rings are circular LED arrays that are super fun and easy to use. Each Neopixel ring is made up of multiple WS2812B LEDs, and these are individually addressable, which means you can control the color and brightness of each LED separately with the help of one data pin from a microcontroller like an ESP32.
These rings are great for creating cool lighting effects, from simple color changes to complex animations. They come in various sizes, so you can find rings with different numbers of LEDs to fit your project needs. They’re perfect for wearable tech, decorative lights, or even DIY smart home devices. Just like with NeoPixel strips, you can chain multiple rings together for even more impressive light displays. So, if you’re looking to add some eye-catching, programmable lights to your project, NeoPixel rings are a fantastic choice!
Required components
- ESP32 Microcontroller
- WS2812b Neopixel ring
- Connecting wires
- 5V power supply
Before purchasing LED ring check the power supply voltages 5v or 12v, In our case we are using a 5v variant which is easy to connect directly to ESP32. If you are using a ring with more number of LEDs check their power consumption which should lie under our supplies power amperage.
Circuit diagram interfacing Neopixel ring with ESP32
As you can see from the above circuit diagram the neopixel ring PWR pin and GND pin are connected to the VIN and GND pins of ESP32, as we are connecting ESP32 with USB power supply of 5V. Neopixels ring has another 2 pins IN and OUT. The IN pin which is the Data Input pin is connected to D23 pin of ESP32. The OUT pin is used to connect another rings or strips but as we are using one ring we leave it. On data INPUT pin we connect a 330 ohm resistor for finetuning and protecting the first LED, you can use between 300 to 500 ohm resistor. That’s it for connections if you are using large number of LEDs it is recommended to use logic shifters.
Software and coding
First we need to download and install Arduino IDE on your PC. Download required libraries through below given links or the library manager.
After installing connect ESP32 to your PC and click on File ->Examples -> Adafruit_NeoPixel -> Strandtest
Set the LED_PIN to pin which we connected to ESP32. and set number of LEDs to 12 as we are using 12 bit Neopixel LED ring. Read the code below where you can see few more settings, if you are using another type of pixel LEDs change it accordingly.
Finally through tools option choose correct board as “ESP32 Wrover module” and Port you are using and hit Upload button to upload the code to ESP32.
After uploading press reset button on the ESP32 to see the LED effects on the Neopixel ring. In this way you can connect and make cool projects. If you got any errors or any project requests please comment below.