BLE Connectivity Test Tool using BleuIO

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.

Share this post on :

Real-Time CO2 Monitoring with Renesas EK-RA4M2, RRH47000 CO2 Sensor, and BleuIO Pro Dongle

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.

Requirements

Setup

  1. 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.
  2. 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).
  3. Ensure that Jumper J12 is placed on pins 1-2.
  4. 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.

    Share this post on :

    Simplifying BLE Application Development for C++ Developers with the BleuIO C++ Library

    BleuIO BLE USB dongle was designed with developers in mind, offering a simple yet powerful way to create BLE applications using AT commands. Now, we’ve taken this a step further by creating a C++ library that makes it even easier for C++ developers to integrate BleuIO into their BLE projects.

    In this article, we’ll introduce the BleuIO C++ library and how it simplifies BLE development for C++ developers. Whether you’re building IoT devices, smart home solutions, or any application requiring BLE communication, our library streamlines the process, allowing you to focus on your application logic.

    What is BleuIO?

    BleuIO is a Bluetooth Low Energy USB dongle that enables BLE communication through simple AT commands. It acts as a bridge between your application and Bluetooth devices, making it easier to scan, connect, and communicate with other BLE devices. The dongle supports all major operating systems, including Windows, macOS, and Linux, and is compatible with multiple programming languages, including C++.

    With its AT command interface, BleuIO abstracts the complexity of BLE communication, making it accessible even to those with limited knowledge of BLE protocols. Developers can send and receive BLE commands without diving deep into low-level BLE stack programming.

    Introducing the C++ Library for BleuIO

    To further simplify BLE development, we’ve developed a dedicated C++ library that integrates with BleuIO’s AT command interface. This library allows C++ developers to quickly start building BLE applications using BleuIO without needing to manually manage serial communication or handle raw AT commands.

    The library takes care of the low-level communication, so you can focus on higher-level logic. With just a few lines of code, you can send commands to the dongle, scan for devices, and establish BLE connections.

    Why Use the BleuIO C++ Library?

    The BleuIO C++ library provides a number of benefits for developers:

    Ease of Use: No need to write low-level serial port communication code. The library handles sending AT commands and reading responses, allowing you to focus on building your BLE application.

    Cross-Platform: The library is compatible with all major operating systems, including macOS, Linux, and Windows. C++ developers can seamlessly integrate BleuIO into their projects regardless of the platform.

    Faster Development: By using AT commands through the C++ library, you significantly reduce the time required to implement BLE communication in your application. The library enables quick scanning for devices, connecting to peripherals, and exchanging data.

    Highly Customizable: While the library handles serial communication and command parsing, you still retain control over how you use the AT commands. You can extend and adapt the library to fit the specific needs of your BLE project.

    How to Install the Library

    We’ve made the library available on Homebrew (for macOS and Linux) and provided easy installation steps:

    Installation via Homebrew

    Install Homebrew (if you don’t have it installed):

       /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

    Add the BleuIO C++ library tap:

       brew tap smart-sensor-devices-ab/homebrew-bleuio-library

    Install the library:

       brew install bleuio-library

    Example: Scanning for BLE Devices Using BleuIO

    Let’s take a look at how you can use the BleuIO C++ library to scan for nearby BLE devices. Below is a simple example that demonstrates how to send the AT+GAPSCAN command to the dongle and retrieve a list of nearby BLE devices.

    #include <iostream>
    #include "BleuIO.h"
    
    int main() {
        // Initialize BleuIO dongle connected to /dev/ttyUSB0 (adjust the port for your system)
        BleuIO dongle("/dev/ttyUSB0");
    
        // Put the dongle in central role
        std::string response = dongle.send_command("AT+CENTRAL");
        // Send command to scan for nearby BLE devices for 3 seconds
        response = dongle.send_command("AT+GAPSCAN=3");
    
        // Print the response from the dongle
        std::cout << "Response: \n" << response << std::endl;
    
        return 0;
    }

    Using the Library in Your C++ Project

    Once installed, you can include the library in your project and start using it immediately. The typical workflow involves creating an instance of the BleuIO class, sending AT commands, and handling the responses.

    To compile your program, you can use the following commands depending on your system:

    macOS (Intel)

    g++ -o my_bleuio_app main.cpp -I/usr/local/include -L/usr/local/lib -lBleuIO -lserialport

    macOS (Apple Silicon)

    g++ -o my_bleuio_app main.cpp -I/opt/homebrew/include -L/opt/homebrew/lib -lBleuIO -lserialport

    Linux

    g++ -o my_bleuio_app main.cpp -I/home/linuxbrew/.linuxbrew/include -L/home/linuxbrew/.linuxbrew/lib -lBleuIO -lserialport

    After compiling, run your application:

    ./my_bleuio_app

    The BleuIO C++ library makes it easier than ever for C++ developers to integrate BLE communication into their projects using the BleuIO USB dongle. With the power of AT commands and the simplicity of the library, you can quickly prototype and build Bluetooth-enabled applications without the complexity of managing BLE protocols manually.

    Whether you’re working on IoT, smart home devices, or any project requiring Bluetooth communication, the BleuIO C++ library helps you get started faster, with fewer lines of code, and more focus on your application logic.

    We encourage you to try out the library and join the growing community of developers building BLE applications with BleuIO.

    Share this post on :

    Simplifying BLE application development: Overcoming built-in Bluetooth limitations from various vendors with BleuIO USB Dongle 

    Bluetooth Low Energy (BLE) technology has revolutionized the way we connect devices, making it possible to create innovative applications across various industries. However, developers frequently encounter challenges when utilizing built-in Bluetooth capabilities, as these can vary significantly depending on the vendor and operating system. In this article, we will examine the limitations of built-in Bluetooth and demonstrate how the BleuIO USB dongle simplifies BLE application development, providing a more reliable and consistent solution.

    Limitations of Built-in Bluetooth

    Vendor-Specific BLE Chips: Different computer manufacturers utilize various BLE chips based on the vendor. This variability can lead to inconsistent performance and capabilities across devices. 

    Operating System Handling: Each operating system may manage these vendor-specific BLE chips differently, creating additional complexities for developers. This inconsistency can affect how Bluetooth interactions are handled, potentially leading to compatibility issues. 

    Built-in BLE on Development Boards: Some development boards also come equipped with built-in BLE chips. The chip’s performance and compatibility will depend on the specific vendor’s implementation, adding another layer of variability for developers to navigate. 

    Introducing BleuIO: Simplifying BLE Development

    BleuIO—a Bluetooth Low Energy USB dongle designed to make BLE application development easier and more accessible for developers. Here’s how BleuIO addresses the challenges associated with built-in Bluetooth:

    Device Independence: BleuIO is compatible with any device and operating system, including Windows, Mac, and Linux. Its cross-platform support ensures seamless development regardless of the underlying hardware.

    Programming Language Flexibility: With BleuIO, developers can work in any programming language, as it communicates via serial port. This flexibility allows you to integrate BLE capabilities into your application without being tied to a specific environment.

    Regular Firmware Updates: The BleuIO team is dedicated to continuously improving the dongle. Regular firmware updates add new features while ensuring backward compatibility, so your development efforts remain relevant over time.

    User-Friendly AT Commands: For those new to BLE, the AT commands provided by BleuIO make it easier to understand and learn the intricacies of Bluetooth technology. This user-friendly approach reduces the learning curve for beginners.

    In conclusion, while built-in Bluetooth poses various challenges due to vendor-specific implementations and inconsistent handling by operating systems, the BleuIO USB dongle offers a reliable solution for developers aiming to create BLE applications effortlessly. With its device independence, cross-platform compatibility, and straightforward integration process, BleuIO allows you to concentrate on what truly matters: developing innovative applications that enhance connectivity and user experiences. 

    Share this post on :

    BleuIO Pro BLE USB Dongle Now Shipping – Limited Time Offer until  September 30 , 2024

    We are excited to announce that our highly anticipated new product, the BleuIO Pro Bluetooth Low Energy USB Dongle, is now officially shipping! After a successful pre-release period, during which we offered our customers the chance to secure the new device at a special price, the BleuIO Pro is ready to reach your hands and ease your Bluetooth application development experience. 

    Special Offer: Get BleuIO Pro at Just $29 – Limited time offer until  September 30 , 2024! 

    To celebrate the launch, we are extending our special pre-release offer for just two more weeks. You can still purchase the BleuIO Pro for only $29 (original price $35) until September 30 , 2024. Don’t miss this opportunity to enhance your development toolkit with the latest in Bluetooth technology at an unbeatable price! 

    Act now to secure your BleuIO Pro at this special price! Visit our website www.bleuio.com to place your order. 

    What’s New with BleuIO Pro? 

    The new BleuIO Pro is powered by Renesas’ DA14695 Bluetooth® low energy 5.2 system on chip (SoC). This advanced SoC brings out the full potential of the DA14695, enhancing the capabilities and features you already love about our products. 

    Key enhancements of the BleuIO Pro include: 

    • Bluetooth® 5.2 connectivity, supporting transfer speeds of up to 2 Mbps and extended advertising packets. 
    • Programmable LED for visual feedback 
    • Extended advertising packets for increased communication reliability. 
    • An integrated antenna, 32Mbit QSPI FLASH, 32MHz, and 32.785kHz crystals. 
    • Full support for the BleuIO software API (AT commands based) that makes development fast and easy. 

    About BleuIO 

    BleuIO is dedicated to providing innovative solutions for Bluetooth application development. With our easy-to-use AT commands and support for popular programming languages, and operating systems we help developers to create cutting-edge BLE applications in the fastest and easiest way possible. 

    Share this post on :

    Why Bluetooth Integration is Becoming Increasingly Popular in Modern Devices

    In today’s rapidly evolving technological landscape, Bluetooth has emerged as on of the key component of wireless communication, enabling a plethora of devices to connect and interact seamlessly. From our smartphones to smart home devices and even industrial machinery, Bluetooth technology has permeated nearly every aspect of modern life.

    Understanding Bluetooth Technology

    Bluetooth technology, first introduced in 1994, has undergone significant evolution since its inception. Originally designed for short-range wireless communication, Bluetooth has grown to support a wide range of applications through successive versions, each bringing enhancements in speed, range, and power efficiency.

    One of Bluetooth’s most compelling features is its low power consumption. This characteristic makes it particularly well-suited for battery-operated devices, which is crucial as the Internet of Things (IoT) continues to expand. Furthermore, Bluetooth’s interoperability ensures that devices from different manufacturers can connect and communicate effortlessly, enabling a more integrated and user-friendly ecosystem.

    The Role of Bluetooth in IoT

    As the IoT ecosystem grows, the role of Bluetooth becomes increasingly pivotal. Bluetooth technology facilitates the creation of smart, connected devices that communicate with each other and with central hubs. This connectivity is fundamental to the concept of a smart home, where devices like thermostats, lights, and security systems work together to enhance convenience and efficiency.

    Bluetooth’s integration into IoT devices allows for seamless communication and control. For instance, users can manage their home automation systems from a single app, adjust settings remotely, and receive notifications about their home environment. This level of connectivity not only simplifies user interactions but also enhances the functionality and intelligence of IoT devices.

    Transformative Use Cases of Bluetooth Integration

    1. Automotive Integration

    In the automotive industry, Bluetooth has revolutionized in-car connectivity. Modern vehicles uses Bluetooth technology for hands-free calling, music streaming, and diagnostics. Bluetooth-enabled systems allow drivers to connect their smartphones to their vehicles effortlessly, providing access to navigation, entertainment, and communication features while keeping their hands on the wheel and eyes on the road.

    Moreover, the concept of Vehicle-to-Everything (V2X) communication is on the horizon, promising to further integrate Bluetooth into automotive systems. V2X technology aims to improve road safety and traffic management by enabling vehicles to communicate with each other and with infrastructure components, such as traffic lights and road signs.

    1. Smart Home Devices

    Bluetooth technology is a key enabler of the smart home revolution. By integrating Bluetooth into devices such as lighting systems, thermostats, and smart locks, manufacturers have made it possible for homeowners to control their environment with unprecedented ease. For example, a smart thermostat can be adjusted from a smartphone app, while smart lighting systems can be programmed to respond to voice commands or automated schedules.

    The interoperability of Bluetooth devices is a significant advantage, as it allows various products from different brands to work together seamlessly. This compatibility enhances the user experience and promotes the adoption of smart home technologies.

    1. Healthcare and Wearables

    In the realm of healthcare, Bluetooth has made substantial contributions through the development of wearables and medical devices. Wearable fitness trackers and smartwatches use Bluetooth to monitor health metrics such as heart rate, activity levels, and sleep patterns, providing users with valuable insights into their well-being.

    Bluetooth is also integral to medical devices that require data transmission, such as glucose monitors and blood pressure cuffs. These devices can transmit health data to healthcare providers in real-time, facilitating remote monitoring and improving patient care. The ability to connect these devices wirelessly enhances convenience and ensures that critical health information is always accessible.

    1. IoT and Industrial Applications

    In industrial settings, Bluetooth technology is transforming operations by enabling smart manufacturing and asset tracking. Bluetooth sensors can monitor equipment performance, detect anomalies, and streamline maintenance processes. This real-time data collection improves efficiency and reduces downtime.

    Furthermore, Bluetooth’s role in asset tracking has advanced significantly, allowing businesses to monitor inventory and manage assets with greater accuracy. This capability is particularly valuable in sectors such as logistics and warehousing, where precise tracking and management are crucial.

    1. Retail and Beacon Technology

    Bluetooth beacons have introduced innovative ways for retailers to engage with customers. By deploying beacons throughout stores, retailers can deliver personalized promotions, guide customers to specific products, and collect data on shopping behaviors. This level of engagement enhances the shopping experience and provides valuable insights into customer preferences.

    Bluetooth technology also plays a role in improving the efficiency of retail operations by streamlining inventory management and enhancing the accuracy of sales data.

    Advancements in Bluetooth Security and Power Efficiency

    Bluetooth technology continues to evolve, with significant improvements in security and power efficiency. Enhanced encryption standards and secure pairing methods protect data transmission and prevent unauthorized access. These advancements are crucial as Bluetooth becomes more integral to sensitive applications and environments.

    In terms of power efficiency, recent developments have focused on reducing energy consumption while maintaining performance. Low Energy Bluetooth (BLE) technology, for example, is designed to extend battery life and support long-term usage in battery-powered devices.

    Bluetooth integration with BleuIO

    For developers and businesses looking to leverage Bluetooth technology, products like the BleuIO Bluetooth Low Energy USB dongle offer an easy and effective solution for integrating Bluetooth into devices. With cross-platform support and user-friendly features, BleuIO simplifies the development, prototyping, and testing of BLE applications, making it an invaluable tool for anyone working with Bluetooth technology.

    Explore the possibilities of Bluetooth integration with BleuIO and see how it can enhance your projects and innovations.

    Share this post on :

    Simplifying BLE Application Development with BleuIO

    Bluetooth Low Energy (BLE) technology has become a cornerstone in the expanding world of the Internet of Things (IoT). Its low power consumption, cost-effectiveness, and ease of integration have made it a popular choice for a wide range of applications, from smart home devices to health monitoring systems. However, developing BLE applications can be complex, particularly for newcomers to the field. This is where BleuIO, a versatile BLE USB dongle, comes into play. In this article, we’ll explore how BleuIO simplifies BLE application development, making it accessible and efficient for developers across different platforms and programming languages.

    BLE and IoT: A Growing Trend

    The Rise of BLE

    Bluetooth Low Energy (BLE) is designed for applications that require low power consumption and intermittent data transmission. Unlike classic Bluetooth, BLE is optimized for devices that need to conserve battery life, making it ideal for IoT applications. With BLE, devices can communicate over short distances with minimal power usage, which is crucial for wearable devices, smart sensors, and other battery-operated gadgets.

    Current Trends in BLE Applications

    The BLE ecosystem is rapidly evolving. Some notable trends include:

    • Smart Home Devices: BLE is widely used in smart home products like smart locks, lighting systems, and thermostats, allowing for seamless control and automation.
    • Healthcare and Fitness: Wearable health monitors and fitness trackers leverage BLE for continuous health monitoring and data synchronization.
    • Industrial Automation: BLE is increasingly being used in industrial settings for asset tracking, environmental monitoring, and equipment management.

    Navigating the Learning Curve for New Developers

    Challenges for Beginners

    For new developers, the world of BLE can be daunting. Key challenges include understanding BLE’s communication protocols, managing device pairing and connection, and implementing secure data transmission. Additionally, developers need to familiarize themselves with the BLE specifications and the various tools available for development and testing.

    How BleuIO Eases the Learning Process

    BleuIO provides a user-friendly solution to these challenges. Its intuitive AT commands simplify the process of creating and managing BLE connections, allowing developers to focus on their application logic rather than the underlying complexities. With BleuIO, developers can quickly prototype, test, and iterate on their BLE applications, significantly reducing the learning curve associated with BLE development.

    An illustration representing the concept of 'Learning Bluetooth Made Easy.' Show a friendly, inviting environment with a person studying Bluetooth technology at a desk with a laptop displaying simple code or AT commands. Include visual elements like Bluetooth icons, wireless signals, or a flowchart connecting different Bluetooth-enabled devices, such as a smartphone, a speaker, and a smartwatch. The atmosphere should feel approachable and modern, with symbols like lightbulbs or books to represent learning and discovery, highlighting the ease and accessibility of learning Bluetooth technology.

    How BleuIO Simplifies BLE Development

    Overview of BleuIO

    BleuIO is a powerful BLE USB dongle designed to streamline BLE application development. It features:

    • AT Commands: Simplified command sets for configuring and controlling BLE connections.
    • Cross-Platform Support: Compatibility with Windows, Mac, and Linux, ensuring a seamless development experience across different operating systems.
    • Python and JavaScript Libraries: Libraries that facilitate development in popular programming languages, making it easier for developers to integrate BLE functionality into their applications.

    Ease of Use

    BleuIO’s AT commands allow developers to interact with BLE devices and manage connections without deep technical knowledge. This feature is particularly beneficial for those new to BLE, as it abstracts away much of the complexity involved in BLE communication.

    Cross-Platform Compatibility

    One of BleuIO’s standout features is its cross-platform support. Whether you’re developing on Windows, Mac, or Linux, BleuIO provides a consistent experience, allowing developers to work in their preferred environment without worrying about compatibility issues. This flexibility is crucial for collaborative projects and development on diverse platforms.

    BLE Testing Made Easy with BleuIO

    Testing Capabilities

    Testing BLE applications can be challenging due to the need to simulate various BLE devices and scenarios. BleuIO simplifies this process by allowing developers to mock BLE devices and create test environments that mimic real-world conditions. This capability is invaluable for verifying the functionality and reliability of BLE applications before deployment.

    Real-World Applications

    For instance, developers can use BleuIO to simulate a range of BLE devices, test communication protocols, and evaluate how their application handles different scenarios. This approach helps in identifying potential issues early in the development cycle and ensures a smoother testing process.

    Development Flexibility with BleuIO

    Python and JavaScript Libraries

    BleuIO supports development in both Python and JavaScript, two of the most widely used programming languages. The provided libraries offer a range of functions for interacting with BLE devices, making it easier to integrate BLE functionality into applications. Whether you’re working on a web-based application or a Python script, BleuIO’s libraries streamline the development process.

    Consistency Across Platforms

    Regardless of the operating system or programming language used, BleuIO maintains a consistent development experience. This uniformity is crucial for developers working in teams or switching between different environments, as it ensures that the development and testing processes remain predictable and efficient.

    Compatibility with Popular Development Boards

    One of the strengths of BleuIO is its versatility in working with a wide range of development boards. Whether you’re using STM32, Arduino, Raspberry Pi, BeagleBone, or other popular boards, BleuIO provides a consistent and seamless experience.

    Consistency Across Different Boards and Operating Systems

    Different development boards and operating systems have their own methods for handling Bluetooth communication. For instance, STM32 and Arduino boards may require different configurations and libraries compared to Raspberry Pi or BeagleBone. This diversity can create challenges for developers working across multiple platforms.

    BleuIO addresses this issue by providing a consistent interface for BLE communication regardless of the underlying hardware or operating system.

    Regular Firmware Updates and Backward Compatibility

    The technology landscape is ever-changing, and staying current with the latest advancements is crucial for maintaining a competitive edge. The BleuIO team understands this need and is dedicated to providing continuous support through frequent firmware updates. These updates are designed to introduce new features and improvements, ensuring that BleuIO remains at the cutting edge of BLE technology. By incorporating the latest functionalities, the team helps developers access the most advanced tools and capabilities for their projects. Additionally, performance enhancements and bug fixes are integral parts of these updates, leading to better communication efficiency, reduced latency, and an overall improved user experience.

    Equally important is the commitment to backward compatibility. The BleuIO team ensures that new firmware versions work seamlessly with existing applications and projects. This approach allows developers to upgrade to the latest firmware without concerns about breaking changes that could disrupt their current work. By maintaining backward compatibility, BleuIO provides a consistent development experience, enabling developers to continue using their existing codebases and tools without extensive modifications. This long-term support ensures that existing applications remain stable while allowing developers to take advantage of new features and enhancements as they become available.

    In summary, BleuIO is a valuable tool for developers working with Bluetooth Low Energy technology. Its intuitive AT commands, cross-platform support, and versatile libraries make it an excellent choice for simplifying BLE application development. By reducing the complexity of BLE communication and providing robust testing capabilities, BleuIO empowers developers to create, test, and deploy BLE applications with confidence. If you’re involved in BLE development, consider exploring BleuIO to enhance your development workflow and streamline your projects.

    Share this post on :

    Mobile BLE Development: Connect BleuIO to Your Mobile Device

    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:

    1. Connect BleuIO to Your Mobile Device: Use a USB OTG adapter to connect the BleuIO dongle to your smartphone or tablet.
    2. 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.

    https://smart-sensor-devices-ab.github.io/mobile_web_ble/

    Here’s what will happen:

    1. Connect to BleuIO: Tap the “Connect to BleuIO” button to initiate a connection.
    2. 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.
    3. 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.

    Share this post on :

    Real-Time CO2 Status Indicator and Monitor with BleuIO and Renesas EK-RA4M2

    Introduction

    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.

    Requirements

    Setup

    • 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.

    Share this post on :

    BLE device presence detection : How to scan and filter devices by RSSI using BleuIO

    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:

    1. Hardware: You’ll need a BleuIO USB dongle. Plug it into your computer’s USB port.
    2. 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.

    <!DOCTYPE html>
    <html lang="en">
      <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Look for Close Beacon</title>
        <style>
          body {
            text-align: center;
            margin: 200px auto;
            width: 800px;
            font-size: 20px;
          }
        </style>
      </head>
      <body>
        <button id="connect" style="font-size: 20px; width: 200px; height: 50px">
          Scan
        </button>
        <pre id="output"></pre>
    
        <script src="serial.js"></script>
      </body>
    </html>
    

    JavaScript Code: serial.js

    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;">&#9679;</div>Close beacon is within the range of 5 meters.<br>';
          } else {
            outputElement.innerHTML =
              '<div style="color: red; display: inline-block; margin-right: 8px;">&#9679;</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

    1. HTML Interface:
      • The HTML file provides a simple user interface with a “Scan” button. When clicked, this button triggers the BLE scanning process.
    2. 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.

    Share this post on :