Control Neopixel With WebServer

Published on


Neopixel LED is an attractive and widely used type. With very little energy consumption, they can produce millions of colored lights. Have you ever had the question of how to change the values of R, G, and B in neopixel LEDs in real time? Well, your answer is this tutorial, in this tutorial we are going to control wireless LED using nodemcu esp8266 board and build a web server. Change the mentioned values with a page in your browser and produce any color you want. Visit CiferTech for more tutorials, and be sure to follow my Instagram page to support me.

راه اندازی ال ای دی نئوپیکسل با آردوینو وب سرور - دیجی اسپارک


Web servers are programs whose responsibility is to accept HTTP requests sent from users, in response, web servers send information that we usually know as Html pages. Well, now let’s assume that in the HTTPS browser:

وب سرور ESP32: کنترل خروجی ها بصورت سخت افزاری و نرم افزاری


ESP8266 chips are among the popular items in the field of Internet of Things, which have better quality and lower price than other examples, the central core of this module is ESP8266 EX, which is actually placed under this metal shield, in addition, this shield Metal is placed in order to reduce noise and also protect the sensitive SMD parts of this module. These modules are produced in different series, including esp01 and esp12, in fact, the difference between the models is the number of GPIOs and their memory, although usually the differences they have with each other can be recognized. These modules support internal WIFI networks, these microcontrollers were first released in 2014. The ESP8266 has 13 GPIOs as well as an analog input (A0).


How it Works

In the neopixel LED wireless control project, by building a web server using the ESP8266 board, we can have full control over our neopixel ring module and the values of the main colors, i.e. red, blue, green, on a scale of 0 to 255. To change, there is also a color plot in the web server where we can visually select the desired color.

کنترل بی سیم ال ای دی نئوپیکسل با وب سرور آردوینو - دیجی اسپارک

Items Needed

  • Nodemcu
  • Neopixel

وسایل مورد نیاز کنترل بیسیم نئوپیکسل Neopixel - دیجی اسپارک

Required libraries

To implement the wireless LED control project, we first install the Adafruit_NeoPixel reference library in the Arduino IDE software. Follow the steps below.

  1. Go to Sketch > Include Library > Manage Libraries
  2. Search for the word Adafruit_NeoPixel.
  3. Install the library.

کنترل نئوپیکسل بوسیله WebServer


  • Connections for nodemcu board

کنترل بی سیم ال ای دی نئوپیکسل با برد Nodemcu - دیجی اسپارک

  • Connectors for wemos D1 mini board

کنترل بی سیم ال ای دی نئوپیکسل با برد ویموس Wemos - دیجی اسپارک


First, I will give explanations about the different parts of the code. At first, we added the required libraries to the code as described below.


In this section, we will enter the desired Wi-Fi network information, including the Wi-Fi name and password.


In this section, we specify the desired base for neopixel connection and the number of required LEDs.


This part of the HTML code is related to the appearance of the web server.


The complete code of the neopixel LED wireless control project



To make the wireless LED control project portable, just use the wemos board along with the battery charging shield. The battery shield allows the user to make his Internet of Things project portable, in such a way that by connecting the shield to the Wemos board and connecting the battery from the relevant connector, you will be able to charge the desired battery in addition to the size of the project in a portable way. do. The suitable lithium battery for this shield is in the voltage range of 3.3 to 4.2.

کنترل بی سیم ال ای دی نئوپیکسل با برد ویموس Wemos


At the end, after uploading the code to the desired board, by resetting the board, you will be able to find the IP of the created web page in the Arduino serial monitor, and you can access the web server by searching for it in your browser. In this tutorial, by using the ESP8266 board and the Neopixel Ring module, we were able to change the values of R, G, B in the neopixel module in real-time and using a web page. Also, by using the wemos board along with the battery shield, we completed this project. Convert to a portable circuit.

Leave a Reply

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