Arduino UNO R4 - DIYables Bluetooth App Plotter

Overview

The Bluetooth Plotter example streams real-time data to the DIYables Bluetooth STEM app for live visualization. Designed for Arduino UNO R4 WiFi using BLE (Bluetooth Low Energy) plot sensor readings, waveforms, and multi-channel data as real-time graphs on your smartphone. Ideal for data logging, signal analysis, sensor calibration, and science experiments.

Note: The Arduino UNO R4 WiFi only supports BLE (Bluetooth Low Energy). It does not support Classic Bluetooth. The DIYables Bluetooth App supports both BLE and Classic Bluetooth on Android, and BLE on iOS. Since this board uses BLE, the app works on both Android and iOS.

Arduino UNO R4 WiFi Bluetooth Plotter Example - Real-Time Data Visualization via BLE Tutorial

Features

  • Multi-Channel Plotting: Up to 6 data channels simultaneously
  • Configurable Axes: Custom titles, labels, and Y-axis range
  • Legend Labels: Name each data channel for clarity
  • Sample Limit: Set maximum samples to display
  • Fast Streaming: Up to 10 updates per second (100ms interval)
  • Works on Android & iOS: BLE is supported on both platforms
  • No Pairing Required: BLE auto-connects without manual pairing

Hardware Preparation

1×Arduino UNO R4 WiFi
1×Alternatively, DIYables STEM V4 IoT
1×USB Cable Type-A to Type-C (for USB-A PC)
1×USB Cable Type-C to Type-C (for USB-C PC)
1×Recommended: Screw Terminal Block Shield for Arduino UNO R4
1×Recommended: Breadboard Shield for Arduino UNO R4
1×Recommended: Enclosure for Arduino UNO R4
1×Recommended: Power Splitter for Arduino UNO R4
1×Recommended: Prototyping Base Plate & Breadboard Kit for Arduino UNO

Or you can buy the following kits:

1×DIYables STEM V4 IoT Starter Kit (Arduino included)
1×DIYables Sensor Kit (30 sensors/displays)
1×DIYables Sensor Kit (18 sensors/displays)
Disclosure: Some of the links provided in this section are Amazon affiliate links. We may receive a commission for any purchases made through these links at no additional cost to you.
Additionally, some of these links are for products from our own brand, DIYables .

Arduino UNO R4 WiFi Code

Detailed Instructions

Follow these instructions step by step:

  • If this is your first time using the Arduino UNO R4 WiFi, refer to the Arduino UNO R4 WiFi getting started guide.
  • Connect the Arduino UNO R4 WiFi board to your computer using a USB cable.
  • Launch the Arduino IDE on your computer.
  • Select Arduino UNO R4 WiFi board and the appropriate 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.
Arduino UNO R4 DIYables Bluetooth library
  • You will be asked for installing some other library dependencies
  • Click Install All button to install all library dependencies.
Arduino UNO R4 DIYables Bluetooth dependency

BLE Code

  • On Arduino IDE, Go to File Examples DIYables Bluetooth ArduinoBLE_Plotter example, or copy the above code and paste it to the editor of Arduino IDE
/* * DIYables Bluetooth Library - Bluetooth Plotter Example * Works with DIYables Bluetooth STEM app on Android and iOS * * This example demonstrates the Bluetooth Plotter feature: * - Real-time data plotting via Bluetooth * - Plot multiple data series simultaneously * - Configurable plot settings * * Compatible Boards: * - Arduino UNO R4 WiFi * - Arduino Nano 33 BLE / BLE Sense * - Arduino Nano 33 IoT * - Arduino MKR WiFi 1010 * - Arduino Nano RP2040 Connect * - Any board supporting the ArduinoBLE library * * Setup: * 1. Upload the sketch to your Arduino * 2. Open Serial Monitor to see connection status * 3. Use DIYables Bluetooth App to connect and view the plot * * Tutorial: https://diyables.io/bluetooth-app * Author: DIYables */ #include <DIYables_BluetoothServer.h> #include <DIYables_BluetoothPlotter.h> #include <platforms/DIYables_ArduinoBLE.h> // BLE Configuration const char* DEVICE_NAME = "Arduino_Plotter"; const char* SERVICE_UUID = "19B10000-E8F2-537E-4F6C-D104768A1214"; const char* TX_UUID = "19B10001-E8F2-537E-4F6C-D104768A1214"; const char* RX_UUID = "19B10002-E8F2-537E-4F6C-D104768A1214"; // Create Bluetooth instances DIYables_ArduinoBLE bluetooth(DEVICE_NAME, SERVICE_UUID, TX_UUID, RX_UUID); DIYables_BluetoothServer bluetoothServer(bluetooth); // Create Plotter app instance DIYables_BluetoothPlotter bluetoothPlotter; // Variables for generating sample data unsigned long lastPlotTime = 0; const unsigned long PLOT_INTERVAL = 100; // Plot every 100ms float phase = 0; void setup() { Serial.begin(9600); while (!Serial); Serial.println("DIYables Bluetooth - Plotter Example"); // Initialize Bluetooth server with platform-specific implementation bluetoothServer.begin(); // Add plotter app to server bluetoothServer.addApp(&bluetoothPlotter); // Configure plotter settings bluetoothPlotter.setPlotTitle("Sensor Data"); bluetoothPlotter.setAxisLabels("Time", "Value"); bluetoothPlotter.setYAxisRange(-15, 30); // Fixed range bluetoothPlotter.setMaxSamples(100); // Show last 100 samples bluetoothPlotter.setLegendLabels("Sine", "Cosine", "Tangent"); // Custom legend labels // Uncomment to enable auto-scaling instead of fixed range: // bluetoothPlotter.enableAutoScale(true); // Set up connection event callbacks bluetoothServer.setOnConnected([]() { Serial.println("Bluetooth connected!"); }); bluetoothServer.setOnDisconnected([]() { Serial.println("Bluetooth disconnected!"); }); // Optional: Handle requests for current plot data (when app loads) bluetoothPlotter.onDataRequest([]() { // Send initial data when app requests it Serial.println("App requested plot data"); // Could send recent historical data here if needed }); Serial.println("Waiting for Bluetooth connection..."); } void loop() { // Handle Bluetooth server communications bluetoothServer.loop(); // Send plot data at regular intervals if (millis() - lastPlotTime >= PLOT_INTERVAL) { lastPlotTime = millis(); // Generate sample data (sine and cosine waves) float sine = sin(phase); float cosine = cos(phase); float tangent = tan(phase) * 0.3; // Scaled down // Send data to Bluetooth plotter (multiple series) // You can send 1 to 4 values, or use array for more bluetoothPlotter.send(sine, cosine, tangent); // Also print to Serial for Arduino IDE Serial Plotter comparison // Format: value1 value2 value3 (space-separated for Serial Plotter) Serial.print(sine, 2); Serial.print(" "); Serial.print(cosine, 2); Serial.print(" "); Serial.println(tangent, 2); // Alternative methods: // bluetoothPlotter.send(sine); // Single value // bluetoothPlotter.send(sine, cosine); // Two values // float values[] = {sine, cosine, tangent}; // bluetoothPlotter.send(values, 3); // Array of values phase += 0.1; if (phase > 2 * PI) { phase = 0; } // TODO: Replace sample data with your actual sensor readings // Examples: // - Temperature sensor: bluetoothPlotter.send(temperature); // - Accelerometer: bluetoothPlotter.send(accelX, accelY, accelZ); // - Multiple sensors: bluetoothPlotter.send(sensor1, sensor2, sensor3); } delay(10); }
  • Click Upload button on Arduino IDE to upload code to Arduino UNO R4 WiFi
  • Open the Serial Monitor
  • Check out the result on Serial Monitor. It looks like the below:
COM6
Send
DIYables Bluetooth - Plotter Example Waiting for Bluetooth connection...
Autoscroll Show timestamp
Clear output
9600 baud  
Newline  

Mobile App

  • Install the DIYables Bluetooth App on your smartphone: Android | iOS

Note: The DIYables Bluetooth App supports both BLE and Classic Bluetooth on Android, and BLE on iOS. Since the Arduino UNO R4 WiFi uses BLE, the app works on both Android and iOS. No manual pairing is needed for BLE — just scan and connect.

  • 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 BLE devices.
DIYables Bluetooth App - Home Screen with Scan Button
  • Find and tap "Arduino_Plotter" in the scan results to connect.
  • Once connected, the app automatically goes back to the home screen. Select the Plotter app from the app menu.
DIYables Bluetooth App - Home Screen with Plotter App

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.

  • You will see a real-time plot of Sine, Cosine, and Tangent waveforms
DIYables Bluetooth App - Plotter Screen

Now look back at the Serial Monitor on Arduino IDE. You will see:

COM6
Send
Bluetooth connected! Sending plot data... Sine: 0.00, Cosine: 10.00, Tangent: 0.00
Autoscroll Show timestamp
Clear output
9600 baud  
Newline  

Creative Customization - Adapt the Code to Your Project

Configure Plot Appearance

// Set plot title bluetoothPlotter.setPlotTitle("My Sensor Data"); // Set axis labels bluetoothPlotter.setAxisLabels("Time", "Value"); // Set Y-axis range bluetoothPlotter.setYAxisRange(-100, 100); // Set maximum samples to display bluetoothPlotter.setMaxSamples(200); // Set legend labels for each channel bluetoothPlotter.setLegendLabels("Temperature", "Humidity", "Pressure");

Send Data Points

// Send a single value bluetoothPlotter.send(sensorValue); // Send two values bluetoothPlotter.send(temperature, humidity); // Send three values bluetoothPlotter.send(value1, value2, value3); // Send up to six values bluetoothPlotter.send(ch1, ch2, ch3, ch4, ch5, ch6);

Handle Data Request

bluetoothPlotter.onDataRequest([]() { Serial.println("App requested data"); // App just connected or needs initial config });

Programming Examples

Temperature and Humidity Logger

DIYables_BluetoothPlotter bluetoothPlotter(bluetoothServer); void setup() { bluetoothPlotter.setPlotTitle("Environment Monitor"); bluetoothPlotter.setAxisLabels("Time", "Value"); bluetoothPlotter.setYAxisRange(0, 100); bluetoothPlotter.setMaxSamples(100); bluetoothPlotter.setLegendLabels("Temp (°C)", "Humidity (%)"); } void loop() { bluetoothServer.loop(); static unsigned long lastTime = 0; if (millis() - lastTime >= 1000) { lastTime = millis(); float temp = readTemperature(); float humidity = readHumidity(); bluetoothPlotter.send(temp, humidity); } }

Analog Input Plotter

void loop() { bluetoothServer.loop(); static unsigned long lastTime = 0; if (millis() - lastTime >= 100) { lastTime = millis(); int a0 = analogRead(A0); int a1 = analogRead(A1); int a2 = analogRead(A2); bluetoothPlotter.send(a0, a1, a2); } }

Troubleshooting

Common Issues

1. Cannot find the device in the app

  • Make sure the Arduino UNO R4 WiFi is powered on and the sketch is uploaded
  • Ensure your phone's Bluetooth is enabled
  • On Android 11 and below, also enable Location services

2. Plot not updating

  • Verify data is being sent in the loop() function
  • Check that bluetoothServer.loop() is called
  • Ensure the app is on the Plotter screen

3. Data looks wrong or noisy

  • Check sensor wiring and readings
  • Verify Y-axis range matches your data range
  • Consider adding data smoothing/filtering

4. Plot title or labels not appearing

  • Set plot configuration in setup() before connecting
  • Make sure onDataRequest callback re-sends config if needed

5. Upload fails or board not recognized

  • Install the latest Arduino UNO R4 board package via Board Manager
  • Try a different USB cable or port

Project Ideas

  • Environmental monitoring (temperature, humidity, pressure)
  • Accelerometer/gyroscope data visualization
  • Analog sensor calibration tool
  • Signal analysis and comparison
  • Science experiment data logger

Next Steps

After mastering the Bluetooth Plotter example, try:

  1. Bluetooth Table - For structured data display
  2. Bluetooth Monitor - For text-based data display
  3. Bluetooth Temperature - For gauge-style temperature display
  4. Multiple Bluetooth Apps - Combining plotter with other apps

Support

For additional help:

※ OUR MESSAGES

  • As freelancers, We are AVAILABLE for HIRE. See how to outsource your project to us
  • Please feel free to share the link of this tutorial. However, Please do not use our content on any other websites. We invested a lot of effort and time to create the content, please respect our work!