ESP32 UNO - DIYables Bluetooth App Temperature
Overview
Want to check a room, a fridge or a fish tank from your phone? An ESP32 Uno Bluetooth temperature gauge does it with no display module. The ESP32 Uno form board pushes each reading, and the DIYables Bluetooth STEM app draws it on a thermometer scale in °C, °F or K. You can run it as a BLE thermometer for Android and iPhone, or over Classic Bluetooth for Android.
By the end, you can:
- Add the DIYables Bluetooth library to Arduino IDE
- Flash a BLE or a Classic Bluetooth temperature sketch to the board
- Link the phone app and watch the thermometer gauge change live
- Pick your own scale, unit and refresh time
- Feed the gauge from a DHT22, a DS18B20 probe or an NTC thermistor

※ NOTE THAT:
The ESP32 Uno radio speaks two kinds of Bluetooth: BLE and Classic. Choose BLE if an iPhone will connect or if you want to skip the pairing step. Choose Classic if only Android phones will connect.
What the Thermometer App Gives You
This table shows what the app already does, so you know which parts you still write.
| Feature | Details |
|---|---|
| Gauge view | A thermometer bar fills up to the reading, with the exact number beside it |
| Scale | The lowest and highest values come from your sketch and can change later |
| Unit label | Any short text, such as °C, °F or K |
| Refresh | The example sends one reading every 2 seconds while a phone is linked |
| On-demand reading | The app can ask the board for the newest value at any moment |
| Two radio modes | BLE for Android and iOS, Classic Bluetooth for Android only |
| Power | BLE uses less current than Classic Bluetooth |
Components You Need
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 .
Buy Note: Many DS18B20 sensors available in the market are unreliable. We strongly recommend buying the sensor from the DIYables brand using the link provided above. We tested it, and it worked reliably.
ESP32 Uno Pinout
Your sketch never uses the printed Uno labels. It uses the GPIO number behind each label, so look up the pin on this map before you plug in a sensor.

Good to know: the main sketch runs with nothing connected. The sensor examples further down use D2 (GPIO26) for a DHT or DS18B20 data line and A3 (GPIO34) for a thermistor.
| Optional Sensor | Sensor Pin | ESP32 Uno Pin |
|---|---|---|
| DHT22 / DHT11 | DATA | D2 (GPIO26) |
| DS18B20 | DATA | D2 (GPIO26) |
| NTC thermistor divider | Middle point | A3 (GPIO34) |
| Any sensor | VCC | 3.3V |
| Any sensor | GND | GND |
WARNING
ESP32 Uno pins work at 3.3V and are not 5V tolerant. Power the DHT or DS18B20 from 3.3V, so its pulled-up data line never goes above 3.3V. A3 (GPIO34) is an input-only pin with no internal pull-up, which is fine for a thermistor divider.
Upload and Test the ESP32 Uno Code
At the end of this part, your phone shows a moving temperature. The test sketch makes up its own values, so you can check the app before you wire a sensor.
Step 1 — Prepare Arduino IDE
- First time with this board? Set it up with ESP32 Uno - Getting Started before you continue.
- Build the circuit by following the wiring table above. For the first run, you can leave all pins free.
- Plug in the USB Type-C cable between the ESP32 Uno and your computer.
- Select the board in Arduino IDE: pick ESP32 Dev Module and the COM port of the board (CH340).
- Give the code more flash: open Tools > Partition Scheme and choose Huge APP (3MB No OTA/1MB SPIFFS). The normal layout has about 1.2 MB for your program, which is too small for the Bluetooth stack.
- Open Library Manager with the Libraries icon on the left side.
- Type "DIYables Bluetooth" in the search box and find the library from DIYables.
- Click Install on the DIYables Bluetooth card.
- Search for DIYables Bluetooth created by DIYables and click the Install button.
- Add the helper libraries: when the IDE lists them, press Install All.
Now upload ONE of the two sketches. Both show the same thermometer; they differ only in the radio type.
Step 2 — Option A: ESP32 Uno Classic Bluetooth Sketch (Android only)
Good to know: Classic Bluetooth does not exist on iPhones. iOS users go to Option B.
- Load the sketch: in Arduino IDE choose File Examples DIYables Bluetooth Esp32Bluetooth_Temperature, or paste the code below into an empty sketch.
- Upload: hit the Upload button.
- Open the Serial Monitor at 115200 baud. After the board restarts you get:
Step 2 — Option B: ESP32 Uno BLE Sketch (Android and iOS)
- Load the sketch: choose File Examples DIYables Bluetooth Esp32BLE_Temperature, or paste the code below.
- Upload it with the Upload button.
- Read the Serial Monitor at 115200 baud:
- Pro tip: if you run two boards at once, give each sketch its own DEVICE_NAME (for example "Kitchen_Temp" and "Garage_Temp"), so you always tap the right one.
Step 3 — Connect the Phone App
When this step is done, the thermometer on your phone follows the board.
- Classic sketch only — pair first: on the Android phone open Settings > Bluetooth, switch Bluetooth on, tap "ESP32_Temp", accept the request (no PIN), and wait for "Paired". The BLE sketch needs no pairing.
- Start the app and allow the access it asks for on first launch:
- Nearby Devices (Android 12 or newer) or Bluetooth (iOS) — to find and link devices
- Location (Android 11 or older) — old Android versions need it for a BLE scan

- Tap your board: "ESP32_Temp" for Classic, or "ESP32BLE_Temp" for BLE. Once linked, the app jumps back to the home screen.
- Open the thermometer: pick Temperature in the app menu.

- Watch the reading: the bar and the number change every 2 seconds.

- Pro tip: the gear icon on the home screen hides apps you do not need. Every screen is explained in the DIYables Bluetooth App User Manual.
In the Serial Monitor, the link and each value now appear:
How the Sketch Works
Here is what each part of the ESP32 Uno sketch does.
| Code Part | What It Does |
|---|---|
| DIYables_Esp32BLE or DIYables_Esp32Bluetooth | Creates the radio link with the name the phone sees |
| DIYables_BluetoothTemperature(-10.0, 50.0, "°C") | Makes the thermometer app with its scale and unit |
| readTemperature() | Returns a test value between 20 and 30 degrees, and is the one spot for your sensor code |
| setOnConnected() | Sends a first reading as soon as a phone links, so the gauge is never empty |
| onTemperatureRequest() | Answers when the app asks for the newest value |
| loop() timer | Sends a fresh reading every 2000 ms, only while bluetooth.isConnected() is true |
The result: the board keeps the phone up to date, and you only touch readTemperature() when you add real hardware.
ESP32 Uno vs UNO R4 for This Project
Moving this thermometer from the UNO R4 WiFi to the ESP32 Uno mostly changes the radio code and the pin numbers.
| Item | Arduino UNO R4 WiFi | ESP32 Uno |
|---|---|---|
| Logic voltage | 5V | 3.3V |
| Bluetooth type | BLE only | BLE and Classic Bluetooth |
| Example sketch | ArduinoBLE_Temperature | Esp32BLE_Temperature or Esp32Bluetooth_Temperature |
| Sensor data pin (DHT or DS18B20) | D2 | D2 (GPIO26), written as 26 in code |
| ADC range for a thermistor | 0 to 1023 (10-bit) | 0 to 4095 (12-bit), plus analogSetAttenuation(ADC_11db) |
| Arduino IDE board | Arduino UNO R4 WiFi | ESP32 Dev Module with the Huge APP partition |
The sensor stays on the same D2 header hole, so your wiring does not move. Power the sensor from 3.3V instead of 5V to protect the ESP32 Uno input.
Shape the Thermometer for Your Project
With a few lines you can make the gauge fit your sensor and your room.
Set the Scale and the Unit
Pass the low end, the high end and the unit when you create the app. You can change all three later, for example from a settings button.
Push a Reading
A number moves the gauge. A short text is handy when the sensor stops answering.
Answer the App When It Asks
The app may ask for a value when the thermometer screen opens. This callback reads the sensor and replies at once.
React to Connect and Disconnect
Reading the Thermometer Screen
Use this to choose a scale that makes the bar easy to read.
| Screen Part | Meaning |
|---|---|
| Thermometer bar | Fills up to the current reading |
| Number | The exact value you sent |
| Unit | The text from your constructor or setUnit() |
| Left and right limits | The low and high values set in your sketch |
| Unit | Constructor |
|---|---|
| Celsius | DIYables_BluetoothTemperature(-10.0, 50.0, "°C") |
| Fahrenheit | DIYables_BluetoothTemperature(14.0, 122.0, "°F") |
| Kelvin | DIYables_BluetoothTemperature(263.0, 323.0, "K") |
Real Sensor Examples
Each example shows only the lines that change. Keep the radio setup from the main sketch.
Example 1 — DHT22 on D2
By the end of this example, the gauge shows the DHT22 room temperature.
| DHT22 Pin | ESP32 Uno Pin |
|---|---|
| VCC | 3.3V |
| GND | GND |
| DATA | D2 (GPIO26) |
Good to know: most DHT modules have a pull-up on DATA already. A bare 4-pin sensor needs a 4.7k to 10k resistor from DATA to 3.3V.
For a DHT11, set DHT_TYPE to DHT11 and keep the same wires.
Example 2 — DS18B20 Probe on D2
By the end of this example, a waterproof probe drives the gauge.
| DS18B20 Wire | ESP32 Uno Pin |
|---|---|
| Red (VCC) | 3.3V |
| Black (GND) | GND |
| Yellow (DATA) | D2 (GPIO26), with a 4.7k resistor to 3.3V |
Example 3 — NTC Thermistor on A3
By the end of this example, a cheap 10k thermistor feeds the gauge through the ESP32 Uno ADC.
| Divider Point | ESP32 Uno Pin |
|---|---|
| Top of the 10k fixed resistor | 3.3V |
| Joint of resistor and thermistor | A3 (GPIO34) |
| Bottom of the thermistor | GND |
Good to know: analogSetAttenuation(ADC_11db) lets the ESP32 Uno analog pin read the full span, from 0V up to about 3.3V. Leave it out and the count tops out at 4095 well below 3.3V, which makes the computed °C value wrong. A3 sits on ADC1, so this example also keeps working if you add WiFi later.
Example 4 — Show the Value in Fahrenheit
This one reads the DHT in Celsius, converts it, and sends °F to the gauge.
Cleaner Readings and Alerts
These two helpers make the gauge calmer and more useful.
Moving Average
The sketch keeps the last 10 values and sends their mean. Small jumps vanish, and a real change still shows within a few seconds.
High and Low Alerts
| Setting | Value | Effect |
|---|---|---|
| HIGH_THRESHOLD | 35.0 | Above it, the app gets "HIGH TEMP ALERT!" |
| LOW_THRESHOLD | 5.0 | Below it, the app gets "LOW TEMP ALERT!" |
| alertActive | true or false | Stops the same alert from repeating until the value is normal again |
Other Sensors That Fit
Any sensor below can drive the gauge. Keep every signal into the board at 3.3V or less.
| Sensor | Interface | ESP32 Uno Pins | Best For |
|---|---|---|---|
| DHT22 or DHT11 | One digital wire | D2 (GPIO26) | Rooms, also gives humidity |
| DS18B20 probe | OneWire | D2 (GPIO26) | Water, soil, outdoors |
| BME280 or BMP280 | I2C | SDA (GPIO21) and SCL (GPIO22), not A4 and A5 | Weather stations with pressure |
| NTC thermistor | Analog divider | A3 (GPIO34) | Low-cost builds |
| MAX6675 or MAX31855 thermocouple | SPI | D10 to D13 (GPIO5, 23, 19, 18) | Ovens and kilns above 1000°C |
BLE or Classic Bluetooth on the ESP32 Uno
Both sketches run on this board. Use the table to pick one.
| Feature | BLE (Esp32BLE_Temperature) | Classic (Esp32Bluetooth_Temperature) |
|---|---|---|
| iPhone | Works | Does not work |
| Android | Works | Works |
| Current draw | Lower | Higher |
| Pairing in phone settings | Not needed | Needed once |
| Name in the scan list | ESP32BLE_Temp | ESP32_Temp |
| Good choice for | Battery builds and mixed phones | Android-only setups |
Debug Helper
If the gauge looks odd, print the value next to the range. Then compare the Serial Monitor with the phone.
Build Ideas
| Area | Ideas |
|---|---|
| Home | Bedroom thermometer, balcony weather box, freezer watch, greenhouse check |
| Kitchen | Bread proofing box, sous vide readout, yogurt maker, smoker probe |
| Tutorial and lab | 3D printer enclosure, server shelf alarm, egg incubator, glue curing box |
| Water | Fish tank, hot tub, boiler pipe, hydroponic tank |
Pair It with Other Bluetooth Apps
One server can host several apps at the same time.
Gauge Plus Plotter
The gauge gives the value now, and the plotter draws the trend.
Gauge Plus Table
The gauge is for a quick look; the table holds the daily low, high and mean.
Try These Next
- ESP32 Uno - Bluetooth Analog Gauge — a needle dial for speed, pressure or voltage
- ESP32 Uno - Bluetooth Plotter — a live chart of the temperature over time
- ESP32 Uno - Bluetooth Table — many sensor values in rows
- ESP32 Uno - Bluetooth Multiple Apps — the thermometer next to other screens
Help and Resources
- The API notes that ship with the DIYables Bluetooth library
- The Arduino community forum
Troubleshooting
| Problem | Possible Cause | Solution |
|---|---|---|
| No COM port shows up | CH340 driver missing or a charge-only cable | Install the CH340 driver and use a USB Type-C cable that carries data |
| Upload stops at "Waiting for download" or "Failed to connect" | The chip did not enter upload mode | Hold the BOOT button while the upload starts, then release it |
| "Sketch too big" when you compile | Default partition has no room for Bluetooth | Choose Tools > Partition Scheme > Huge APP (3MB No OTA/1MB SPIFFS) |
| Board name is missing from the scan list | Sketch not running, phone Bluetooth off, or Classic board not paired | Check the Serial Monitor for "Waiting for Bluetooth connection...", switch on Bluetooth, pair ESP32_Temp first, and on old Android turn on Location |
| iPhone never finds ESP32_Temp | Classic Bluetooth is Android only | Upload the BLE sketch and look for ESP32BLE_Temp |
| DHT gives NaN or DS18B20 gives -127 | Loose DATA wire or no pull-up resistor | Check the wire on D2 (GPIO26), power the sensor from 3.3V, and fit a 4.7k pull-up for the DS18B20 |
| Thermistor value is far off | Divider fed from 5V, wrong pin, or attenuation line removed | Feed the divider from 3.3V, use A3 (GPIO34), and keep analogSetAttenuation(ADC_11db) in setup() |
| Bar sits at one end of the scale | Reading is outside the min and max | Change the constructor range or call setRange() |
| Gauge freezes after a while | bluetoothServer.loop() skipped or long delay() in loop() | Call bluetoothServer.loop() on every pass and keep loop() fast |
FAQ
Does the ESP32 Uno thermometer need a real sensor to start?
No. readTemperature() makes a test value that wanders between 20 and 30 degrees, so the gauge moves with no wiring. Later, put your sensor code inside that function and the rest of the sketch stays the same.
Which sensor is the most accurate for this project?
The DS18B20 and the DHT22 both reach about ±0.5°C, which is plenty for a room or a tank. The DHT11 is rougher, about ±2°C. A thermistor depends on its B value and the resistor tolerance, so it is the least precise but the cheapest.
Should I power the DHT22 from 3.3V or 5V on the ESP32 Uno?
Use 3.3V. The data line is pulled up to the sensor supply, and ESP32 Uno pins are not 5V tolerant. The DHT22 and the DS18B20 both run fine at 3.3V with short wires.
How do I show °F instead of °C?
Create the app with a Fahrenheit range and unit, such as DIYables_BluetoothTemperature(32.0, 122.0, "°F"). Then send Fahrenheit values: dht.readTemperature(true) gives °F, or convert with C × 9 / 5 + 32.
Can one ESP32 Uno show two temperatures on the phone?
The thermometer app shows one value. For two or more sensors, add the Bluetooth Table app next to it, or combine apps as shown in the Multiple Apps tutorial. Two DS18B20 probes can share the D2 (GPIO26) bus and be read with getTempCByIndex(0) and getTempCByIndex(1).
Is the ESP32 Uno code different from the UNO R4 code?
Yes. The UNO R4 WiFi uses ArduinoBLE_Temperature, while the ESP32 Uno uses Esp32BLE_Temperature or Esp32Bluetooth_Temperature from the same DIYables Bluetooth library. The sensor pin number also changes from 2 to 26, even though the wire stays on D2.
Why does the code call analogSetAttenuation(ADC_11db)?
Only the thermistor example has it. The line widens the ESP32 Uno ADC window to roughly 0 to 3.3V, so a full swing on the divider spans 0 to 4095. A narrow window would max out long before 3.3V. Boards like the UNO R4 skip this call; it exists only in the ESP32 core. Never feed the pin more than 3.3V.
Why is the thermistor on A3 and not on A0?
A0 (GPIO2) and A1 (GPIO4) are ADC2 pins, and ADC2 cannot be read while WiFi is on. A3 (GPIO34) is on ADC1, so the same code still works if you later send the value to a web page. A3 is input only, which is fine for reading a sensor.
Can I use Bluetooth and WiFi together on the ESP32 Uno?
Yes, the chip can run both, but they share one antenna and the flash fills up fast. Use the Huge APP partition and expect a slightly slower link. If you only need a phone nearby, Bluetooth alone is simpler.
What if my project needs more pins than the Uno headers give?
The ESP32 Uno has a few extra holes near the power header: GPIO32 and GPIO33 (I/O, PWM, analog on ADC1, so they also work while WiFi is on) and GPIO15 (I/O, PWM, analog on ADC2). Solder pin headers to use them and write the GPIO number in code. A second thermistor fits well on GPIO32 or GPIO33. Two warnings: GPIO15 and GPIO0 (the IO0 pin at the unused Uno NC position) are boot strapping pins, and a wrong connection can stop the board from booting or uploading, so use GPIO32/33 first. Never use the six holes under the digital header (SD0 to SD3, CMD, CLK = GPIO6 to GPIO11), because they are wired to the flash chip and using them crashes the board.