ESP32 - DIYables Bluetooth App Plotter
Overview
The Bluetooth Plotter example provides real-time data plotting on your smartphone through the DIYables Bluetooth STEM app. Designed for ESP32 boards with support for both BLE (Bluetooth Low Energy) and Classic Bluetooth connections. Plot up to 10 data series simultaneously with configurable axes, auto-scaling, legend labels, and scrolling display — perfect for sensor visualization, signal analysis, and data monitoring.
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
- Multi-Series Plotting: Plot up to 10 data series simultaneously
- Real-Time Display: Continuous scrolling graph with live updates
- Configurable Axes: Set custom Y-axis range, axis labels, and plot title
- Auto-Scale: Automatically adjust Y-axis range to fit data
- Custom Legends: Label each data series for easy identification
- Adjustable Samples: Configure number of visible data points
- 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
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_Plotter 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_Plotter 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_Plotter" 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_Plotter"
- For BLE: tap "ESP32BLE_Plotter"
- Once connected, the app automatically goes back to the home screen. Select the Plotter 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.
- Watch the real-time data plot scrolling across the screen

Now look back at the Serial Monitor on Arduino IDE. You will see:
- The plotter displays sine, cosine, and random noise waveforms in real time
Creative Customization - Adapt the Code to Your Project
Configure Plot Settings
Set up the plot appearance before connection:
Send Data to Plotter
Multiple overloads for sending 1 to 4+ data series:
Handle Data Request from App
When the app connects and opens the Plotter screen, it may request data:
Handle Connection Events
How to Use the Plotter
App Interface Controls
The plotter interface in the DIYables Bluetooth App provides:
- Real-Time Graph: Scrolling line chart with multiple series
- Legend: Color-coded labels for each data series
- Auto-Scroll: Continuously scrolls to show latest data
Data Format
Data is sent as comma-separated float values:
- Single series: bluetoothPlotter.send(value)
- Multiple series: bluetoothPlotter.send(val1, val2, val3)
- Data rate: Recommended 10-100ms interval for smooth plotting
Programming Examples
Single Sensor Plot
Multi-Sensor Accelerometer Plot
Analog Pin Plotter
Signal Generator
Advanced Programming Techniques
Moving Average Filter
Dynamic Plot Configuration
BLE vs Classic Bluetooth - Which to Choose?
| Feature | BLE (Esp32BLE_Plotter) | Classic Bluetooth (Esp32Bluetooth_Plotter) |
|---|---|---|
| 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. Plot not updating
- Check Bluetooth connection status in the app
- Verify bluetoothPlotter.send() is being called in the loop
- Check that bluetooth.isConnected() returns true
- Try disconnecting and reconnecting
3. Plot data looks choppy
- Reduce the plot interval (e.g., 50ms instead of 500ms)
- Ensure stable Bluetooth connection
- Reduce number of data series if bandwidth is limited
4. Y-axis range doesn't fit data
- Use enableAutoScale(true) for automatic adjustment
- Or set a wider range with setYAxisRange()
5. Legend labels not showing
- Call setLegendLabels() before the connection is established
- Match the number of labels to the number of data series
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
Sensor Monitoring
- Temperature and humidity trend display
- Light level monitoring throughout the day
- Accelerometer motion tracking
- Pressure sensor data visualization
Signal Analysis
- Audio frequency visualizer
- Vibration monitoring
- Pulse/heart rate display
- Electromagnetic field strength
Education
- Sine, cosine, and tangent wave comparison
- RC circuit charging/discharging curves
- PID controller response visualization
- Physics experiment data logger
Industrial
- Machine vibration monitoring
- Process variable trending
- Power consumption tracking
- Quality control charting
Integration with Other Bluetooth Apps
Combine with Bluetooth Slider
Use sliders to control plotted signal parameters:
Combine with Bluetooth Table
Show current values in table alongside plot:
Next Steps
After mastering the Bluetooth Plotter example, try:
- Bluetooth Temperature - For dedicated temperature display
- Bluetooth Analog Gauge - For gauge-style visualization
- Bluetooth Table - For structured numeric data
- Multiple Bluetooth Apps - Combining plotter with other displays
Support
For additional help:
- Check the API Reference documentation
- Visit DIYables tutorials
- Arduino community forums