Multiple Sliders for ESP8266 NodeMCU Web Server (WebSocket): Control the brightness of LEDs (PWM)
Control the brightness of LEDs (PWM) This project demonstrates how to construct a web server with the ESP8266 NodeMCU board by displaying a web page that contains many sliders on the scre…

Know the mission before touching a wire.
Understand what you are making, prepare the right tools, and make the workbench safe.
Project details
Multiple Sliders for ESP8266 NodeMCU Web Server (WebSocket): Control the brightness of LEDs (PWM) is a iot project. Control the brightness of LEDs (PWM) This project demonstrates how to construct a web server with the ESP8266 NodeMCU board by displaying a web page that contains many sliders on the scre…
- Source pages
- 988-996
- Named parts
- 9
- Build goal
- Working, tested prototype
Tools you need
- Digital multimeter
- Wire stripper and side cutters
- Soldering iron with a fine tip
- Current-limited bench supply
- Computer with a data-capable USB cable
Use eye protection, good lighting, and a clean insulated surface throughout the build.
Safety precautions
- Disconnect every power source before changing a connection.
- Check component polarity, pinout, and supply voltage twice.
- Use a current limit for the first power-up.
- Keep liquids, loose metal, and uninsulated wires away from the bench.
Gather, identify, and understand every part.
Use the standardized inventory, then open What's this? to learn each part's role, advantages, limitations, handling, and specifications.
What's this?Image, role, pros, cons, handling & specifications
MODULE LEARNING VIEWNodeMCU ESP8266 development board
A programmable controller that reads inputs, makes decisions, and drives the project's outputs.
What it does hereIt is the control centre and must use the documented board, pin map, supply, and logic level.
Buy / compare this part ↗Advantages
- Reprogrammable and reusable
- Large learning ecosystem
- Complex behaviour remains changeable
Limitations
- GPIO voltage and current are limited
- Some pins affect boot or communication
- Loads normally need a driver
Handling
- Disconnect power before rewiring
- Avoid static discharge
- Never power motors, relays, or pumps directly from GPIO
Specifications to verify
- Use the exact model, value, package, and rating listed for NodeMCU ESP8266 development board; similar-looking parts are not always interchangeable.
- Confirm operating voltage, logic level, pinout, memory, USB interface, and maximum GPIO current.
What's this?Image, role, pros, cons, handling & specifications
PART LEARNING VIEWRed 5mm LED — LED1
An output component turns an electrical control signal into light, sound, motion, switching, or displayed information.
What it does hereIt presents the circuit result or acts on the physical world.
Buy / compare this part ↗Advantages
- Makes system state visible
- Can be tested separately
- Supports clear troubleshooting
Limitations
- Loads may exceed controller current
- Polarity or driver direction can matter
- Inductive loads create voltage spikes
Handling
- Use the documented driver stage
- Check polarity and load current
- Add flyback protection for inductive loads
Specifications to verify
- Use the exact model, value, package, and rating listed for Red 5mm LED — LED1; similar-looking parts are not always interchangeable.
- Confirm voltage, current, polarity, interface, driver requirements, and duty cycle.
What's this?Image, role, pros, cons, handling & specifications
PART LEARNING VIEWGreen 5mm LED — LED2
An output component turns an electrical control signal into light, sound, motion, switching, or displayed information.
What it does hereIt presents the circuit result or acts on the physical world.
Buy / compare this part ↗Advantages
- Makes system state visible
- Can be tested separately
- Supports clear troubleshooting
Limitations
- Loads may exceed controller current
- Polarity or driver direction can matter
- Inductive loads create voltage spikes
Handling
- Use the documented driver stage
- Check polarity and load current
- Add flyback protection for inductive loads
Specifications to verify
- Use the exact model, value, package, and rating listed for Green 5mm LED — LED2; similar-looking parts are not always interchangeable.
- Confirm voltage, current, polarity, interface, driver requirements, and duty cycle.
What's this?Image, role, pros, cons, handling & specifications
PART LEARNING VIEWBlue 5mm LED — LED3
An output component turns an electrical control signal into light, sound, motion, switching, or displayed information.
What it does hereIt presents the circuit result or acts on the physical world.
Buy / compare this part ↗Advantages
- Makes system state visible
- Can be tested separately
- Supports clear troubleshooting
Limitations
- Loads may exceed controller current
- Polarity or driver direction can matter
- Inductive loads create voltage spikes
Handling
- Use the documented driver stage
- Check polarity and load current
- Add flyback protection for inductive loads
Specifications to verify
- Use the exact model, value, package, and rating listed for Blue 5mm LED — LED3; similar-looking parts are not always interchangeable.
- Confirm voltage, current, polarity, interface, driver requirements, and duty cycle.
What's this?Image, role, pros, cons, handling & specifications
PASSIVE LEARNING VIEW220Ω current-limiting resistor — R1
A passive component sets current, voltage, timing, filtering, or signal behaviour without adding gain.
What it does hereIts exact value and tolerance determine how the surrounding stage behaves.
Buy / compare this part ↗Advantages
- Simple and dependable
- Low cost
- Easy to measure before installation
Limitations
- A wrong value can stop or damage the circuit
- Ratings must not be exceeded
- Polarized parts require correct orientation
Handling
- Measure unclear values
- Observe capacitor polarity
- Avoid overheating leads while soldering
Specifications to verify
- Use the exact model, value, package, and rating listed for 220Ω current-limiting resistor — R1; similar-looking parts are not always interchangeable.
- Confirm value, tolerance, power or voltage rating, polarity, and package size.
What's this?Image, role, pros, cons, handling & specifications
PASSIVE LEARNING VIEW220Ω current-limiting resistor — R2
A passive component sets current, voltage, timing, filtering, or signal behaviour without adding gain.
What it does hereIts exact value and tolerance determine how the surrounding stage behaves.
Buy / compare this part ↗Advantages
- Simple and dependable
- Low cost
- Easy to measure before installation
Limitations
- A wrong value can stop or damage the circuit
- Ratings must not be exceeded
- Polarized parts require correct orientation
Handling
- Measure unclear values
- Observe capacitor polarity
- Avoid overheating leads while soldering
Specifications to verify
- Use the exact model, value, package, and rating listed for 220Ω current-limiting resistor — R2; similar-looking parts are not always interchangeable.
- Confirm value, tolerance, power or voltage rating, polarity, and package size.
What's this?Image, role, pros, cons, handling & specifications
PASSIVE LEARNING VIEW220Ω current-limiting resistor — R3
A passive component sets current, voltage, timing, filtering, or signal behaviour without adding gain.
What it does hereIts exact value and tolerance determine how the surrounding stage behaves.
Buy / compare this part ↗Advantages
- Simple and dependable
- Low cost
- Easy to measure before installation
Limitations
- A wrong value can stop or damage the circuit
- Ratings must not be exceeded
- Polarized parts require correct orientation
Handling
- Measure unclear values
- Observe capacitor polarity
- Avoid overheating leads while soldering
Specifications to verify
- Use the exact model, value, package, and rating listed for 220Ω current-limiting resistor — R3; similar-looking parts are not always interchangeable.
- Confirm value, tolerance, power or voltage rating, polarity, and package size.
What's this?Image, role, pros, cons, handling & specifications
PART LEARNING VIEWMicro-USB cable and regulated 5V USB supply
A named project component whose exact role is defined by the source circuit and build guide.
What it does hereIt performs a documented electrical, control, interface, or construction function in this project.
Buy / compare this part ↗Advantages
- Selected for this project
- Can be checked independently
- Supports modular troubleshooting
Limitations
- Substitutes may differ
- Generic names can hide variants
- Pinouts and ratings vary
Handling
- Compare the received part with the source
- Keep it labelled
- Do not force connectors or adjusters
Specifications to verify
- Use the exact model, value, package, and rating listed for Micro-USB cable and regulated 5V USB supply; similar-looking parts are not always interchangeable.
- Confirm dimensions, ratings, connection method, polarity, and environmental limits.
What's this?Image, role, pros, cons, handling & specifications

Breadboard and jumper wires
A named project component whose exact role is defined by the source circuit and build guide.
What it does hereIt performs a documented electrical, control, interface, or construction function in this project.
Buy / compare this part ↗Advantages
- Selected for this project
- Can be checked independently
- Supports modular troubleshooting
Limitations
- Substitutes may differ
- Generic names can hide variants
- Pinouts and ratings vary
Handling
- Compare the received part with the source
- Keep it labelled
- Do not force connectors or adjusters
Specifications to verify
- Use the exact model, value, package, and rating listed for Breadboard and jumper wires; similar-looking parts are not always interchangeable.
- Confirm dimensions, ratings, connection method, polarity, and environmental limits.
Connect one verified path at a time.
Use the pin-reviewed interactive wiring view to inspect real parts, named terminals, and every connection path.
Trace this circuit.
Multiple Sliders for ESP8266 NodeMCU Web Server (WebSocket): Control the brightness of LEDs (PWM): interactive parts, standardized terminals, responsive anchored wires, student explanations, and the original circuit reference in one shared system.
Trace before wiring
Follow power, ground, inputs, processing, and outputs in that order. Never guess a pin from package shape alone.
Connect with power off
Make short, labelled connections and share a common ground only where the schematic requires it.
Inspect every joint
Check continuity, polarity, adjacent shorts, and loose connections before the first power-up.
Open all source diagrams and build views 6 visuals






Confirm the hardware-only control path.
This project does not include firmware in the source. The circuit itself provides the required behaviour.
How to connect
- Match every controller label to the circuit view and source pin map.
- Join grounds before signal wires when separate low-voltage supplies are used.
- Keep motors, relays, pumps, and other loads on a suitable driver and external supply.
Common mistakes
Reversed VCC/GND, board-label versus GPIO-number confusion, missing common ground, and charge-only USB cables.
Troubleshoot
Disconnect loads, continuity-test one path at a time, then test with a current limit.
Software preparation
No IDE, board package, library, or firmware upload is required for this project.
If you add a programmable controller as an extension, document its pin map separately.
How to upload code
The original design is implemented entirely in hardware, so proceed after verifying the circuit and supply.
Assemble, deploy, test, and troubleshoot.
Use the complete source notes in build order, then pass the final checks before calling the project finished.
Build in functional stages
- Power and regulation
- Controller or processing stage
- Inputs and sensors
- Outputs and loads
- Enclosure and strain relief
Power up safely
- Inspect unpowered continuity first
- Apply the lowest safe current limit
- Measure supply rails before signals
- Add one load at a time
- Record expected and actual results
Work from simple to complex
- Confirm power, ground, polarity, and orientation
- Compare each pin with the source
- Test inputs separately from outputs
- Replace only one variable at a time
- Power off before every correction
Follow the documented instructions.
These notes come from this project's source and remain in their original order.
420.Multiple Sliders for ESP8266 NodeMCU Web Server (WebSocket)
Project build noteControl the brightness of LEDs (PWM)
This project demonstrates how to construct a web server with the ESP8266 NodeMCU board by displaying a web page that contains many sliders on the screen. The brightness of many LEDs can be adjusted by adjusting the duty cycle of several PWM signals, which is controlled by the sliders. This idea can be used to drive DC motors or other actuators that require a PWM signal in place of the LEDs if you so want. The WebSocket protocol is utilized in order to facilitate communication between the clients and the ESP8266. In addition, each time there is a modification, the values of the sliders on all of the clients are updated concurrently.
Project Overview
Project build noteThe web page we'll make for this project is shown in the picture below:
The web page has three cards: Fader 1, Fader 2, and Fader 3. Each card has its own paragraph with the title of the card. On each card is a range slider that you can use in order to adjust the amount of light emitted by the appropriate LED; Another paragraph on each card displays the brightness of the LEDs at the moment (shown as a percentage); If you have more than one tab open in your web browser (or more than one device), all of those tabs and devices will update almost instantly whenever there is a change. When you move the slider to a new position, all clients are notified of the change. How Does It Work? A web server that the ESP maintains and operates presents a webpage that has three sliders;
When you move a slider to a new location, the client will send the number of the slider as well as the value of the slider to the server via the WebSocket protocol. For instance, if you moved slider number 3 to position number 40, it would communicate that setting to the server with the message "3s40."
The server (ESP) will make the necessary adjustments to the PWM duty cycle after it has received the slider number and the related value. Additionally, it alerts all the other clients with the new current slider settings, which enables us to have all clients changed in what feels like almost no time at all. To adjust the level of brightness emitted by the LED, the ESP8266 sends out a PWM signal complete with the appropriate duty cycle. If the LED has a duty cycle of 0%, then it is completely dark; if it has a duty cycle of 50%, then it is only half lighted; and if it has a duty cycle of 100%, then it is completely lit; It will send a message to the ESP8266 (also using the WebSocket protocol) with the message getValues whenever you open a new web browser window. This is when a new client connects. When the ESP8266 receives this message, it will communicate the values of the slider at the current position. When you start a new tab, the values will always be displayed as they have been most recently changed in this manner.
Schematic Diagram
Project build noteConnect three LEDs to the ESP8266 using the wires. GPIOs 12 (D6), 13 (D7), and 14 are being utilized here (D5). You are free to use any other GPIOs that are appropriate. Prerequisites Before continuing with this tutorial, please ensure that you have satisfied all of the prerequisites listed below. 1) Parts Required
To continue with this project, you will need to
Project build noteESP8266 NodeMCU Board - read our Best ESP8266 Wi-Fi Development Board - Buying Guide for more information. 3x LEDs
3 resistors each rated at 220 ohms Jumper wires for the breadboard You can test this project with just one LED, the results of which can be seen in the Serial Monitor, or you can use other actuators whose operation requires a PWM signal. You do not need three LEDs to test this project. 2) Add-on for the Arduino Software and ESP8266 Boards Using Arduino IDE, we'll write some code for the ESP8266. Therefore, the ESP8266 add-on component needs to be installed on your system. 3) Filesystem Uploader Plugin We will be utilizing a plugin for the Arduino IDE known as the LittleFS Filesystem uploader in order to upload the HTML, CSS, and JavaScript files required to construct this project into the flash memory (LittleFS) of the ESP8266. 4) Libraries You will need to install the following libraries in order to construct this
project
Project build noteESPAsyncWebServer (a.zip folder), ESPAsyncTCP, and the Arduino JSON library by Arduino version 0.1.0 can be found in the Arduino Library Manager (.zip folder). Utilizing the Arduino Library Manager, you will be able to install the initial library. Find the library's name by going to Sketch > Include Library > Manage Libraries and searching for it there. Because the ESPAsynTCP and ESPAsynWebServer libraries cannot be installed through the Arduino Library Manager, you will need to manually copy the library files into the Arduino Installation Libraries folder. These libraries are not accessible for installation through the Arduino Library
Manager. You can also select the libraries you just downloaded by going to the Sketch menu in your Arduino IDE, selecting the Include Library option, and then clicking the Add.zip Library button. Performing Library Installation (VS Code + PlatformIO) If you are using PlatformIO to write code for the ESP8266, you need to add the following lines to the platformio.ini file in order to include the necessary libraries (you need also modify the speed of the Serial Monitor to 115200
and specify the littleFS filesystem)
Project build noteLaunch the Serial Monitor with a baud rate of 115200 once everything has been successfully uploaded. If you give the ESP8266 EN/RST button a press, you should see the IP address printed on the screen.
Demonstration
Project build noteCopy the ESP8266 IP address, then open a browser on your local network and paste it there. It is recommended that you gain access to the web server
page so that you can adjust the intensity of the LEDs. To adjust the level of brightness emitted by the LEDs, use the sliders. When you switch between tabs on your browser or connect to the web server from a different device, you'll see that the values of the sliders update almost instantly whenever you make a modification.
You built Multiple Sliders for ESP8266 NodeMCU Web Server (WebSocket): Control the brightness of LEDs (PWM).
You followed the full workflow from understanding the mission to testing the finished project. That is a real engineering achievement - well done.
Browse all 500 projects