ESP32 - DIYables Bluetooth App Temperature
Overview
The Bluetooth Temperature example provides a dedicated temperature gauge display accessible through the DIYables Bluetooth STEM app. Designed for ESP32 boards with support for both BLE (Bluetooth Low Energy) and Classic Bluetooth connections. Send temperature readings with configurable minimum/maximum range and unit labels — perfect for thermometers, weather stations, HVAC monitoring, and any temperature sensing application.
This example supports two Bluetooth modes:
- ESP32 BLE (Bluetooth Low Energy): Works on both Android and iOS
- ESP32 Classic Bluetooth: Works on Android only. iOS does not support Classic Bluetooth. Use BLE if you need iOS support.

Features
- Temperature Gauge: Visual thermometer-style display
- Configurable Range: Set minimum and maximum temperature values
- Custom Units: Display °C, °F, K, or any custom unit string
- Real-Time Updates: Send live temperature readings
- Request Callback: App can request current temperature on demand
- BLE & Classic Bluetooth: Choose the Bluetooth mode that suits your project
- Cross-Platform: BLE mode works on both Android and iOS; Classic Bluetooth works on Android
- Low Power Option: BLE mode consumes less power than Classic Bluetooth
Hardware Used In This Tutorial
Or you can buy the following kits:
| 1 | × | DIYables ESP32 Starter Kit (ESP32 included) | |
| 1 | × | DIYables Sensor Kit (18 sensors/displays) |
ESP32 Code
Quick Instructions
Follow these instructions step by step:
- If this is your first time using the ESP32, refer to the tutorial on setting up the environment for ESP32 in the Arduino IDE.
- Connect the ESP32 board to your computer using a USB cable.
- Launch the Arduino IDE on your computer.
- Select the appropriate ESP32 board and COM port.
- Navigate to the Libraries icon on the left bar of the Arduino IDE.
- Search "DIYables Bluetooth", then find the DIYables Bluetooth library by DIYables
- Click Install button to install the library.

- You will be asked for installing some other library dependencies
- Click Install All button to install all library dependencies.

Choose one of the two Bluetooth modes below depending on your needs:
ESP32 Classic Bluetooth Code (works with app on Android only)
Note: Classic Bluetooth is NOT supported on iOS. If you need iOS support, use the BLE code below.
- On Arduino IDE, Go to File Examples DIYables Bluetooth Esp32Bluetooth_Temperature example, or copy the above code and paste it to the editor of Arduino IDE
- Click Upload button on Arduino IDE to upload code to ESP32
- Open the Serial Monitor
- Check out the result on Serial Monitor. It looks like the below:
ESP32 BLE Code (works with app on both Android and iOS)
- On Arduino IDE, Go to File Examples DIYables Bluetooth Esp32BLE_Temperature example, or copy the above code and paste it to the editor of Arduino IDE
- Click Upload button on Arduino IDE to upload code to ESP32
- Open the Serial Monitor
- Check out the result on Serial Monitor. It looks like the below:
Mobile App
- If you are using the ESP32 Classic Bluetooth code, you need to pair the ESP32 with your Android phone before opening the app:
- Go to your phone's Settings > Bluetooth
- Make sure Bluetooth is turned on
- Your phone will scan for available devices
- Find and tap "ESP32_Temp" in the list of available devices
- Confirm the pairing request (no PIN required)
- Wait until it shows "Paired" under the device name
- If you are using the ESP32 BLE code, no pairing is needed. Just proceed to the next step.
- Open the DIYables Bluetooth App
- When opening the app for the first time, it will ask for permissions. Please grant the following:
- Nearby Devices permission (Android 12+) / Bluetooth permission (iOS) - required to scan and connect to Bluetooth devices
- Location permission (Android 11 and below only) - required by older Android versions to scan for BLE devices
- Make sure Bluetooth is turned on on your phone
- On the home screen, tap the Connect button. The app will scan for both BLE and Classic Bluetooth devices.

- Find and tap your device in the scan results to connect:
- For Classic Bluetooth: tap "ESP32_Temp"
- For BLE: tap "ESP32BLE_Temp"
- Once connected, the app automatically goes back to the home screen. Select the Temperature app from the app menu.

Note: You can tap the settings icon on the home screen to hide/show apps on the home screen. For more details, see the DIYables Bluetooth App User Manual.
- The temperature gauge will display the current temperature reading

Now look back at the Serial Monitor on Arduino IDE. You will see:
- Watch the temperature gauge update in real time in the app
Creative Customization - Adapt the Code to Your Project
Configure Temperature Range and Unit
Set the display range and unit:
Send Temperature Value
Handle Temperature Requests from App
Handle Connection Events
How to Use the Temperature Display
App Interface
The temperature interface in the DIYables Bluetooth App shows:
- Temperature Gauge: Visual thermometer showing current reading
- Numeric Display: Shows exact temperature value
- Unit Label: Displays the configured unit string
- Range Indicators: Shows min and max of the configured range
Temperature Units
Common configurations:
- Celsius: DIYables_BluetoothTemperature(-10.0, 50.0, "°C")
- Fahrenheit: DIYables_BluetoothTemperature(14.0, 122.0, "°F")
- Kelvin: DIYables_BluetoothTemperature(263.0, 323.0, "K")
Programming Examples
DHT22 Sensor Reading
DS18B20 One-Wire Sensor
NTC Thermistor Reading
Fahrenheit Display
Advanced Programming Techniques
Temperature Averaging / Smoothing
Alert Threshold Detection
Hardware Integration Ideas
DHT22 / DHT11
Connect to any GPIO pin for humidity and temperature readings. Popular choice for indoor monitoring.
DS18B20 Waterproof Probe
Use OneWire protocol for waterproof temperature measurement. Great for liquid, soil, and outdoor applications.
BME280 / BMP280
I2C sensor for temperature, humidity, and barometric pressure. High accuracy for weather stations.
NTC Thermistor
Simple analog temperature sensor. Low cost, works with voltage divider circuit.
Thermocouple (MAX6675 / MAX31855)
For high-temperature measurement (up to 1000°C+). Used in ovens, kilns, and industrial applications.
BLE vs Classic Bluetooth - Which to Choose?
| Feature | BLE (Esp32BLE_Temperature) | Classic Bluetooth (Esp32Bluetooth_Temperature) |
|---|---|---|
| iOS Support | ? Yes | ? No |
| Android Support | ? Yes | ? Yes |
| Power Consumption | Low | Higher |
| Range | ~30-100m | ~10-100m |
| Data Rate | Lower | Higher |
| Pairing Required | No (auto-connect) | Yes (manual pairing) |
| Best For | Battery-powered, cross-platform | High throughput, Android-only |
Troubleshooting
Common Issues
1. Cannot find the device in the app
- Make sure the ESP32 is powered on and the sketch is uploaded
- For BLE: Ensure your phone's Bluetooth and Location are enabled
- For Classic Bluetooth: Pair the device first in phone's Bluetooth settings
- Check that the correct partition scheme is selected (Huge APP)
2. Temperature shows 0 or incorrect value
- Verify sensor wiring and connections
- Check sensor type and library configuration
- Use Serial Monitor to confirm readings before Bluetooth
- For DHT sensors: ensure pull-up resistor (4.7k-10k) on data pin
3. Temperature not updating
- Check your update interval in loop()
- Verify bluetoothServer.loop() is called in the main loop
- Ensure sensor is reading valid values (check for NaN)
4. Gauge display range doesn't match
- Verify constructor parameters: DIYables_BluetoothTemperature(min, max, unit)
- Use setRange() to adjust dynamically
- Temperature values outside the range will still display but may clip
5. Connection drops frequently
- Move closer to the ESP32 (reduce distance)
- For BLE: Check for interference from other BLE devices
- For Classic Bluetooth: Ensure stable power supply to ESP32
6. Sketch too large / not enough space
- In Arduino IDE, go to Tools > Partition Scheme and select "Huge APP (3MB No OTA/1MB SPIFFS)" or "No OTA (Large APP)"
- The default partition scheme only provides ~1.2MB for app code, which is not enough for Bluetooth libraries
- This setting gives ~3MB by sacrificing the OTA (over-the-air update) partition
Debug Tips
Add comprehensive debugging:
Project Ideas
Home & Environment
- Indoor room thermometer
- Outdoor weather station
- Fridge/freezer temperature monitor
- Greenhouse climate monitor
Kitchen & Food
- Cooking temperature monitor
- Sous vide controller display
- Fermentation temperature tracker
- Oven thermometer
Industrial & Lab
- Server room temperature alert
- Chemical process monitor
- Incubator temperature display
- Soldering iron temperature readout
Water & Aquatics
- Aquarium thermometer
- Pool/spa temperature display
- Hot water heater monitor
- Hydroponics water temperature
Integration with Other Bluetooth Apps
Combine with Bluetooth Plotter
Display current reading and plot temperature trend:
Combine with Bluetooth Table
Show temperature alongside other sensor data:
Next Steps
After mastering the Bluetooth Temperature example, try:
- Bluetooth Analog Gauge - For generic gauge display (pressure, speed, etc.)
- Bluetooth Plotter - For visualizing temperature trends over time
- Bluetooth Table - For multi-sensor data display
- Multiple Bluetooth Apps - Combining temperature with other displays
Support
For additional help:
- Check the API Reference documentation
- Visit DIYables tutorials
- Arduino community forums