Arduino Nano 33 IoT - DIYables Bluetooth App Monitor

Overview

In this tutorial, we are going to learn how to use the Bluetooth Monitor feature with the Arduino Nano 33 IoT. The monitor works like a wireless Serial Monitor on your phone — your Arduino sends text messages over BLE and they appear in the app in real time. You can also type commands in the app and send them back to the Arduino. This is especially handy with the Nano 33 IoT's compact size, since you can deploy the board in a project enclosure and still read debug output wirelessly without unplugging anything.

Note: The Arduino Nano 33 IoT 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 Nano 33 IoT Bluetooth Monitor Example - Wireless Serial Monitor via BLE Tutorial

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

Hardware Preparation

1×Arduino Nano 33 IoT
1×Micro USB Cable
1×Recommended: Screw Terminal Expansion Board for Arduino Nano
1×Recommended: Breakout Expansion Board for Arduino Nano
1×Recommended: Power Splitter for Arduino Nano

Or you can buy the following kits:

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 Nano 33 IoT Code

Detailed Instructions

Follow these instructions step by step:

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

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 Configuration const 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 instances DIYables_ArduinoBLE bluetooth(DEVICE_NAME, SERVICE_UUID, TX_UUID, RX_UUID); DIYables_BluetoothServer bluetoothServer(bluetooth); // Create Monitor app instance DIYables_BluetoothMonitor bluetoothMonitor; // Variables for demo unsigned long lastUpdate = 0; const unsigned long UPDATE_INTERVAL = 3000; // Send update every 3 seconds int messageCount = 0; bool ledState = false; void setup() { Serial.begin(9600); while (!Serial); Serial.println("DIYables Bluetooth - Monitor Example"); // Initialize built-in LED pinMode(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"); } else if (cmd == "LED_ON") { digitalWrite(LED_BUILTIN, HIGH); ledState = true; bluetoothMonitor.send("✓ LED turned ON"); } else if (cmd == "LED_OFF") { digitalWrite(LED_BUILTIN, LOW); ledState = false; bluetoothMonitor.send("✓ LED turned OFF"); } else if (cmd == "STATUS") { showStatus(); } else if (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")); // Uptime unsigned long 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__ extern int __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 types if (messageCount % 3 == 0) { // Send status update bluetoothMonitor.send("[INFO] Heartbeat #" + String(messageCount)); } else if (messageCount % 5 == 0) { // Send simulated sensor reading int 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 well Serial.print("Sent update #"); Serial.println(messageCount); } void loop() { // 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 Nano 33 IoT
  • Open the Serial Monitor
  • Check out the result on Serial Monitor. It looks like the below:
COM6
Send
DIYables Bluetooth - Monitor 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 Nano 33 IoT 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_Monitor" in the scan results to connect.
  • If not found, please update the firmware for the Bluetooth module following this guide on How to Upgrade the Firmware on Arduino Nano 33 IoT
  • Once connected, the app automatically goes back to the home screen. Select the Monitor app from the app menu.
DIYables Bluetooth App - Home Screen with Monitor 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 status messages streaming in the monitor display
  • Type LED_ON in the input field and tap Send — the built-in LED on the Arduino Nano 33 IoT will turn ON, and the monitor will display a confirmation message
DIYables Bluetooth App - Monitor Screen

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

COM6
Send
Bluetooth connected! Sent update #1 Sent update #2 Sent update #3
Autoscroll Show timestamp
Clear output
9600 baud  
Newline  

Creative Customization - Adapt the Code to Your Project

Send Messages

// Send text messages to the app bluetoothMonitor.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:

bluetoothMonitor.onMonitorMessage([](const String& message) { Serial.print("Received: "); Serial.println(message); if (message == "HELP") { bluetoothMonitor.send("Commands: LED_ON, LED_OFF, STATUS, HELP"); } else if (message == "LED_ON") { digitalWrite(LED_BUILTIN, HIGH); bluetoothMonitor.send("LED turned ON"); } else if (message == "LED_OFF") { digitalWrite(LED_BUILTIN, LOW); bluetoothMonitor.send("LED turned OFF"); } else if (message == "STATUS") { bluetoothMonitor.send("Uptime: " + String(millis() / 1000) + "s"); bluetoothMonitor.send("LED: " + String(digitalRead(LED_BUILTIN) ? "ON" : "OFF")); } else { bluetoothMonitor.send("Unknown command: " + message); } });

You can add as many custom commands as you need by adding more else if 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.

Programming Examples

Sensor Status Streaming

void loop() { bluetoothServer.loop(); static unsigned long lastUpdate = 0; if (bluetooth.isConnected() && millis() - lastUpdate >= 3000) { lastUpdate = millis(); int light = analogRead(A0); float voltage = analogRead(A1) * 5.0 / 1023.0; bluetoothMonitor.send("[SENSOR] Light: " + String(map(light, 0, 1023, 0, 100)) + "%"); bluetoothMonitor.send("[SENSOR] Voltage: " + String(voltage, 2) + "V"); bluetoothMonitor.send("[INFO] Uptime: " + String(millis() / 1000) + "s"); } delay(10); }

Event-Based Logging

const int BUTTON_PIN = 7; int lastButtonState = HIGH; void loop() { bluetoothServer.loop(); int buttonState = digitalRead(BUTTON_PIN); if (buttonState != lastButtonState) { lastButtonState = buttonState; if (buttonState == LOW) { bluetoothMonitor.send("[EVENT] Button pressed!"); } else { bluetoothMonitor.send("[EVENT] Button released"); } } delay(10); }

Troubleshooting

Common Issues

1. Cannot find the device in the app

  • Make sure the Arduino Nano 33 IoT 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. No messages appearing in the app

  • Verify bluetoothMonitor.send() is being called
  • Check that bluetoothServer.loop() is in the main loop
  • Confirm connection in Serial Monitor

3. Messages are delayed

  • Reduce the update interval for more frequent messages
  • Avoid sending too many messages too quickly (BLE has bandwidth limits)

4. Commands from app not received

  • Verify the onMonitorMessage callback is set up
  • Check Serial Monitor for received command output

5. Connection drops frequently

  • Move closer to the Arduino (reduce distance)
  • Ensure stable USB power supply

6. Upload fails or board not recognized

  • Install the latest Arduino SAMD Boards package via Boards Manager (≥ 1.8.13)
  • Try a different USB cable or port

Project Ideas

  • Wireless debug console
  • Sensor data logger
  • System health monitor
  • Event notification system
  • Remote command interface

Next Steps

After mastering the Bluetooth Monitor example, try:

  1. Bluetooth Chat - For interactive two-way messaging
  2. Bluetooth Table - For structured data display
  3. Bluetooth Plotter - For data visualization
  4. Multiple Bluetooth Apps - Combining monitor 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!