BleuIO, a versatile BLE USB dongle, simplifies BLE application development with its powerful AT commands and cross-platform compatibility. This tutorial demonstrates how to use BleuIO with Python to build a real-time BLE proximity-based LED control system.
In this example, we focus on monitoring the RSSI (Received Signal Strength Indicator) of a specific BLE device and controlling the LED blinking rate of BleuIO based on proximity. The closer the device, the faster the blinking rate. The script also ensures clean termination, turning off the LED when the program exits.
This tutorial uses the BleuIO Python library to showcase a practical use case. However, the concepts can be implemented in any programming language.
Graceful Termination: The script turns off the LED when terminated with Ctrl + C.
Output
This example demonstrates how easy it is to use BleuIO for BLE applications. Whether you’re building proximity-based solutions or exploring BLE capabilities, BleuIO’s AT commands and Python library make it simple to get started.
Take this script, adapt it to your needs, and unlock the potential of BLE with BleuIO!
Bluetooth Low Energy (BLE) has become a core technology in the modern world, enabling secure and efficient communication for IoT devices, wearables, healthcare gadgets, and more. One of the fascinating applications of BLE is in creating private communication systems. In this tutorial, we will explore how to create a BLE chat application using the BleuIO USB dongle, a powerful yet simple device for BLE application development.
Why This Project?
With increasing concerns about privacy, BLE chat offers a solution that keeps communication entirely local. Unlike internet-based messaging systems, BLE chat does not rely on servers or cloud storage, ensuring that no data leaves your devices. This project demonstrates a simple prototype of such a BLE-based communication system.
How It Works
The project involves two laptops, each connected to a BleuIO USB dongle. For simplicity, we designate one laptop as User 1 (Central role) and the other as User 2 (Peripheral role). Here’s a high-level breakdown of the workflow:
Setup: Each laptop runs a script to initialize its BleuIO dongle. User 1 starts in a dual role and acts as the central device. User 2 also sets its dongle in a dual role but begins advertising itself.
Connection: Once User 2 starts advertising, it displays its MAC address. User 1 uses this MAC address to connect to User 2.
Messaging: After establishing a connection, the users can send and receive messages in real time. The communication is direct and local, with no reliance on external servers.
Setting Up the Project
The source code for this project is available on GitHub: BLE Chat Source Code. You can explore, experiment, and build on it to fit your needs.
Steps to Set Up the Project:
Clone the Repository Open a terminal on both computers and run git clone https://github.com/smart-sensor-devices-ab/ble-chat.git
Install Dependencies Navigate to the project directory and install the required Node.js dependencies cd ble-chat npm install
Run the Server Start the server by running node server.js Ensure the server is running on both computers. The terminal should display messages confirming the dongle is detected.
Running the Scripts
Once the servers are running on both computers, follow these steps to use the BLE chat application:
User 1 Setup:
Open the browser and navigate to http://localhost:3000.
Click “Chat as User 1.” This will initialize the BleuIO dongle in dual role mode.
User 2 Setup:
On the second computer, open the browser and navigate to http://localhost:3000.
Click “Chat as User 2.” This will initialize the BleuIO dongle in dual role mode and start advertising. You’ll also see the MAC address of the dongle displayed on the screen.
Connecting the Devices:
Copy the MAC address from User 2’s screen and enter it on User 1’s screen in the provided input field.
Click “Connect” on User 1. Once the connection is established, you’ll see a confirmation message.
Start Chatting:
Use the chat interface on both devices to send messages back and forth. Messages sent from one device will instantly appear on the other device’s screen.
Output
In the video below, we demonstrate how this project works with two BleuIO dongles connected to two different computers. To provide a complete view, we are sharing the screen of the second computer to showcase how the chat functions in real-time.
Use Cases for BLE Chat
The BLE chat prototype we’ve created can inspire real-world applications. Here are some potential use cases:
Secure Local Communication: BLE chat can be used for private messaging within offices, factories, or homes without the need for internet connectivity.
Education Projects: BLE chat can be a great project for students learning about BLE technology and its applications.
Why Choose BleuIO for Your BLE Projects?
The BleuIO USB dongle makes BLE application development accessible for everyone, from beginners to advanced developers. Its built-in AT commands allow you to quickly prototype applications without diving into complex BLE stacks or SDKs. Whether you’re working on a small hobby project or an enterprise-level IoT solution, BleuIO provides the tools you need.
Here are some standout features of BleuIO:
Cross-Platform Compatibility: Works seamlessly on Windows, macOS, and Linux.
Simple AT Commands: No need for extensive coding; just use the built-in commands to control the dongle.
Lightweight and Portable: Easy to carry and set up for on-the-go development.
This BLE chat application demonstrates the power and simplicity of BLE communication using the BleuIO USB dongle. While it’s a prototype, it showcases how BLE can enable private, secure, and efficient messaging without relying on external networks.
If you’re interested in exploring this further, the source code for the project is available. You can modify and extend it to fit your specific needs. With BleuIO, the possibilities are endless.
Order Your BleuIO USB Dongle Today! Ready to create your own BLE applications? Visit BleuIO’s to learn more and order your dongle today.
This article will discuss about accessing a Bluetooth Low Energy (BLE) device—specifically the BleuIO BLE USB dongle—from a cloud-based computer. This setup is invaluable for developers, researchers, and organizations that need to control or monitor BLE devices located in remote or hard-to-reach locations. We will explain how to set up both local and cloud servers, and how to establish a secure connection between them, allowing you to send commands and receive data from a remote BLE device with ease.
Why Do We Need Remote Access to BLE Devices?
Remote access to BLE devices opens up new possibilities in IoT, distributed applications, and various remote monitoring and management scenarios. Here are a few key use cases where this approach can be especially beneficial:
Remote Device Monitoring: In scenarios where BLE devices like sensors or trackers are deployed in different physical locations—such as environmental monitoring stations, healthcare devices in hospitals, or industrial sensors in manufacturing facilities—remote access allows centralized monitoring and control. For example, an environmental monitoring company could deploy BLE sensors in different regions and access data from all devices from a single central hub.
Distributed Development and Testing: Developers and QA engineers can use remote access for testing and debugging BLE applications from any location, without needing to be physically near the BLE devices. This is particularly useful for teams working on IoT applications who want to test BLE functionality across different device types or networks. For instance, a developer could work on BLE application features from home, while the test device is connected to a machine in the office.
Centralized Management of BLE Devices: Organizations that manage multiple BLE devices across various locations, such as in retail stores, hospitals, or warehouses, can benefit from a centralized server setup to communicate with and manage all devices remotely. A central server could send updates, retrieve data, or manage configurations for multiple BLE devices, providing an efficient and scalable solution for distributed IoT applications.
Remote Troubleshooting and Maintenance: For businesses that deploy BLE devices at customer sites or in field locations, remote access allows technical support teams to troubleshoot issues without requiring on-site visits. This can reduce downtime and improve customer satisfaction. For example, a support technician could diagnose issues with a BLE-enabled device at a remote client site, identifying and resolving problems directly from the company’s central office.
By using BleuIO with AT commands, we make BLE application development much simpler and more accessible. The BleuIO dongle is compatible with Windows, macOS, and Linux, allowing consistent development across platforms.
Project Structure and Components
In this project, we’ll use the following components to remotely access and control BLE devices:
Device with BleuIO Connected (Local Device): This is the device with the BleuIO dongle physically attached, acting as the local interface for sending and receiving BLE commands. It will run a small server to manage communication with the BLE dongle over a serial connection.
Remote Access Server (Cloud Server): This is the server that provides remote access to the local device. By connecting to the local server, it enables us to send commands and receive data from the BLE dongle remotely.
LocalTunnel: We’ll use LocalTunnel to generate a secure public URL, allowing the cloud server to communicate with the local device without needing complex router configurations. This URL acts as a bridge, making the local device accessible from anywhere with internet access.
Node.js: Both the local device and the cloud server will use Node.js to run simple server scripts that facilitate communication between the cloud server and the BLE dongle.
Step-by-Step Guide
Step 1: Setting Up the Local Server with BleuIO dongle connected to it
Local device is where the BleuIO dongle is physically connected. We’ll set up a Node.js server that communicates with the dongle through the serial port. This server will accept commands from the cloud server and send them to the BLE dongle, then return the response.
Install Node.js (if not already installed) on Local device.
Create a project folder and initialize a Node.js project: mkdir local_serial_server cd local_serial_server npm init -y
Install Dependencies:
Install serialport to handle serial communication with the BLE dongle.Install socket.io to manage WebSocket connections.
npm install serialport socket.io
Create the Local Serial Server Script:
Create a file named local_serial_server.js. This script will:
Listen for WebSocket connections from the cloud server.Accept commands, pass them to the BleuIO dongle, and send back responses.
const server = http.createServer(); const io = socketIo(server);
// Define the serial port path and baud rate const portPath = 'COM592'; // Replace 'COM3' with your dongle's port const serialPort = new SerialPort({ path: portPath, baudRate: 9600 });
// Listen for incoming connections from the cloud server io.on('connection', (socket) => { console.log('Connected to cloud server');
// Receive command from cloud and send to serial port socket.on('sendCommand', (command) => { const formattedCommand = `${command}\r\n`; console.log(`Sending command to serial port: ${formattedCommand}`); serialPort.write(formattedCommand); });
// Send serial responses to cloud server serialPort.on('data', (data) => { console.log(`Data received from serial port: ${data}`); socket.emit('serialResponse', data.toString()); }); });
// Start the server on a specified port const LOCAL_PORT = 4000; // Choose any port, ensure firewall allows it server.listen(LOCAL_PORT, () => { console.log(`Local Serial Server running on http://localhost:${LOCAL_PORT}`); });
Find and Set the Serial Port Path:
In your local_serial_server.js, specify the correct serial port path for your BLE dongle (e.g., COM3 on Windows or /dev/ttyUSB0 on Linux).
Run the Local Serial Server:
Start the server by running: node local_serial_server.js
At this point, the local server is ready, but it’s only accessible to itself. Next, we’ll use LocalTunnel to make it accessible to the cloud server.
Step 2: Exposing the Local Server to the Internet Using LocalTunnel
Since local device 1 and cloud device are on different networks, we’ll need to create a public URL for the local server. There are several options to make a local server accessible publicly, including tools like ngrok, Pagekite, and LocalTunnel. For this tutorial, we’ll be using LocalTunnel as it’s free and easy to set up, but feel free to explore other solutions if they better meet your needs.
Install LocalTunnel:
On local device, install LocalTunnel globally npm install -g localtunnel
Start LocalTunnel:
Open a new terminal window on local device and run lt --port 4000
LocalTunnel will generate a public URL (e.g., https://five-sides-live.loca.lt). This URL will allow cloud device to access the local server running on port 4000 of Local device.
Save the LocalTunnel URL:
Copy the URL provided by LocalTunnel. This URL will be used in the cloud server configuration on Cloud device.
Step 3: Setting Up the Cloud Server on Cloud device
In this setup, Cloud device will act as the cloud server that connects to local device’s LocalTunnel URL, allowing remote access to the BLE dongle. Cloud device can be any machine with Node.js installed—located anywhere, such as a remote computer in New York. You could also deploy this server on a cloud platform like Heroku, Replit, or Vercel for persistent access.
For simplicity, in this example, we’ll demonstrate how to set up the cloud server on another computer running Node.js, not connected to the same network as local device.
Create a Project Folder on cloud device and Initialize Node.js:
Open a terminal or command prompt on cloud device and create a folder for the cloud server mkdir cloud_serial_server cd cloud_serial_server npm init -y
Install Dependencies:
You’ll need express to serve the front-end pages and socket.io to manage WebSocket communication.
Install socket.io-client to allow the cloud server to connect to the LocalTunnel URL created on Local device npm install express socket.io socket.io-client
Create the Cloud Server Script: In the cloud_serial_server folder, create a file named cloud_server.js. This script will Connect to the LocalTunnel URL (generated by Local device) and forward BLE commands to the local server.Serve the front-end pages (index.html and page2.html) for interacting with the BLE device remotely.
const express = require('express');
const http = require('http');
const socketIo = require('socket.io');
const ioClient = require('socket.io-client'); // Client for local serial server
const app = express();
const server = http.createServer(app);
const io = socketIo(server);
// Connect to the local serial server via WebSocket
const LOCAL_SERVER_URL = 'https://real-poets-count.loca.lt';
const localSocket = ioClient(LOCAL_SERVER_URL);
// Serve static files (frontend files for Page 1 and Page 2)
app.use(express.static('public'));
// Handle messages from Page 2 and forward to local serial server
io.on('connection', (socket) => {
console.log('Client connected to cloud server');
// Receive command from Page 2 and forward to local serial server
socket.on('sendCommand', (command) => {
console.log(`Forwarding command to local server: ${command}`);
localSocket.emit('sendCommand', command); // Send to local serial server
});
socket.on('disconnect', () => {
console.log('Client disconnected from cloud server');
});
});
// Receive data from local serial server and forward to clients
localSocket.on('serialResponse', (data) => {
console.log(`Received data from local serial server: ${data}`);
io.emit('serialResponse', data); // Broadcast to connected clients
});
const PORT = process.env.PORT || 3000;
server.listen(PORT, () => {
console.log(`Cloud server is running on http://localhost:${PORT}`);
});
Update the LocalTunnel URL in Cloud Server:
Replace the LOCAL_SERVER_URL in cloud_server.js with the LocalTunnel URL you generated on Local device (e.g., https://five-sides-live.loca.lt).
Run the Cloud Server:
Start the cloud server by running:bashCopy codenode cloud_server.js
This will start a server that listens for connections on Cloud device. You can open a web browser on Cloud device and go to http://localhost:3000 to access the front-end pages.
Access the Front-End Pages:
Open a browser and navigate to http://localhost:3000/index.html (for displaying BLE responses) and http://localhost:3000/page2.html (for sending commands).
Note: If you decide to deploy this server to a cloud platform (e.g., Heroku, Replit, or Vercel), replace localhost with the appropriate URL provided by the platform.
With this setup, Cloud device can be anywhere in the world, allowing you to control and receive data from the BLE dongle on Local device (in Stockholm) remotely.
This tutorial demonstrates the potential of combining Node.js, BLE technology, and tunneling services for remote BLE access. The BleuIO dongle’s compatibility and simplicity make it an excellent choice for developers interested in building BLE applications across various operating systems.
This article takes a deep dive into the capabilities of BleuIO, exploring how it can simplify BLE application testing, especially in complex environments like IoT, health, automotive, and smart home applications. Whether you are a seasoned developer or a newcomer, BleuIO provides a reliable, versatile tool to jumpstart your BLE projects. We’ll also cover an example project, the BLE Connectivity Test Tool, to illustrate BleuIO’s ease of use and the possibilities it opens up for developers.
Example Project: Building a BLE Connectivity Test Tool
To demonstrate the practicality and ease of using BleuIO, let’s look at a sample project: a BLE Connectivity Test Tool. This tool allows developers to test the connection stability of a BLE device, such as the HibouAir air quality monitor, by performing repeated connection and disconnection attempts. This example showcases how easy it is to set up a real-world testing scenario with BleuIO, perfect for those looking to explore connectivity applications.
This BLE Connectivity Test Tool will:
Scan for the HibouAir Device: Use BleuIO to locate the device based on its BLE address.
Initiate Connections: Repeatedly connect and disconnect from the HibouAir device, tracking the success and failure of each attempt.
Log Results: Display a summary at the end, indicating successful connections and any errors encountered.
Code Overview
The Python script below uses the official BleuIO Python library, which simplifies interaction with BLE devices. It uses AT commands to set the dongle in central mode, initiate connections, and disconnect after a set duration.
import time
from datetime import datetime
from bleuio_lib.bleuio_funcs import BleuIO
# Initialize the BleuIO dongle
dongle = BleuIO()
# Device address of HibouAir (replace with your actual address if different)
device_address = "[1]D1:79:29:DB:CB:CC"
# Number of connection attempts
test_count = 5
# Duration to stay connected in seconds
connect_duration = 2
# Delay between connection attempts
delay_between_tests = 5
# Counters for tracking connection results
successful_connections = 0
successful_disconnections = 0
connection_failures = 0
# Register scan callback to handle scanned device responses
def my_scan_callback(scan_input):
print("\n\nScan Result: " + str(scan_input))
# Register event callback to handle connection events with timestamps
def my_evt_callback(evt_input):
cbTime = datetime.now()
currentTime = cbTime.strftime("%H:%M:%S")
print("\n\n[" + str(currentTime) + "] Event: " + str(evt_input))
# Set up the callback functions
dongle.register_evt_cb(my_evt_callback)
dongle.register_scan_cb(my_scan_callback)
# Set the BLE role to central to initiate connections
dongle.at_central()
# Start the connection test
print("Starting BLE Connectivity Test with HibouAir device...\n")
for i in range(test_count):
print(f"\nAttempt {i+1}/{test_count}")
# Connect to the device
connect_response = dongle.at_gapconnect(device_address)
if connect_response.Ack.get("err") == 0: # Check if the connection was successful
print("Connection successful!")
successful_connections += 1
time.sleep(connect_duration) # Stay connected for the specified duration
# Disconnect
disconnect_response = dongle.at_gapdisconnect()
if disconnect_response.Ack.get("err") == 0:
print("Disconnected successfully.")
successful_disconnections += 1
else:
print("Error during disconnect:", disconnect_response.Ack.get("errMsg"))
connection_failures += 1
else:
print("Connection failed:", connect_response.Ack.get("errMsg"))
connection_failures += 1
# Wait before the next attempt
time.sleep(delay_between_tests)
# Display test results summary
print("\nConnectivity Test Summary:")
print(f"Total Connection Attempts: {test_count}")
print(f"Successful Connections: {successful_connections}")
print(f"Successful Disconnections: {successful_disconnections}")
print(f"Failures: {connection_failures}")
This tool’s simplicity shows how BleuIO can be used in the development and testing process, making it a preferred choice for developers who want to avoid BLE’s traditional complexities.
Output
Real-World Applications of BleuIO
IoT Device Testing: From smart home devices to industrial sensors, BleuIO is invaluable for testing the connectivity and data transmission of IoT devices.
Wearable Tech Development: For developers working on BLE-enabled wearables like fitness trackers or health monitors, BleuIO provides a straightforward way to test device connectivity.
Educational and Prototyping Tool: BleuIO’s ease of use makes it an excellent educational tool for introducing BLE concepts to students and rapid prototyping for startups.
Environmental Monitoring: As demonstrated with the HibouAir air quality monitor, BleuIO facilitates connectivity testing in applications involving environmental data, like CO2 monitoring, temperature, and humidity.
Why BleuIO for BLE Development?
Developing BLE applications often requires specialized hardware and software expertise. Traditional BLE development involves understanding intricate details of Bluetooth stacks, profiles, and data protocols. BleuIO alleviates this by offering a straightforward command structure that abstracts the technical details, allowing developers to quickly build and test applications.
In addition, BleuIO’s compact design makes it suitable for portable applications and rapid prototyping. From sensor connectivity to device tracking and monitoring, BleuIO proves to be a versatile asset for a range of BLE applications.
BleuIO offers an all-in-one solution for BLE development, bridging the gap between beginner-friendly usability and powerful functionality. With support for multiple platforms, easy integration with popular programming languages, and straightforward AT command access, BleuIO empowers developers to quickly and efficiently test, prototype, and deploy BLE applications.
By using tools like the BLE Connectivity Test Tool, developers can focus on creating innovative applications without needing to dive deep into the complexities of BLE. BleuIO enables developers to bring their ideas to life, from IoT to healthcare and beyond. Start your BLE development journey with BleuIO today and see the difference in ease and efficiency it brings to your projects.
Introduction This project demonstrates how to integrate the Renesas EK-RA4M2 development board with the Renesas CO2 Sensor (RRH47000) and the new BleuIO Pro Dongle (SSD025) by Smart Sensor Devices, built on the Renesas Bluetooth Low Energy SoC DA14695. In this setup, the dongle advertises sensor data from the CO2 sensor, including CO2 concentration, humidity, and temperature.
The sensor data is displayed using the RTT Viewer.
Connect a Micro USB device cable (Type-A male to Micro-B male) between J10 (Debug1) on the EK-RA4M2 and a computer’s USB port.
Plug in the BleuIO Dongle using a USB OTG Cable (Type-A female to Micro-B male) and connect it to J11 (USB Full Speed).
Ensure that Jumper J12 is placed on pins 1-2.
Remove Jumper J15 pins.
Setting up PMOD1 The RRH47000 sensor connects via PMOD1. Since the sensor requires 5V, and PMOD by default provides 3.3V, some modifications are necessary:
For 5V the PMOD1 Config trace cut jumper E17 must be Short and E16 be Open. For I2C SCL E18 need to be Short and E14 need to be Open. For I2C SDA E19 need to be Short and E15 need to be Open.
The PMOD1 config can be found on the back of the RA4M2:
Importing the Project
Open e² studio IDE
Choose a workspace and click ‘Launch’
Download or clone the example project. Place the folder ‘bleuio_ra4m2_co2_monitor_example’ in workspace.
Choose Import Project
Select ‘Existing Projects into Workspace’ under the ‘General’ tab:
Click the ‘Browse…’ button and open folder where the ‘bleuio_ra4m2_co2_monitor_example’ project folder is located:
Finally select the project and click ‘Finish’. You have now imported the the project!
Running the Example
Build the project by clicking the building icon:
Use Debug to download and run the project. The first time you need to configure the debug settings. Click down arrow to the right of the Debug icon and select ‘Debug Configurations…’
Under ‘Renesas GDB Hardware Debugging’ select ‘bleuio_ra4m2_co2_monitor_example.elf’ and click ‘Debug’.
The debug is now configured and the ‘Debug’ icon can be used next time to run the project.
Open RTTViewer. Connect and use these settings:
Connection to J-Link: USB
Specify Target Device: R7FA4M2AD
Target Interface & Speed: SWD 4000kHz
RTT Control Block: Address 0x200009ac
On the debugger screen in e² studio click the ‘Resume’ icon twice to run the project.
The application is now running. When starting up you should notice all LEDs lighting up for one second then only the red LED will be on. It will turn off as soon as the BleuIO is configured and the green LED will turn on when advertising start.
You should now see the output on the RTTViewer.
Scanning the Dongle To view the advertised data, use an app like nRF Connect.
Decoding the Advertising Message The advertising data format is as follows:
020106: Default advertising flag for connectable devices.
09FF3600026E173E1D27: Manufacturer-specific data.
09: Message size.
FF: Manufacturer Specific Data flag.
3600: Renesas Manufacturer ID (little-endian).
026E: CO2 value in hex (622 in decimal).
173E: Temperature value, split into two bytes (23.62°C).
1D27: Humidity value, split into two bytes (29.39%).
This example serves as a foundational guide for integrating the Renesas EK-RA4M2 development board with a CO2 sensor and the BleuIO Pro Dongle for real-time monitoring. With its flexible setup, you can extend this project to suit your specific applications, such as real-time air quality monitoring, smart building systems, or other IoT-based environmental solutions. By leveraging the capabilities of the BleuIO Pro and Renesas platform, you can create robust, scalable solutions for your next Bluetooth Low Energy (BLE) project.
In today’s fast-paced world, flexibility and mobility in development are crucial. Whether you’re on the go or just want the convenience of working from your mobile device, having the ability to connect and interact with your development tools directly from your smartphone or tablet can be a game-changer. This article will guide you through a groundbreaking way to connect the BleuIO USB dongle to your mobile device using the Web Serial API. This tutorial will not only introduce you to the BleuIO dongle’s capabilities but also show you how to harness the power of BLE (Bluetooth Low Energy) on your mobile device with custom AT commands. By the end of this guide, you’ll be ready to run BLE scripts directly from your mobile browser, making BLE development more accessible and portable than ever.
Why This Matters
BleuIO is a versatile USB dongle that allows developers to easily add Bluetooth Low Energy (BLE) capabilities to their projects. Traditionally, connecting BLE devices to a mobile device required specialized apps or programming with platform-specific APIs. However, with the advent of the Web Serial API, it’s now possible to interact with BLE devices directly from a web browser, even on mobile devices. This means you can execute AT commands, scan for nearby BLE devices, and even build custom BLE applications right from your mobile browser.
This article is designed to help you leverage these capabilities, making BleuIO more accessible and useful whether you’re in the office, at home, or on the move. By following this tutorial, you’ll not only learn how to connect and communicate with BleuIO using your mobile device but also gain insight into how to integrate these features into your own BLE applications.
Getting Started: What You’ll Need
BleuIO USB Dongle: The star of this tutorial, a compact USB device that adds BLE functionality to any device with a USB port.
Mobile Device: A smartphone or tablet with a USB OTG (On-The-Go) adapter to connect the BleuIO dongle.
Web Browser: A modern web browser that supports the Web Serial API. For this tutorial, we’ll focus on Google Chrome for Android.
A Simple HTML/JavaScript Setup: We’ll walk through creating a basic web interface to send and receive AT commands from the BleuIO dongle.
Step 1: Setting Up Your Development Environment
Before diving into the code, let’s ensure your mobile device is ready. Here’s a quick checklist:
Connect BleuIO to Your Mobile Device: Use a USB OTG adapter to connect the BleuIO dongle to your smartphone or tablet.
Install a Compatible Browser: Ensure you have Google Chrome installed on your device. As of the time of writing, Chrome is one of the few mobile browsers that support the Web Serial API.
Step 2: Writing the Web Interface
Next, we’ll create a simple web interface that will allow you to connect to the BleuIO dongle, send AT commands, and display the responses. Below is the code we’ll use:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Web Serial API with BleuIO</title>
<link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH"
crossorigin="anonymous"
/>
<script type="module">
import { serial as webSerialPolyfill } from 'web-serial-polyfill@1.0.15';
// Use webSerialPolyfill as you would navigator.serial.
</script>
</head>
<body>
<div class="container mt-5">
<h1>BleuIO dongle Communication for Mobile browser</h1>
<br /><br />
<div class="row">
<div class="col-md-6">
<button id="connect" class="btn btn-success">
Connect to BleuIO
</button>
<button id="disconnect" class="btn btn-danger" style="display: none">
Disconnect
</button>
<br /><br /><br /><br />
<div id="command-section" style="display: none">
Basic command <br />
<button id="scanBtn" class="btn btn-primary">
Scan for nearby BLE devices (AT+GAPSCAN=3)
</button>
<br />
<br />
Write your own AT commands
<input
type="text"
id="inputData"
class="form-control"
placeholder="Write AT commands"
/><br />
<button id="send" class="btn btn-warning">Send</button>
</div>
</div>
<div class="col-md-6">
<h4>Output</h4>
<br />
<textarea
id="output"
style="height: 500px; width: 100%; border: 1px solid grey"
class="rounded p-4"
placeholder="Output will appear here..."
readonly
></textarea>
</div>
</div>
</div>
<script type="module" crossorigin>
import { serial as webSerialPolyfill } from 'https://cdn.jsdelivr.net/npm/web-serial-polyfill@1.0.15';
var serial_module = null;
if ('serial' in navigator) {
serial_module = navigator.serial;
} else {
if ('usb' in navigator) {
serial_module = webSerialPolyfill;
}
}
let port;
let reader;
const connectButton = document.getElementById('connect');
const disconnectButton = document.getElementById('disconnect');
const sendButton = document.getElementById('send');
const outputArea = document.getElementById('output');
const inputField = document.getElementById('inputData');
const commandSection = document.getElementById('command-section');
connectButton.addEventListener('click', async () => {
try {
port = await serial_module.requestPort();
await port.open({ baudRate: 9600 });
reader = port.readable.getReader();
// Hide connect button, show disconnect button and command section
connectButton.style.display = 'none';
disconnectButton.style.display = 'block';
commandSection.style.display = 'block';
while (true) {
const { value, done } = await reader.read();
if (done) {
reader.releaseLock();
break;
}
outputArea.value += new TextDecoder().decode(value);
}
} catch (error) {
console.error('Failed to connect:', error);
alert(
'Failed to connect to the device. Please try again.',
JSON.stringify(error)
);
}
});
disconnectButton.addEventListener('click', async () => {
try {
if (reader) {
reader.cancel();
reader = null;
}
if (port) {
await port.close();
port = null;
}
// Show connect button, hide disconnect button and command section
connectButton.style.display = 'block';
disconnectButton.style.display = 'none';
commandSection.style.display = 'none';
} catch (error) {
console.error('Failed to disconnect:', error);
alert('Failed to disconnect from the device. Please try again.');
}
});
sendButton.addEventListener('click', async () => {
outputArea.value = '';
const writer = port.writable.getWriter();
const dataToSend = inputField.value + '\r\n';
const data = new TextEncoder().encode(dataToSend);
await writer.write(data);
writer.releaseLock();
});
document.getElementById('scanBtn').addEventListener('click', async () => {
const writer = port.writable.getWriter();
let dataToSend = 'AT+CENTRAL' + '\r\n';
let data = new TextEncoder().encode(dataToSend);
await writer.write(data);
dataToSend = 'AT+GAPSCAN=3' + '\r\n';
data = new TextEncoder().encode(dataToSend);
await writer.write(data);
writer.releaseLock();
});
</script>
</body>
</html>
Step 3: Running the Script
Once your HTML file is ready, you can open it in your mobile browser. We have uploaded the script on github to try out.
Connect to BleuIO: Tap the “Connect to BleuIO” button to initiate a connection.
Send Commands: Once connected, you can start sending AT commands or use the built-in “Scan for BLE Devices” button to see nearby BLE devices.
View Output: The responses from the BleuIO dongle will appear in the output section on the right.
Step 4: Customizing and Expanding
This setup provides a solid foundation for more advanced BLE development on mobile devices. You can easily modify the script to add more AT commands or even build a full-fledged BLE application. Whether you want to control BLE devices, gather data, or create interactive applications, this setup offers flexibility and mobility.
Output:
With the BleuIO USB dongle and the Web Serial API, you can now bring BLE development to your mobile device, giving you the freedom to code, test, and interact with BLE devices wherever you are. This capability opens up new possibilities for developers who need to work on the go, providing a powerful toolset right in your pocket.
In an age where air quality has become increasingly important, monitoring CO2 levels in various environments is crucial. This project demonstrates how to create a real-time CO2 monitoring system using the Renesas EK-RA4M2 evaluation kit and the BleuIO dongle.
This project walks you through the process of scanning Bluetooth advertising signals from a HibouAir sensor, retrieving CO2 data, and responding to these readings with visual cues through LED indicators on the Renesas board. Blue LED for ‘good’ (<600ppm), green LED for ‘average’ (<1000ppm) and red LED for ‘poor’ (>1000ppm). The board will also print the CO2 values, as they change, on the RTTViewer.
Connect a Micro USB device cable (type-A male to micro-B male) between J10 (Debug1) and a Computer USB port.
Plug in a BleuIO Dongle in the USB OTG Cable (type-A female to micro-B male) and connect it to J11 (USB Full Speed).
Make sure Jumper J12 is placed on pins 1-2
Remove Jumper J15 pins
The example will make us of the on board LEDs R32 (Blue), R34 (Green) and R33 (Red):
Importing project
Open e² studio IDE
Choose a workspace and click ‘Launch’
Download or clone the example project. Place the folder ‘bleuio_ra4m2_co2_monitor_example’ in workspace.
Choose Import Project
Select ‘Existing Projects into Workspace’ under the ‘General’ tab:
Click the ‘Browse…’ button and open folder where the ‘bleuio_ra4m2_co2_monitor_example’ project folder is located:
Finally select the project and click ‘Finish’. You have now imported the the project!
Running the example
Go to file ‘usb_hcdc_app.c’ under ‘src/’ and edit line 56 to the board ID of the HibouAir Sensor:
#define BOARD_ID_TO_SCAN "2202B3"
The board ID is printed on the back of the HibouAir sensor:
Build the project by clicking the building icon:
Use Debug to download and run the project. The first time you need to configure the debug settings. Click down arrow to the right of the Debug icon and select ‘Debug Configurations…’
Under ‘Renesas GDB Hardware Debugging’ select ‘bleuio_ra4m2_co2_monitor_example.elf’ and click ‘Debug’.
The debug is now configured and the ‘Debug’ icon can be used next time to run the project.
Open RTTViewer. Connect and use these settings: Connection to J-Link: USB Specify Target Device: R7FA4M2AD Target Interface & Speed: SWD 4000kHz RTT Control Block: Address 0x2000095c
On the debugger screen in e² studio click the ‘Resume’ icon twice to run the project.
The application is now running. When starting up you should notice all LEDs lighting up for one second then only the red LED will be on. It will turn off as soon as the BleuIO is configured.
You should now see the output on the RTTViewer.
Output
When the CO2 value is less than 600 ppm only the blue LED will be turned on.
If it’s over 600 ppm but below 1000 ppm then the green LED will be on.
If it’s above 1000 ppm then the red LED will be on.
Practical Use Case
The BleuIO RA4M2 CO2 Monitor is an excellent example of how BLE technology can be harnessed to create practical, real-world applications. This project is particularly relevant for environments where air quality monitoring is essential, such as:
Offices and Workspaces: Monitor indoor air quality to ensure a healthy working environment, which can help in improving employee productivity and well-being.
Schools and Educational Institutions: Keep track of CO2 levels in classrooms to maintain a healthy atmosphere conducive to learning.
Public Buildings: Ensure that places with high foot traffic, like libraries or hospitals, maintain safe air quality levels for visitors.
Smart Homes: Integrate CO2 monitoring into home automation systems, allowing for better air quality control and energy efficiency.
With the BleuIO dongle and this project as a foundation, developers can easily expand on this concept, integrating additional sensors or creating custom applications tailored to specific needs. The combination of Bluetooth Low Energy and the versatile RA4M2 platform opens up a world of possibilities for creating innovative, responsive systems.
In this tutorial, we’ll guide you through creating a project that scans for nearby Bluetooth Low Energy (BLE) devices, filters them based on RSSI (Received Signal Strength Indicator), and determines if a specific device, the Close Beacon, is within a certain range. We’ll use the BleuIO USB dongle, which simplifies BLE development through its easy-to-use AT commands. By the end of this tutorial, you’ll have a working BLE scanner that can identify when the Close Beacon is within approximately 5 meters.
Overview of the Project
The goal of this project is to continuously scan for nearby BLE devices and check if a particular device, identified by its name (“Close beacon”), is within a defined range. We determine the range by setting an RSSI filter, which allows us to estimate the distance based on signal strength. If the device is found within this range, it is considered “online”; otherwise, it is “offline”.
Hardware Used
BleuIO USB Dongle: A BLE USB dongle that makes it easy to create BLE applications, prototypes, or test devices with AT commands and available libraries for Python and JavaScript.
Close Beacon: A BLE beacon device that broadcasts its presence to nearby BLE scanners. This hardware will be our target device to identify if it’s within a 5-meter range based on its RSSI.
Use Cases
Proximity Detection: Identify if a specific BLE device (e.g., a beacon or wearable) is within a set distance from the scanner.
Asset Tracking: Monitor the presence of assets in a particular area based on their BLE signal strength.
Environment Monitoring: Set up zones where certain devices must be present and get notified if they leave the range.
Getting Started with BleuIO
Before diving into the code, let’s cover the basic setup:
Hardware: You’ll need a BleuIO USB dongle. Plug it into your computer’s USB port.
Software: We’ll use JavaScript for this tutorial, running in a modern web browser that supports the Web Serial API. No additional software is required.
AT Commands Used
ATV1: Ensures verbose mode is enabled, meaning all command responses are returned in a human-readable format.
AT+CENTRAL: Sets the dongle into Central mode, allowing it to scan and connect to other BLE devices.
AT+FRSSI=-70: Filters out devices with an RSSI lower than -70 dBm, which helps to focus on devices within a closer range.
AT+GAPSCAN=3: Initiates a scan for nearby BLE devices.
HTML Setup
The following HTML file provides a simple user interface with a “Scan” button that starts the BLE scanning process.
This script, which is linked in the HTML file, manages the BLE scanning and RSSI filtering.
let port;
let reader;
let writer;
let buffer = '';
let ibeaconFound = false;
let scanIntervalId;
const connectButton = document.getElementById('connect');
const outputElement = document.getElementById('output');
connectButton.addEventListener('click', async () => {
try {
// Request a port and open a connection.
port = await navigator.serial.requestPort();
await port.open({ baudRate: 9600 });
// Start reading from the serial port.
reader = port.readable.getReader();
writer = port.writable.getWriter();
// Send initial setup commands
await writer.write(new TextEncoder().encode('ATV1\r'));
await delay(1000);
await writer.write(new TextEncoder().encode('AT+CENTRAL\r'));
await delay(1000);
await writer.write(new TextEncoder().encode('AT+FRSSI=-70\r'));
await delay(1000);
// Start the scanning process at 15-second intervals
startScanInterval();
// Read data from the device.
readLoop();
} catch (error) {
console.error('There was an error opening the serial port:', error);
}
});
function startScanInterval() {
scanIntervalId = setInterval(async () => {
ibeaconFound = false; // Reset the flag for each scan
await writer.write(new TextEncoder().encode('AT+GAPSCAN=3\r'));
// Wait 3 seconds to check if 'Close beacon' is found
setTimeout(() => {
if (ibeaconFound) {
outputElement.innerHTML =
'<div style="color: green; display: inline-block; margin-right: 8px;">●</div>Close beacon is within the range of 5 meters.<br>';
} else {
outputElement.innerHTML =
'<div style="color: red; display: inline-block; margin-right: 8px;">●</div>Close beacon is not within the range of 5 meters.<br>';
}
}, 3000);
}, 15000); // 15 seconds interval
}
async function readLoop() {
while (true) {
const { value, done } = await reader.read();
if (done) {
// Allow the serial port to be closed later.
reader.releaseLock();
break;
}
// Convert the data to a string and append it to the buffer.
buffer += new TextDecoder().decode(value);
// Split the buffer by line breaks to process each line separately.
let lines = buffer.split('\n');
buffer = lines.pop(); // Save the last incomplete line for the next read.
for (let line of lines) {
line = line.trim(); // Remove any extra whitespace
// Check if the line is a valid JSON string
if (line.startsWith('{') && line.endsWith('}')) {
try {
// Parse the JSON object.
let data = JSON.parse(line);
// Check if the object contains the 'name' property and if it's "Sheikh ibeacon".
if (data.S && data.name === 'Close beacon') {
ibeaconFound = true;
}
} catch (e) {
console.error('Error parsing JSON:', e, line);
}
} else {
// Log non-JSON lines for debugging or just ignore them.
console.log('Non-JSON line received:', line);
}
}
}
}
function delay(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
window.addEventListener('beforeunload', async () => {
// Stop the scanning interval when the window is closed or refreshed.
if (scanIntervalId) {
clearInterval(scanIntervalId);
}
// Close the port when the window is closed or refreshed.
if (reader) {
await reader.cancel();
reader.releaseLock();
}
if (writer) {
writer.releaseLock();
}
if (port) {
await port.close();
}
});
Code Explanation
HTML Interface:
The HTML file provides a simple user interface with a “Scan” button. When clicked, this button triggers the BLE scanning process.
JavaScript Code:
Initialization: We start by requesting access to the serial port and opening a connection to the BLE dongle. After setting up the port, we configure the dongle by sending the ATV1, AT+CENTRAL, and AT+FRSSI=-70 commands. These commands enable verbose mode, set the device to central mode, and filter out weak BLE signals (below -70 dBm), respectively.
Scan Interval: The setInterval function initiates a BLE scan every 15 seconds. The AT+GAPSCAN=3 command scans for nearby BLE devices for 3 seconds.
Device Detection: After each scan, we check if the specific BLE device named “Close beacon” is found. If it is, a green dot appears with a message indicating the device is within range. If not, a red dot with a message indicating the device is not within range is shown.
Reading Data: The readLoop function continuously reads data from the serial port. It checks for JSON-formatted responses from the dongle and looks for the device name in the scanned results.
Clean Up: We ensure that the scanning process stops and the serial port is closed when the user leaves the page or closes the window.
Setting Up RSSI Filtering for 5-Meter Range Detection
In this project, the goal was to detect if a specific BLE device, “Close Beacon,” is within approximately 5 meters of our BLE dongle. We achieved this by using the Received Signal Strength Indicator (RSSI), which helps us estimate the distance based on the strength of the received signal.
Understanding RSSI and Distance
RSSI is a measure of signal strength, with higher (less negative) values indicating a closer proximity to the BLE device. The relationship between RSSI and distance is governed by the following formula:
A: RSSI at 1 meter (typically around -56 dBm for Bluetooth).
n: Path-loss exponent (usually 2 for free space, 3 for indoor environments).
For a 5-meter distance, we calculated that an RSSI of -70 dBm is appropriate. Using the formula:
A = -56 dBm
n = 2 (assuming a free-space environment)
An RSSI of -70 dBm corresponds to approximately 5 meters, which is suitable for detecting if a device is within this range.
Practical Distance Adjustment
While theoretical calculations are useful, it’s also possible to perform a practical distance adjustment by placing the “Close Beacon” 5 meters away from the BLE dongle in a controlled environment, such as a room. You can then read the obtained RSSI value directly from the BleuIO dongle. This approach takes into account the real-world radio performance of both devices, providing a more accurate and practical RSSI value for your specific setup.
Output
The BleuIO USB dongle makes it incredibly easy to develop and prototype BLE applications using AT commands. This project demonstrates how you can set up a BLE scanner with RSSI filtering to monitor the proximity of a specific device. Whether you’re developing a custom IoT solution, monitoring assets, or just exploring BLE technology, BleuIO provides a simple and effective toolset to get your projects up and running quickly.
By following this tutorial, you should now have a good understanding of how to use the BleuIO dongle to create a BLE application that scans for devices and filters them based on their signal strength.
This project demonstrates how to leverage the Renesas RA4M2 microcontroller, combined with the BleuIO Bluetooth Low Energy (BLE) USB dongle, to perform a wireless signal strength scan. It provides a practical example of how to use the USB Host Communication Device Class (HCDC) driver to communicate with a BLE device, highlighting how easy it is to create BLE applications using the BleuIO dongle.
By integrating these technologies, the project enables users to scan for nearby BLE devices, parse the Received Signal Strength Indicator (RSSI) from advertising data, and display it in real-time using the RTTViewer. This setup offers a hands-on approach to understanding BLE communication and signal strength analysis.
Connect a Micro USB device cable (type-A male to micro-B male) between J10 (Debug1) and a Computer USB port.
Plug in a BleuIO Dongle in the USB OTG Cable (type-A female to micro-B male) and connect it to J11 (USB Full Speed).
Make sure Jumper J12 is placed on pins 1-2
Remove Jumper J15 pins
Importing project
Open e² studio IDE
Choose a workspace and click ‘Launch’
Download or clone the example project. Place the folder ‘bleuio_ra4m2_rssi_scan_example’ in workspace.
Choose Import Project
Select ‘Existing Projects into Workspace’ under the ‘General’ tab:
Click the ‘Browse…’ button and open folder where the ‘bleuio_ra4m2_rssi_scan_example’ project folder is located:
Finally select the project and click ‘Finish’. You have now imported the the project!
Running the example
Go to file ‘usb_hcdc_app.c’ under ‘src/’ and edit line 54 to the mac address of the desired:
#define ADDR_TO_SCAN "[0]D0:76:50:80:01:75"
[0] = public address
[1] = private address
On a closebeacon the mac address is printed on the back of the box (it will need to be converted to Hex):
For example: 208-118-080-128-001-117 in Hex is: D0-76-50-80-01-75
Build the project by clicking the building icon:
Use Debug to download and run the project. The first time you need to configure the debug settings. Click down arrow to the right of the Debug icon and select ‘Debug Configurations…’
Under ‘Renesas GDB Hardware Debugging’ select ‘bleuio_ra4m2_rssi_scan_example.elf’ and click ‘Debug’. The debug is now configured and the ‘Debug’ icon can be used next time to run the project.
Open RTTViewer. Connect and use these settings:
Connection to J-Link: USB Specify Target Device: R7FA4M2AD Target Interface & Speed: SWD 4000kHz RTT Control Block: Address 0x2000095c
On the debugger screen in e² studio click the ‘Resume’ icon twice to run the project.
You should now see the output on the RTTViewer. Notice that when you move the scanned device closer to the BleuIO the RSSI value will increase.
Output
Below is the output screen that displays the RSSI values in real-time as the BleuIO dongle scans for nearby BLE devices:
Practical Use Cases
The BleuIO RA4M2 RSSI Scan Project can be applied in various scenarios where monitoring BLE signal strength is critical:
Proximity-Based Applications: By tracking RSSI values, developers can create proximity-based applications where actions are triggered based on the distance between BLE devices, such as automated check-ins, asset tracking, or location-based services.
Signal Strength Mapping: The project can be used to map signal strength in different environments, helping to optimize the placement of BLE devices like beacons in smart homes, retail stores, or industrial settings.
Device Tracking and Monitoring: In IoT applications, RSSI can be used to monitor the presence and movement of devices within a specific range, useful in security systems, inventory management, or environmental monitoring.
This project not only showcases the capabilities of the BleuIO dongle but also serves as a foundation for developing more complex BLE applications. Whether you’re a hobbyist, developer, or engineer, this project provides valuable insights into BLE communication and its practical applications.
In this tutorial, we will walk you through the steps to get started with Bluetooth Low Energy (BLE) development using the BleuIO USB dongle and the Go programming language. BleuIO is a versatile and user-friendly BLE USB dongle that simplifies BLE application development with its easy-to-use AT Commands. We will show you how to set up your environment, write a simple Go program to interact with the BLE dongle, and explore some of the key features of BleuIO.
Introduction to Go
Go, also known as Golang, is an open-source programming language developed by Google. It is designed for simplicity, efficiency, and reliability, making it an excellent choice for system programming and large-scale software development. Go’s strong concurrency support, fast compilation, and robust standard library make it a popular language for network programming, cloud services, and, of course, BLE applications.
Introduction to BleuIO
BleuIO is a Bluetooth Low Energy USB dongle that can be used to create new BLE applications quickly and easily. With its built-in AT Commands, developers can interact with the BLE dongle without needing deep knowledge of BLE protocols or complex configurations. BleuIO supports various operating systems, making it a versatile tool for any development environment.
Key features of BleuIO include:
Easy-to-use AT Commands for faster development
Compatibility with any programming language
Support for Windows, macOS, and Linux
Setting Up Your Development Environment
Step 1: Install Go
First, ensure that you have Go installed on your system. You can download the latest version of Go from the official website: https://golang.org/dl/. Follow the installation instructions for your operating system.
Step 2: Initialize a New Go Module
Create a directory and open a terminal . Run the following command to initialize a new Go module:
go mod init bleuio-example
Step 3: Install the Serial Package
Install the go.bug.st/serial package, which provides a simple API for serial communication in Go:
go get go.bug.st/serial
Writing Your First Go Program with BleuIO
Step 4: Write the Program
Create a new file named main.go in your project directory and add the following code:
package main
import ( "fmt" "log" "time"
"go.bug.st/serial" )
func main() { // Open the serial port mode := &serial.Mode{ BaudRate: 9600, } port, err := serial.Open("/dev/cu.usbmodem4048FDE52CF21", mode) if err != nil { log.Fatalf("Failed to open port: %v", err) } defer port.Close()
// Write "AT+CENTRAL" to the serial port _, err = port.Write([]byte("AT+CENTRAL\r")) if err != nil { log.Fatalf("Failed to write AT+CENTRAL to port: %v", err) } fmt.Println("Command sent: AT+CENTRAL")
// Wait for a short moment to ensure the command is processed time.Sleep(2 * time.Second)
// Read the response for the AT+CENTRAL command buf := make([]byte, 100) n, err := port.Read(buf) if err != nil { log.Fatalf("Failed to read from port: %v", err) } fmt.Printf("Response from AT+CENTRAL:\n%s\n", string(buf[:n]))
// Write "AT+GAPSCAN=5" to the serial port _, err = port.Write([]byte("AT+GAPSCAN=5\r")) if err != nil { log.Fatalf("Failed to write AT+GAPSCAN=5 to port: %v", err) } fmt.Println("Command sent: AT+GAPSCAN=5")
// Wait for the scan to complete (5 seconds in this case) time.Sleep(6 * time.Second) // Adding a bit more time to ensure the response is received
// Read the response for the AT+GAPSCAN=5 command buf = make([]byte, 1000) n, err = port.Read(buf) if err != nil { log.Fatalf("Failed to read from port: %v", err) }
// Print the response fmt.Printf("Response from AT+GAPSCAN=5:\n%s\n", string(buf[:n])) }
Step 5: Run the Program
Ensure your BleuIO USB dongle is connected and configured correctly. Then, run the program using the following command in the terminal:
go run main.go
Explanation of the Program
Opening the Serial Port: The program opens the serial port where the BleuIO dongle is connected. Adjust the serial port path (/dev/cu.usbmodem4048FDE52CF21) according to your system (e.g., COM3 on Windows). To get the location of connected BleuIO on macOS, run this command on terminal ls /dev/cu.*
Setting the Central Role: The program sends the AT+CENTRAL command to set the BLE dongle in central role mode. Similarly we can try sending AT+FINDSCANDATA=5B07=3 which will look for advertised data from BLE devices whose manufacturing id is 5B07.
Reading the Response: It waits for 2 seconds to ensure the command is processed and reads the response from the serial port.
Scanning for BLE Devices: The program sends the AT+GAPSCAN=5 command to scan for nearby BLE devices for 5 seconds.
Printing the Scan Results: After waiting for the scan to complete, the program reads and prints the response from the serial port.
Output
This tutorial demonstrated how to get started with BLE development using the BleuIO USB dongle and the Go programming language. BleuIO simplifies BLE application development with its straightforward AT Commands, making it accessible for developers using any programming language. With Go’s efficiency and robust standard library, you can quickly develop powerful BLE applications.