The Bluetooth Monitor example provides a wireless serial monitor accessible through the DIYables Bluetooth STEM app. Designed for Arduino UNO R4 WiFi using BLE (Bluetooth Low Energy) to stream real-time status messages, debug output, and sensor readings wirelessly to your smartphone. Also receive text commands from the app. Perfect for wireless debugging, remote monitoring, and system logging.
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.
Features
Wireless Serial Monitor: Stream text messages to your phone
Two-Way Communication: Send commands from app to Arduino
Real-Time Streaming: Continuous output like Serial Monitor
Command Handling: Process text commands from the app
Works on Android & iOS: BLE is supported on both platforms
No Pairing Required: BLE auto-connects without manual pairing
Low Power: BLE consumes less power than Classic Bluetooth
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 .
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.
You will be asked for installing some other library dependencies
Click Install All button to install all library dependencies.
BLE Code
On Arduino IDE, Go to File Examples DIYables Bluetooth ArduinoBLE_Monitor example, or copy the above code and paste it to the editor of Arduino IDE
/* * DIYables Bluetooth Library - Bluetooth Monitor Example * Works with DIYables Bluetooth STEM app on Android and iOS * * This example demonstrates the Bluetooth Monitor feature: * - Send real-time status messages to the mobile app * - Display system information and sensor readings * - Receive and process commands from the app * - Perfect for debugging and system monitoring * * 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 monitor output * * Tutorial: https://diyables.io/bluetooth-app * Author: DIYables */#include <DIYables_BluetoothServer.h>#include <DIYables_BluetoothMonitor.h>#include <platforms/DIYables_ArduinoBLE.h>// BLE Configurationconst char* DEVICE_NAME = "Arduino_Monitor";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 instancesDIYables_ArduinoBLE bluetooth(DEVICE_NAME, SERVICE_UUID, TX_UUID, RX_UUID);DIYables_BluetoothServer bluetoothServer(bluetooth);// Create Monitor app instanceDIYables_BluetoothMonitor bluetoothMonitor;// Variables for demounsignedlong lastUpdate = 0;constunsignedlong UPDATE_INTERVAL = 3000; // Send update every 3 secondsint messageCount = 0;bool ledState = false;voidsetup() {Serial.begin(9600);while (!Serial);Serial.println("DIYables Bluetooth - Monitor Example");// Initialize built-in LEDpinMode(LED_BUILTIN, OUTPUT);digitalWrite(LED_BUILTIN, LOW);// Initialize Bluetooth server with platform-specific implementation bluetoothServer.begin();// Add monitor app to server bluetoothServer.addApp(&bluetoothMonitor);// Set up connection event callbacks bluetoothServer.setOnConnected([]() {Serial.println("Bluetooth connected!"); bluetoothMonitor.send("=== Arduino Monitor Connected ==="); bluetoothMonitor.send("System Ready"); bluetoothMonitor.send("Type HELP for available commands"); bluetoothMonitor.send(""); }); bluetoothServer.setOnDisconnected([]() {Serial.println("Bluetooth disconnected!"); });// Set up message handler for incoming commands bluetoothMonitor.onMonitorMessage([](const String& message) {Serial.print("Received command: ");Serial.println(message); handleCommand(message); });Serial.println("Waiting for Bluetooth connection...");}void handleCommand(const String& cmd) {if (cmd == "HELP") { bluetoothMonitor.send("Available Commands:"); bluetoothMonitor.send(" LED_ON - Turn LED on"); bluetoothMonitor.send(" LED_OFF - Turn LED off"); bluetoothMonitor.send(" STATUS - Show system status"); bluetoothMonitor.send(" CLEAR - Clear monitor (if supported)"); bluetoothMonitor.send(" HELP - Show this help"); }elseif (cmd == "LED_ON") {digitalWrite(LED_BUILTIN, HIGH); ledState = true; bluetoothMonitor.send("✓ LED turned ON"); }elseif (cmd == "LED_OFF") {digitalWrite(LED_BUILTIN, LOW); ledState = false; bluetoothMonitor.send("✓ LED turned OFF"); }elseif (cmd == "STATUS") { showStatus(); }elseif (cmd == "CLEAR") {// App should handle clearing the display bluetoothMonitor.send(""); }else { bluetoothMonitor.send("✗ Unknown command: " + cmd); bluetoothMonitor.send("Type HELP for available commands"); }}void showStatus() { bluetoothMonitor.send("=== System Status ===");// LED Status bluetoothMonitor.send("LED State: " + String(ledState ? "ON" : "OFF"));// Uptimeunsignedlong uptime = millis() / 1000; bluetoothMonitor.send("Uptime: " + String(uptime / 3600) + "h " + String((uptime % 3600) / 60) + "m " + String(uptime % 60) + "s");// Free Memory (approximate for AVR) #ifdef __AVR__externint __heap_start, *__brkval;int freeMemory = (int) &freeMemory - (__brkval == 0 ? (int) &__heap_start : (int) __brkval); bluetoothMonitor.send("Free Memory: " + String(freeMemory) + " bytes"); #endif// Messages sent bluetoothMonitor.send("Messages Sent: " + String(messageCount)); bluetoothMonitor.send("====================");}void sendPeriodicUpdate() { messageCount++;// Example of different message typesif (messageCount % 3 == 0) {// Send status update bluetoothMonitor.send("[INFO] Heartbeat #" + String(messageCount)); } elseif (messageCount % 5 == 0) {// Send simulated sensor readingint sensorValue = random(0, 1024); bluetoothMonitor.send("[SENSOR] Reading: " + String(sensorValue) + " (random demo value)"); }else {// Send timestamp bluetoothMonitor.send("[TIME] Uptime: " + String(millis() / 1000) + "s"); }// Optionally log to Serial as wellSerial.print("Sent update #");Serial.println(messageCount);}voidloop() {// Handle Bluetooth server communications bluetoothServer.loop();// Send periodic updates (only when connected)if (bluetooth.isConnected() && millis() - lastUpdate >= UPDATE_INTERVAL) { lastUpdate = millis(); sendPeriodicUpdate(); }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:
Newbiely | Arduino IDE 2.3.8
──
☐
✕
File
Edit
Sketch
Tools
Help
Arduino Uno R4 WiFi
Newbiely.ino
···
8Serial.println("Hello World!");
Output
Serial Monitor
Message (Enter to send message to 'Arduino Uno R4 WiFi' on 'COM15')
New Line
9600 baud
DIYables Bluetooth - Monitor Example
Waiting for Bluetooth connection...
Ln 11, Col 1
Arduino Uno R4 WiFi on COM15
2
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.
Find and tap "Arduino_Monitor" in the scan results to connect.
Once connected, the app automatically goes back to the home screen. Select the Monitor 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.
You will see status messages streaming in the monitor display
Type LED_ON in the input field and tap Send — the built-in LED on the Arduino UNO R4 WiFi will turn ON, and the monitor will display a confirmation message
Now look back at the Serial Monitor on Arduino IDE. You will see:
Newbiely | Arduino IDE 2.3.8
──
☐
✕
File
Edit
Sketch
Tools
Help
Arduino Uno R4 WiFi
Newbiely.ino
···
8Serial.println("Hello World!");
Output
Serial Monitor
Message (Enter to send message to 'Arduino Uno R4 WiFi' on 'COM15')
New Line
9600 baud
Bluetooth connected!
Sent update #1
Sent update #2
Sent update #3
Ln 11, Col 1
Arduino Uno R4 WiFi on COM15
2
Creative Customization - Adapt the Code to Your Project
Send Messages
// Send text messages to the appbluetoothMonitor.send("System started");bluetoothMonitor.send("Temperature: " + String(temp, 1) + " °C");bluetoothMonitor.send("[ERROR] Sensor disconnected!");
Handle Incoming Commands
Use the onMonitorMessage() callback to receive commands typed in the Monitor app and react to them:
You can add as many custom commands as you need by adding more elseif blocks. For example, add RELAY_ON / RELAY_OFF to control a relay, or READ to trigger a sensor reading — any word you type in the app becomes a command.
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!