{"id":13477,"date":"2017-05-18T18:09:28","date_gmt":"2017-05-18T22:09:28","guid":{"rendered":"http:\/\/embedded-lab.com\/blog\/?p=13477"},"modified":"2023-04-11T22:15:02","modified_gmt":"2023-04-12T02:15:02","slug":"tutorial-9-esp8266-ws2812b-rgb-led-neopixel-ring","status":"publish","type":"post","link":"https:\/\/embedded-lab.com\/blog\/tutorial-9-esp8266-ws2812b-rgb-led-neopixel-ring\/","title":{"rendered":"Tutorial 9: ESP8266 and WS2812B RGB LED (or NeoPixel) ring"},"content":{"rendered":"<p>This tutorial describes how to interface a WS2812B RGB LED ring or <a href=\"https:\/\/www.adafruit.com\/category\/184\" target=\"_blank\" rel=\"noopener noreferrer\">Adafruit&#8217;s NeoPixel ring<\/a> to\u00a0ESP8266. The WS2812B is a smart RGB LED with\u00a0a control circuit integrated in a 5050 SMD package.\u00a0The RGB data transfer occurs through a single data input line\u00a0using single NZR communication mode.<\/p>\n<div id=\"attachment_13479\" style=\"width: 810px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2017\/05\/title.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-13479\" class=\"size-full wp-image-13479\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2017\/05\/title.jpg\" alt=\"EasyESP-1 driving NeoPixel ring\" width=\"800\" height=\"485\" srcset=\"https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2017\/05\/title.jpg 800w, https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2017\/05\/title-580x352.jpg 580w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><p id=\"caption-attachment-13479\" class=\"wp-caption-text\">EasyESP-1 driving NeoPixel ring<\/p><\/div>\n<p>Connection between the NeoPixel ring and ESP8266 is through a single data wire. I am using EasyESP-1 here for illustration. The Data In (DI) line of the\u00a0NeoPixel ring connects to D1 pin of EasyESP-1. VCC and GND pins go to 3.3V and GND terminals of EasyESP-1. I used a <a href=\"https:\/\/www.elecrow.com\/40-bit-ws2812b-5050-rgb-led-driver-development-board.html\" target=\"_blank\" rel=\"noopener noreferrer\">40 RGB LED NeoPixel-compatible LED ring<\/a> from Elecrow for this experiment.<\/p>\n<div id=\"attachment_13480\" style=\"width: 810px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2017\/05\/setup.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-13480\" class=\"wp-image-13480 size-full\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2017\/05\/setup.jpg\" alt=\"setup\" width=\"800\" height=\"626\" srcset=\"https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2017\/05\/setup.jpg 800w, https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2017\/05\/setup-580x454.jpg 580w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><p id=\"caption-attachment-13480\" class=\"wp-caption-text\">Wiring RGB LED ring to EasyESP-1<\/p><\/div>\n<div id=\"attachment_13481\" style=\"width: 710px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2017\/05\/wiring.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-13481\" class=\"wp-image-13481 size-full\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2017\/05\/wiring.jpg\" alt=\"wiring\" width=\"700\" height=\"546\" srcset=\"https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2017\/05\/wiring.jpg 700w, https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2017\/05\/wiring-580x452.jpg 580w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/><\/a><p id=\"caption-attachment-13481\" class=\"wp-caption-text\">Power supply and data input pins on the back of Elecrow&#8217;s RGB LED ring<\/p><\/div>\n<p>For programming the ESP8266 to drive the RGB ring, you will need to install <strong><a href=\"https:\/\/github.com\/adafruit\/Adafruit_NeoPixel\" target=\"_blank\" rel=\"noopener noreferrer\">Adafruit&#8217;s NeoPixel Library<\/a><\/strong>. The library comes with several examples which can be tested with the current setup with a very little modification in the code. Once the library is installed, open <strong><em>RGBWstrandtest<\/em><\/strong> example and modify the following two lines as follows:<\/p>\n<p>#define PIN D1<br \/>\n#define NUM_LEDS 40<\/p>\n<p>That&#8217;s all you need to change to run this example with the current setup of the EasyESP-1 and RGB LED ring.<\/p>\n<p>Note that you must have your Arduino IDE setup to program ESP8266 according to the instructions posted in <strong><a href=\"http:\/\/embedded-lab.com\/blog\/tutorial-1-setting-arduino-ide-easyesp-1\/\" target=\"_blank\" rel=\"noopener noreferrer\">Tutorial 1: Setting up the Arduino IDE for EasyESP-1<\/a>\u00a0<\/strong>prior to run this example.<\/p>\n<p>Then upload the modified example code and\u00a0see the output.<\/p>\n<div id=\"attachment_13484\" style=\"width: 810px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2017\/05\/op1.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-13484\" class=\"size-full wp-image-13484\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2017\/05\/op1.jpg\" alt=\"v\" width=\"800\" height=\"521\" srcset=\"https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2017\/05\/op1.jpg 800w, https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2017\/05\/op1-580x378.jpg 580w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><p id=\"caption-attachment-13484\" class=\"wp-caption-text\">RGBWstrandtest output<\/p><\/div>\n<h4><a href=\"https:\/\/www.elecrow.com\/cde82664e.html\" target=\"_blank\" rel=\"noopener noreferrer\">Buy EasyESP-1 board<\/a><\/h4>\n<h4>More tutorials<\/h4>\n<h5 class=\"post-title\"><a href=\"http:\/\/embedded-lab.com\/blog\/easyesp-1-rapid-prototyping-development-board-esp8266\/\" target=\"_blank\" rel=\"noopener noreferrer\">EASYESP-1: A RAPID PROTOTYPING AND DEVELOPMENT BOARD FOR ESP8266<\/a><\/h5>\n<h5 class=\"post-title\"><a href=\"http:\/\/embedded-lab.com\/blog\/tutorial-1-setting-arduino-ide-easyesp-1\/\" target=\"_blank\" rel=\"noopener noreferrer\">TUTORIAL 1: SETTING UP THE ARDUINO IDE FOR EASYESP-1<\/a><\/h5>\n<h5 class=\"post-title\"><a href=\"http:\/\/embedded-lab.com\/blog\/tutorial-2-easyesp-1-hello-world-example\/\" target=\"_blank\" rel=\"noopener noreferrer\">TUTORIAL 2: EASYESP-1 \u201cHELLO WORLD\u201d EXAMPLE<\/a><\/h5>\n<h5 class=\"post-title\"><a href=\"http:\/\/embedded-lab.com\/blog\/tutorial-3-connecting-oled-display-esp8266\/\" target=\"_blank\" rel=\"noopener noreferrer\">TUTORIAL 3: CONNECTING AN OLED DISPLAY TO ESP8266<\/a><\/h5>\n<h5 class=\"post-title\"><a href=\"http:\/\/embedded-lab.com\/blog\/tutorial-4-working-esp8266-wifi-scan-class\/\" target=\"_blank\" rel=\"noopener noreferrer\">TUTORIAL 4: WORKING WITH ESP8266 WIFI SCAN CLASS<\/a><\/h5>\n<h5 class=\"post-title\"><a href=\"http:\/\/embedded-lab.com\/blog\/tutorial-5-setting-esp8266-web-server\/\" target=\"_blank\" rel=\"noopener noreferrer\">TUTORIAL 5: SETTING UP AN ESP8266 WEB SERVER<\/a><\/h5>\n<h5 class=\"post-title\"><a href=\"http:\/\/embedded-lab.com\/blog\/tutorial-6-esp8266-bme280-make-localremote-weather-station\/\" target=\"_blank\" rel=\"noopener noreferrer\">TUTORIAL 6: ESP8266 AND BME280 MAKE A LOCAL\/REMOTE WEATHER STATION<\/a><\/h5>\n<h5 class=\"post-title\"><a href=\"http:\/\/embedded-lab.com\/blog\/tutorial-7-esp8266-ili9341-tft-lcd\/\" target=\"_blank\" rel=\"noopener noreferrer\">TUTORIAL 7: ESP8266 AND ILI9341 TFT LCD<\/a><\/h5>\n<h5 class=\"post-title\"><a href=\"http:\/\/embedded-lab.com\/blog\/tutorial-8-esp8266-internet-clock\/\" target=\"_blank\" rel=\"noopener noreferrer\">TUTORIAL 8: ESP8266 INTERNET CLOCK<\/a><\/h5>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial describes how to interface a WS2812B RGB LED ring or Adafruit&#8217;s NeoPixel ring to\u00a0ESP8266. The WS2812B is a smart RGB LED with\u00a0a control circuit integrated in a 5050 SMD package.\u00a0The RGB data transfer occurs through a single data input line\u00a0using single NZR communication mode. Connection between the NeoPixel ring and ESP8266 is through a single data wire. I am using EasyESP-1 here for illustration. The Data In (DI) line of the\u00a0NeoPixel ring connects to D1 pin of EasyESP-1. VCC and GND pins go to 3.3V and GND terminals of EasyESP-1. I used a 40 RGB LED NeoPixel-compatible LED<\/p>\n","protected":false},"author":1,"featured_media":13479,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1603,1044,1464,1466],"tags":[1648,1321,545],"class_list":["post-13477","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-esp8266-tutorials","category-esp8266","category-featured","category-tutorials","tag-easyesp-1","tag-esp8266","tag-rgb-led"],"_links":{"self":[{"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/posts\/13477","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/comments?post=13477"}],"version-history":[{"count":5,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/posts\/13477\/revisions"}],"predecessor-version":[{"id":15136,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/posts\/13477\/revisions\/15136"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/media\/13479"}],"wp:attachment":[{"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/media?parent=13477"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/categories?post=13477"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/tags?post=13477"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}