DIYables Web Apps Web Analog Gauge
Overview
This ESP32 S3 Uno analog gauge tutorial shows you how to put a round, needle-style meter on a web page served by the ESP32 S3 Uno form board. You open the page on your phone or PC, and the needle moves in real time as your sensor value changes. It works well as a web-based meter for voltage, pressure, light level or a potentiometer, with no app to install.
In this tutorial, you will:
- Install the DIYables ESP32 WebApps library in Arduino IDE
- Run the WebAnalogGauge example and open the gauge in a web browser
- Set the gauge range, unit and update speed in code
- Connect a potentiometer and watch the circular gauge follow it live

The video below walks through the whole project with a potentiometer driving the Web Analog Gauge app:
Features
The gauge page does a lot of work for you, so your sketch only needs to send numbers. Here is what you get out of the box.
Circular gauge in the browser
A clean, professional dial with tick marks and a moving needle. You open it from any web browser on the same WiFi network.
Custom range and unit
You set the minimum value, maximum value and unit (%, V, °C…) once in the constructor. The page picks up this setup on its own, so there is nothing else to configure.
Live, smooth updates
Values travel over WebSocket, so the needle moves the moment the ESP32 S3 Uno sends a new number. There is no page refresh, and the needle glides smoothly between values.
Color zones and precision
Green, yellow and red zones show the status at a glance. You can also choose how many decimal places the reading shows.
Works on every screen
The layout adapts to desktop, tablet and phone screens.
Hardware Preparation
Or you can buy the following kits:
| 1 | × | DIYables Sensor Kit (18 sensors/displays) |
Additionally, some of these links are for products from our own brand, DIYables .
Setup Instructions
The first sketch needs no wiring at all. It simulates a sensor that sweeps up and down, so you can test the web page with just the board and a USB cable. You will add a real potentiometer later in this tutorial.
Detailed Instructions
Follow these steps in order:
- New to the ESP32 S3 Uno? Follow ESP32 S3 Uno - Getting Started first.
- Connect the board to your computer with a USB Type-C cable.
- Open Arduino IDE, choose the ESP32S3 Dev Module board and the correct COM port.
- Open the Library Manager by clicking the Libraries icon on the left bar of Arduino IDE.
- Search for the library: type "DIYables ESP32 WebApps" and find the DIYables ESP32 WebApps library by DIYables.
- Install it by clicking the Install button.
- Search for DIYables ESP32 WebApps created by DIYables and click the Install button.
- Install the dependencies: Arduino IDE asks to install some other libraries too. Click Install All.
- Open the example: go to File Examples DIYables ESP32 WebApps WebAnalogGauge, or copy the code below and paste it into Arduino IDE.
- Add your WiFi details by changing these two lines:
- Upload the code: click the Upload button in Arduino IDE to send the sketch to the ESP32 S3 Uno.
- Open the Serial Monitor and set it to 9600 baud. You should see output like this:
- Open a web browser on your PC or phone. It must be on the same WiFi network as the board.
- Type the IP address from the Serial Monitor into the address bar, for example http://192.168.0.2. The home page appears:

- Click the Web Analog Gauge link to open the gauge:

- Watch the needle: it sweeps slowly from 0% to 100% and back, following the simulated value.
- Tip: you can skip the home page and open the gauge directly with the IP address plus /web-gauge, for example http://192.168.0.2/web-gauge. Bookmark it on your phone for quick access.
Web Interface Features
The web page is more than a picture of a dial. Knowing what it shows helps you read your data correctly.
Analog Gauge Display
The round gauge shows the minimum and maximum values you set in code at both ends of the scale. The current reading appears as a number with its unit, and the needle points to the same value. Color zones tell you if the value is in a safe, warning or high area. The number of decimal places is configurable, so you can show whole numbers or finer readings.
Real-time Updates
The page keeps a WebSocket connection open to the ESP32 S3 Uno. New values arrive automatically, and the needle moves smoothly to each one. A status indicator shows if the connection is alive. The controls are touch-friendly, so the page works well on phones.
Code Configuration
You only need two pieces of code to use the gauge: one line that creates it, and a way to send it values.
Gauge Setup
The constructor takes the minimum value, the maximum value and the unit. Then you register a callback that runs when a browser asks for the current value.
Sending Values
Inside the callback, read your sensor, scale the reading and send it to the gauge. On the ESP32 S3 Uno the ADC is 12-bit, so a raw reading goes from 0 to 4095, and the pins work at 3.3V. The math below uses those values. Pin A0 on the ESP32 S3 Uno is GPIO2, so the code uses 2.
Customization Options
The same gauge can show very different kinds of data. You only change the range, the unit and the code that produces the number.
Range Configuration
Set the minimum value to the lowest reading you expect, and the maximum value to the highest. The unit is a short text such as V, A, °C or PSI, and it appears next to the number. You can also control how many decimal places the display uses.
Sensor Integration
Analog sensors such as voltage dividers, current sensors, pressure sensors and light sensors connect straight to an analog pin. Digital sensors for temperature, humidity or gas can send their values over I2C or SPI. You can also show calculated values that combine several sensors, or readings with a calibration factor applied for better accuracy.
ESP32 S3 Uno Pinout
The image below shows the pinout diagram of the ESP32 S3 Uno form board. Use it to find the A0 header pin and its GPIO number before you wire the potentiometer.

ESP32 S3 Uno Web Analog Gauge with Potentiometer
Now replace the simulated value with a real one. A potentiometer is the easiest analog input to test with: turn the knob, and the needle on the web page follows it.
Wire the potentiometer as shown in the table. Use the 3.3V pin, not 5V, because the ESP32 S3 Uno analog pins are NOT 5V tolerant.
| Potentiometer Pin | ESP32 S3 Uno Pin |
|---|---|
| VCC (one outer pin) | 3.3V |
| GND (other outer pin) | GND |
| Signal (middle pin) | A0 (GPIO2) |
The sketch below reads the potentiometer on A0 (GPIO2) every 500 ms. It maps the 0–4095 reading to 0–100% and sends the result to the web gauge. The rest of the code is the same as the WebAnalogGauge example.
The sketch calls analogSetAttenuation(ADC_11db) in setup(). By default, the ESP32 S3 Uno ADC can only measure a small voltage. With 11 dB attenuation, the analog pin reads the full range, from 0V up to about 3.3V. Without this line, the reading hits 4095 too early and the gauge jumps to 100% long before the knob reaches the end.
Watch the video below to see this ESP32 S3 Uno project step by step.
Common Use Cases
A live gauge fits any project where you want to see one value at a glance. Here are some ideas to start from.
Educational Projects
Show a battery or power supply voltage while you test circuits. Display temperature, humidity or light levels in an environment project. Measure force, pressure or acceleration in physics experiments. Check components and analyze circuits in electronics lessons.
Practical Applications
Monitor system values in home automation. Show sensor feedback and diagnostics on a robot. Build an IoT dashboard for remote monitoring. Watch a process value for simple quality control.
Advanced Features
Once one gauge works, you can build a small dashboard with more gauges and charts.
Multiple Gauges
Create one gauge object for each value you want to show, and add each one to the server. Every gauge gets its own page.
Data Logging
A gauge shows only the current value. To see the history too, combine it with the Web Plotter and send the same value to both pages.
Educational Integration
This project is a good classroom tool, because students can see the link between a physical input and a number on the screen.
STEM Learning Objectives
Students learn how analog-to-digital conversion turns a voltage into a number. They explore how sensors measure the physical world. They see real-time web communication in action, and they practice programming with callback functions and data handling.
Classroom Activities
- Compare different sensors and their ranges on the same gauge.
- Calibrate a sensor and discuss accuracy and precision.
- Combine several sensors and gauges into one dashboard.
- Find and fix sensor or display problems as a team.
This example gives you a solid base for analog sensor monitoring and visualization with the ESP32 S3 Uno, for both school projects and practical builds.
FAQ
Do I need a sensor to try the ESP32 S3 Uno web analog gauge?
No. The WebAnalogGauge example simulates a value that sweeps from 0 to 100 and back. You only need the board, a USB cable and a 2.4GHz WiFi network. Add the potentiometer later when you want real data.
Why does the code call analogSetAttenuation(ADC_11db)?
It sets the ESP32 S3 Uno ADC input range to about 0–3.3V, so the full potentiometer signal maps to 0–4095. Without it the range is smaller, and readings reach 4095 too early. The UNO R4 does not need this line, because it is ESP32-only. Keep the sensor output at 3.3V or less.
Can I connect the potentiometer to 5V on the ESP32 S3 Uno?
No. The ESP32 S3 Uno pins work at 3.3V and are not 5V tolerant. If you power the potentiometer from 5V, the middle pin can put up to 5V on A0 (GPIO2) and damage the board. Always power it from the 3.3V pin.
Is this library the same as the DIYables WebApps library for the UNO R4 WiFi?
The web pages and the API are almost the same, but the ESP32 S3 Uno uses the "DIYables ESP32 WebApps" library. The sketch includes DIYables_ESP32_Platform.h and creates an ESP32ServerFactory instead of UnoR4ServerFactory. Raw analog values also go to 4095 instead of 1023.
How can I show a real voltage instead of a percentage?
Change the constructor to DIYablesWebAnalogGaugePage webAnalogGaugePage(0.0, 3.3, "V");. Then convert the reading with analogRead(2) / 4095.0 * 3.3 and send the result. Set the gauge range to match the values you send.
What if my project needs more pins than the Uno headers give?
The ESP32 S3 Uno has two extra rows of holes with more GPIOs: GPIO15 and GPIO16 (I/O, PWM, analog), GPIO45 and GPIO35–GPIO42 (I/O, PWM), and GPIO47/GPIO48 (output only, PWM). Solder pin headers to use them and write the GPIO number in code. For extra analog sensors on more gauges, use GPIO15 or GPIO16, because they have analog input. Be careful with two things. First, GPIO47 and GPIO48 may run at 1.8V instead of 3.3V on some modules (especially ones with "V" in the name, like R8V or R16V), so 3.3V devices can be damaged or act strangely. Second, GPIO0, GPIO3 (D6), GPIO45 and GPIO46 (D9) are boot strapping pins, and a wrong connection can stop the board from booting or uploading code. Use the other extra pins first.
Troubleshooting
| Problem | Possible Cause | Solution |
|---|---|---|
| No COM port in Arduino IDE | USB driver missing or board not in upload mode | Install the CP210x or CH340 driver, try another USB cable, or hold BOOT while you press RESET and upload again |
| Serial Monitor shows "Failed to start WebApp server!" | Wrong WiFi name or password, or a 5GHz network | Check WIFI_SSID and WIFI_PASSWORD and use a 2.4GHz network |
| Web page does not open | Wrong IP address or the device is on another network | Use the IP from the Serial Monitor and connect your phone or PC to the same WiFi |
| Gauge needle does not move | WebSocket blocked or callback not set | Refresh the page, check the firewall, and make sure setupCallbacks() runs after begin() |
| Gauge stays at 0% or 100% with the potentiometer | Signal wire on the wrong pin or loose wiring | Connect the middle pin to A0 (GPIO2) and check the 3.3V and GND wires |
| Gauge reaches 100% before the knob ends | ADC attenuation not set | Keep analogSetAttenuation(ADC_11db) in setup() |
| Values look wrong or out of range | Gauge range does not match the scaling in code | Make the min and max values match what the sketch sends |
| Library not found when compiling | DIYables ESP32 WebApps or its dependencies not installed | Install the library and click Install All for the dependencies |