BleuIO Pro Firmware v1.0.7.3 Released: Improved GATT Discovery and MTU Control

We’re pleased to announce the release of BleuIO Pro firmware v1.0.7.3, introducing new MTU negotiation commands, improved GATT discovery stability, and optimized handling of complex Bluetooth Low Energy (BLE) devices.

This update gives developers greater control over BLE connections while improving performance and reliability when working with peripherals containing large GATT databases.

New MTU Negotiation Controls

Firmware v1.0.7.3 introduces two new AT commands for managing MTU negotiation.

AT+REQMTU – Request MTU Exchange Manually

The new AT+REQMTU command allows developers to initiate a GATT client MTU exchange at any point after establishing a BLE connection.

This provides greater flexibility when testing peripheral behavior, debugging connections, or managing specific connection workflows.

AT+AUTOMTU – Control Automatic MTU Negotiation

The new AT+AUTOMTU command lets developers enable or disable automatic MTU negotiation during connection parameter updates.

  • AT+AUTOMTU=1 – Enable automatic MTU negotiation.
  • AT+AUTOMTU=0 – Disable automatic MTU negotiation.

When disabled, developers can use AT+REQMTU to trigger the exchange manually, allowing more predictable connection handling in automated scripts and applications.

Improved GATT Discovery Stability

This release addresses an issue where BleuIO Pro could unexpectedly reset while discovering services and characteristics on peripherals with exceptionally large GATT databases.

The discovery engine has been redesigned to use a sequential streaming architecture instead of memory-intensive hierarchical caching.

With this improvement, GATT attributes are processed dynamically and sent to the USB interface as they are discovered.

Key benefits include:

  • Reduced memory consumption during GATT discovery.
  • Improved connection stability with complex BLE peripherals.
  • Support for up to 165 characteristics within a single service.
  • More efficient processing of large GATT profiles.

These improvements apply to the following commands:

  • AT+GETSERVICES
  • AT+GETSERVICESONLY
  • AT+GETSERVICEDETAILS

GATT Discovery Output Changes

With the new streaming architecture, discovered GATT attributes are reported immediately as they are processed.

One small change affects the presentation order of descriptors. Previously, descriptors such as CCCDs (0x2902) appeared directly after their associated characteristics. They are now grouped at the end of the corresponding service block.

Important: All JSON fields in verbose mode and standard text-mode output strings remain unchanged. Only the order of descriptor entries has been modified.

Developers using custom parsers that depend on descriptor ordering should review their implementation to ensure compatibility.

How to Update Your Firmware

Updating your BleuIO Pro is straightforward.

You can download the latest firmware and follow the step-by-step update instructions in our official documentation:

BleuIO Pro Firmware Update Guide

Alternatively, you can update directly from your browser using the BleuIO web application:

Update Firmware Using BleuIO Web App

Both methods provide a simple way to get your BleuIO Pro running the latest firmware.

We recommend updating to v1.0.7.3 to benefit from the latest MTU controls, improved GATT discovery stability, and support for larger peripheral profiles.

Share this post on :

Scanning HibouAir Sensors with CircuitPython, BleuIO and the Cytron MOTION 2350 Pro

In this tutorial we will use CircuitPython to turn a Cytron MOTION 2350 Pro into a HibouAir scanner. The board’s RP2350 has no Bluetooth radio of its own. A BleuIO dongle in the board’s USB-A host port provides Bluetooth Low Energy, and a short CircuitPython program talks to it with ordinary AT commands.

The program scans for air quality monitoring device HibouAir advertisements, decodes them, and keeps the latest readings in global variables. One of them, the PM10 value from a HibouAir PM sensor, is ready to be used by the rest of your program. As an example, the program turns a hobby servo on one of the board’s servo ports into an analog PM10 gauge.

Everything runs on the board. No computer is needed once the code is in place, and the HibouAir sensors do not need to be paired.

Requirements

Hardware

Software

  • CircuitPython 10.x for the Cytron MOTION 2350 Pro, from circuitpython.org. The tutorial uses 10.3.1.
  • Two libraries from the Adafruit CircuitPython Library Bundle for version 10.x, copied into the lib folder on the CIRCUITPY drive:
    • asyncio (the whole folder)
    • adafruit_ticks.mpy, which asyncio needs

With circup installed on your computer, one command copies both:

circup install asyncio

Everything else the program uses is built into CircuitPython: usb_host, usb.core, json, binascii, microcontroller, pwmio and time. The servo is driven with pwmio directly, so it needs no extra library. No boot.py is needed.

What Does This Project Do?

1. The board becomes a USB host

The MOTION 2350 Pro’s USB-A port is driven by the RP2350’s PIO. CircuitPython starts it with usb_host.Port on GPIO24 and GPIO25. The board definition has no named pins for this port, so the program uses the raw pins.

2. CircuitPython finds BleuIO

The program waits until a device with vendor ID 0x2DCF and product ID 0x6002 appears, which is BleuIO. It selects the dongle’s configuration and sets DTR and RTS, so that BleuIO starts sending its output.

3. The dongle is brought into a known state

BleuIO remembers what it was doing, so a scan from an earlier run may still be going. The program first sends Ctrl-C three times to stop it. It then throws away everything the dongle sends until it has been quiet for 0.3 seconds. After that it sends:

  • ATE0, which turns echo off
  • ATV1, which turns verbose mode on, so every reply is one line of JSON

4. BleuIO scans for HibouAir only

AT+FINDSCANDATA=FF5B07

This reports only advertisements that contain FF5B07. FF is the AD type for manufacturer-specific data, and 5B 07 is HibouAir’s company ID, 0x075B, as it appears in the packet. Each result arrives as a line such as:

{"SF":127,"addr":"D9:63:8F:8E:01:0D","type":0,"data":"0201061BFF5B070504220095AE009627CF00AC014200000000000000019902"}

5. The board decodes the advertisement

The program walks the advertisement’s AD structures until it finds the HibouAir manufacturer data. This works whether or not the flags field comes first. Counting from the company ID, the sensor beacon (beacon type 0x05) holds:

OffsetFieldFormat
2Beacon type0x05 for sensor readings
3Board type0x03 is the PM sensor
4–6Sensor IDas shown in the HibouAir app, e.g. 22026A
9Pressure16-bit little-endian, tenths of hPa
11Temperature16-bit little-endian, signed, tenths of °C
13Humidity16-bit little-endian, tenths of %rh
17PM1.016-bit little-endian, tenths of µg/m³
19PM2.516-bit little-endian, tenths of µg/m³
21PM1016-bit little-endian, tenths of µg/m³
23CO216-bit big-endian, ppm

6. The readings are kept in global variables

  • pm10: the latest PM10 value in µg/m³, or None until a PM sensor has been heard
  • pm10_sensor: the ID of the sensor it came from
  • pm10_time: time.monotonic() when it arrived, so that a stale value can be recognised
  • sensors: a dictionary with everything the last beacon of every HibouAir sensor said, keyed by sensor ID

If you have more than one PM sensor, set PM_SENSOR_ID to the one pm10 should follow. If nothing has been heard for 15 seconds, the program starts the scan again.

Showing PM10 on a Servo Gauge

The MOTION 2350 Pro has eight servo ports, on GP0 to GP7, each with a PWM channel of its own. The program drives a servo on GP0 as a needle: 0 µg/m³ at 0 degrees, and 100 µg/m³ or more at 180 degrees.

With that full scale, the PM10 limits the HibouAir app uses fall at simple angles. That is where to draw the bands on a paper scale behind the servo arm:

PM10LevelNeedle
0–20 µg/m³Good0–36°
20–50 µg/m³Fair36–90°
50–100 µg/m³Poor90–180°
100 µg/m³ and aboveBad180°

The gauge is its own asyncio task, beside the reader and the command logic:

  • It sends a 50 Hz servo signal, from 500 µs at 0 degrees to 2500 µs at 180.
  • It moves the needle 2 degrees every 20 ms, so the arm swings to a new reading instead of jumping.
  • At start it sweeps once across the whole scale. A servo that is not connected is then noticed at once, instead of being taken for clean air.
  • Once the needle has been still for half a second, the pulses stop. A servo told to hold a position holds it actively, and at 0 degrees, the commonest reading of all, it pushes against its end stop and hums. Without pulses an ordinary hobby servo goes quiet and stays where it is.
  • The pulses start again when a new reading moves the needle by at least one degree, so readings of 0.0 and 0.1 µg/m³ taking turns do not wake it.

Connect the servo to the GP0 servo header, matching the servo cable to the markings next to the header. Check Cytron’s datasheet for how the servo ports are supplied before connecting a larger servo.

The settings are at the top of code.py:

  • SERVO_PIN: the port, board.GP0 to board.GP7
  • PM10_FULL_SCALE: the PM10 value at 180 degrees
  • SERVO_MIN_US and SERVO_MAX_US: the pulse widths at the ends. Narrow them if your servo strains at its end stops.
  • SERVO_STEP_DEG: how fast the needle moves
  • SERVO_REST_S and SERVO_DEADBAND_DEG: how long the needle is still before it rests, and how far a reading must move it to wake it

The board’s four DC motor drivers, on GP8 to GP15 (board.M1A to board.M4B in CircuitPython), would suit a different use of the same value, such as running a fan faster as PM10 rises.

Why the Flush After Ctrl-C Matters

Ctrl-C stops the scan, but whatever BleuIO had already queued still arrives afterwards. Often the last piece is a line cut off in the middle, sometimes with a byte that is not valid UTF-8.

In early versions of this program, a reader that tried to decode that line before removing it from its buffer stuck on it. Every later piece of data was appended behind the same broken line, and the program heard nothing more, in about half of all restarts.

The program now does two things:

  • It removes each line from the buffer before decoding it, so a broken line costs that line only.
  • It discards everything until the dongle has been quiet before sending the next command.

With both in place, the start-up worked every time in repeated tests, whether the dongle was fresh (echo on, verbose off) or left in verbose mode by an earlier run.

How to Run the Project

Step 1: Install CircuitPython

Download the CircuitPython UF2 for the Cytron MOTION 2350 Pro and put the board into its UF2 bootloader mode. On RP2350 boards this is done by holding BOOT while pressing RESET, or while connecting the USB cable. Copy the UF2 to the RP2350 drive that appears. The board restarts as a drive named CIRCUITPY.

Step 2: Add the libraries

Run circup install asyncio, or copy the asyncio folder and adafruit_ticks.mpy from the library bundle into CIRCUITPY/lib.

Step 3: Copy the program

Save the code at the end of this post as code.py on the CIRCUITPY drive. CircuitPython starts it as soon as the file is saved.

Step 4: Connect BleuIO

Insert the BleuIO dongle into the board’s USB-A port. Do not connect BleuIO to the computer for this setup.

Step 5: Connect the servo (optional)

Plug the servo into the GP0 servo header. It sweeps once from 0 to 180 degrees and back when the program starts, then follows PM10, and goes quiet whenever the needle is still.

Step 6: Watch the serial console

Open the board’s serial console at 115200 baud. Use Mu, Thonny or the CircuitPython web workflow, or on macOS and Linux:

screen /dev/cu.usbmodem2101 115200

The device name differs from computer to computer. If the console shows raw REPL; CTRL-B to exit, an editor has left it in raw REPL mode: press Ctrl-B, then Ctrl-D to start code.py.

Expected Output

BleuIO dongle found! (0x2dcf:0x6002)
CDC Control Lines (DTR/RTS) enabled.
Starting background USB reader task...
Starting the HibouAir scan...
[Sending]: ATE0
[Sending]: ATV1
[Sending]: AT+FINDSCANDATA=FF5B07
[HibouAir 22026A] PM10 0.1 ug/m3  PM2.5 0.1  PM1 0.0  21.8 C
[HibouAir 22008C] board 0x04, 21.5 C, 39.8 %rh, CO2 459 ppm
[HibouAir 220095] board 0x04, 20.8 C, 42.9 %rh, CO2 411 ppm
[HibouAir 22005A] board 0x04, 19.6 C, 44.2 %rh, CO2 721 ppm
[HibouAir 220265] board 0x09, 19.8 C, 45.5 %rh, CO2 533 ppm

Every HibouAir sensor in range appears with its ID. Lines from the PM sensor show the particle readings; the others show temperature, humidity and CO2. Each new PM line also updates pm10.

The Code

Source code is available to download from

https://github.com/smart-sensor-devices-ab/hibouair-with-circuitpython

This project is a practical example of how BleuIO can bring Bluetooth Low Energy connectivity to development boards without built-in Bluetooth support. Using the Cytron MOTION 2350 Pro and CircuitPython, we demonstrated how to scan for HibouAir sensors, read real-time data, and use that data to control a servo motor.

The complete source code is available for developers to explore, modify, and integrate into their own projects. Whether you’re building sensor monitoring systems, automation solutions, or custom IoT applications, this example provides a starting point for using BleuIO with compatible development boards.

Share this post on :

Send BLE Air Quality Data to Cloudflare D1 with Python and BleuIO

In this tutorial, we will build a simple BLE-to-cloud air quality gateway using HibouAir, BleuIO, Python, Cloudflare Workers, and Cloudflare D1.

A HibouAir sensor will advertise its air quality measurements over Bluetooth Low Energy. BleuIO, connected to a computer through USB, will scan for a specific HibouAir device and provide the BLE advertising data to a Python application through the serial port. The Python application will decode CO2, temperature, and humidity, display the measurements in the terminal, and upload them to a Cloudflare Worker. The Worker will then store the measurements in a Cloudflare D1 database.

This project is intentionally kept simple. It demonstrates how BleuIO can act as the Bluetooth interface for a desktop or gateway application without requiring the application itself to manage a Bluetooth stack.

Why Cloudflare D1?

Cloudflare D1 is a serverless SQL database built on SQLite. It works particularly well with Cloudflare Workers, allowing us to create a small HTTP API without running our own server.

For a project like this, there are several advantages:

  • No database server to install or maintain
  • No local web server required
  • HTTPS is handled automatically
  • Cloudflare Workers can communicate directly with D1
  • D1 supports regular SQL
  • A useful free tier is available
  • The database remains accessible even when the Computer running the BLE gateway is offline

This makes it convenient for prototypes, BLE gateways, environmental monitoring projects, demonstrations, and small IoT applications.

For this example, the Computer only needs to run the Python gateway application. Everything after the HTTP request is handled in the cloud.

Requirements

For this project, you will need:

Hardware

Software and services

  • Python 3
  • A free Cloudflare account
  • pyserial
  • requests

For this example, the HibouAir sensor has the board ID:

220069

and BleuIO appears on the Mac at:

/dev/cu.usbmodem4048FDEBA6D01

Your serial port depends on operating system and HibouAir board ID may be different.

Step 1: Create a Cloudflare D1 Database

First, log in to your Cloudflare account.

From the Cloudflare dashboard, go to the D1 database section and create a new database.

For this tutorial, we will call it:

hibouair-db

Once the database has been created, open its SQL Console.

Run the following SQL:

CREATE TABLE IF NOT EXISTS readings (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    board_id TEXT NOT NULL,
    measured_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
    co2 INTEGER NOT NULL,
    temperature REAL NOT NULL,
    humidity REAL NOT NULL
);

CREATE INDEX IF NOT EXISTS idx_readings_board_time
ON readings(board_id, measured_at);

This creates a simple table containing:

  • Database ID
  • HibouAir board ID
  • Timestamp
  • CO₂
  • Temperature
  • Humidity

The measured_at field is generated automatically by D1 when the reading is inserted.

A stored record will look conceptually like this:

id          1
board_id    220069
measured_at 2026-10-05 14:42:30
co2         623
temperature 24.1
humidity    43.7

Step 2: Create the Cloudflare Worker

Next, create a Cloudflare Worker.

Now go to:

Workers & Pages → Create application

Create a basic Worker. ( you can choose “Start with Hello world”)

The Worker will sit between our Python application and the D1 database.

For this project, we can name it:

hibouair-api

and then press deploy.

After creating the Worker, open the code editor and replace the default code with the following :

export default {
  async fetch(request, env) {
    const url = new URL(request.url);

    // API status
    if (url.pathname === "/" && request.method === "GET") {
      return Response.json({
        service: "HibouAir Cloud API",
        status: "online"
      });
    }

    // Store a new sensor reading
    if (url.pathname === "/api/readings" && request.method === "POST") {
      const suppliedKey = request.headers.get("X-API-Key");

      if (!suppliedKey || suppliedKey !== env.API_KEY) {
        return Response.json(
          {
            success: false,
            error: "Unauthorized"
          },
          {
            status: 401
          }
        );
      }

      let data;

      try {
        data = await request.json();
      } catch {
        return Response.json(
          {
            success: false,
            error: "Invalid JSON"
          },
          {
            status: 400
          }
        );
      }

      const boardId = String(data.board_id || "").trim();
      const co2 = Number(data.co2);
      const temperature = Number(data.temperature);
      const humidity = Number(data.humidity);

      if (!boardId) {
        return Response.json(
          {
            success: false,
            error: "board_id is required"
          },
          {
            status: 400
          }
        );
      }

      if (
        !Number.isFinite(co2) ||
        !Number.isFinite(temperature) ||
        !Number.isFinite(humidity)
      ) {
        return Response.json(
          {
            success: false,
            error: "Invalid sensor values"
          },
          {
            status: 400
          }
        );
      }

      const result = await env.DB
        .prepare(`
          INSERT INTO readings (
            board_id,
            co2,
            temperature,
            humidity
          )
          VALUES (?, ?, ?, ?)
        `)
        .bind(
          boardId,
          co2,
          temperature,
          humidity
        )
        .run();

      return Response.json({
        success: true,
        message: "Reading stored",
        board_id: boardId,
        co2: co2,
        temperature: temperature,
        humidity: humidity,
        meta: result.meta
      });
    }

    // Return the latest reading
    if (
      url.pathname === "/api/readings/latest" &&
      request.method === "GET"
    ) {
      const boardId =
        url.searchParams.get("board_id") || "220069";

      const reading = await env.DB
        .prepare(`
          SELECT
            id,
            board_id,
            measured_at,
            co2,
            temperature,
            humidity
          FROM readings
          WHERE board_id = ?
          ORDER BY id DESC
          LIMIT 1
        `)
        .bind(boardId)
        .first();

      if (!reading) {
        return Response.json(
          {
            success: false,
            error: "No readings found"
          },
          {
            status: 404
          }
        );
      }

      return Response.json({
        success: true,
        reading: reading
      });
    }

    return Response.json(
      {
        success: false,
        error: "Not found"
      },
      {
        status: 404
      }
    );
  }
};

Deploy the Worker.

At this stage, the Worker exists, but it is not yet connected to the D1 database.

Step 3: Bind the D1 Database to the Worker

Open the settings for the hibouair-api Worker.

Add a D1 database binding.

Use:

Variable name: DB
Database: hibouair-db

The variable name must be:

DB

because the Worker accesses the database through:

env.DB

For example:

await env.DB
    .prepare("SELECT * FROM readings")
    .all();

Once the binding has been added, deploy the Worker again if necessary.

Step 4: Add an API Key

Our Python application will be publicly connected to the Cloudflare Worker over HTTPS.

We therefore do not want anybody who discovers the Worker URL to be able to insert arbitrary sensor measurements.

We can protect the write endpoint using a simple API key.

On the Computer, generate a random key:

python3 -c "import secrets; print(secrets.token_hex(32))"

This will generate a long random value.

Copy it.

Now create a Worker secret environment variable named:

API_KEY

and paste the generated value as its value.

The Python application will include this key in every request using:

X-API-Key

The Worker checks:

const suppliedKey =
    request.headers.get("X-API-Key");

and compares it against:

env.API_KEY

Step 5: Test the Worker

Cloudflare will provide a Worker URL similar to:

https://hibouair-api.your-account.workers.dev

Open the base Worker URL in a browser.

You should receive something similar to:

{
  "service": "HibouAir Cloud API",
  "status": "online"
}

If you see this response, the Worker is running.

Our Python application will send measurements to:

https://hibouair-api.your-account.workers.dev/api/readings

The latest stored reading can later be retrieved from:

https://hibouair-api.your-account.workers.dev/api/readings/latest

Step 6: Download the Python Project

The source code for the BleuIO Python gateway is available on GitHub:

GitHub: https://github.com/smart-sensor-devices-ab/bleuio-cloudflare-d1-database

Clone the repository:

git clone https://github.com/smart-sensor-devices-ab/bleuio-cloudflare-d1-database

Then enter the project directory:

cd bleuio-cloudflare-d1-database

The project structure is intentionally small:

bleuio-cloudflare-d1/
│
├── main.py
├── info.example.txt
├── requirements.txt
└── .gitignore

The Python application handles:

  1. Connecting to BleuIO
  2. Sending BleuIO AT commands
  3. Searching for the HibouAir board ID
  4. Reading BLE advertising data
  5. Decoding CO2, temperature, and humidity
  6. Displaying the measurement in the terminal
  7. Sending the measurement to Cloudflare
  8. Repeating the process at a configurable interval

Step 7: Install the Python Dependencies

It is recommended to create a Python virtual environment.

Run:

python3 -m venv .venv

Activate it:

source .venv/bin/activate

Then install the required libraries:

pip install -r requirements.txt

The application only requires:

pyserial
requests

pyserial is used to communicate with BleuIO through the USB serial port.

requests is used to send the decoded measurements to the Cloudflare Worker over HTTPS.

Step 8: Configure the Project

The repository includes:

info.example.txt

Copy it:

cp info.example.txt info.txt

Then open:

info.txt

The configuration looks like this:

BLEUIO_PORT=/dev/cu.usbmodem4048FDEBA6D01
HIBOUAIR_SENSOR_ID=220069

SCAN_INTERVAL_SECONDS=30

CLOUDFLARE_API_URL=https://hibouair-api.YOUR-SUBDOMAIN.workers.dev/api/readings
CLOUDFLARE_API_KEY=YOUR_REAL_API_KEY

You need to update the values for your own environment.

BLEUIO_PORT

On our Mac, BleuIO is available at:

/dev/cu.usbmodem4048FDEBA6D01

Your port may be different.

You can normally find USB serial devices with:

ls /dev/cu.*

Look for the device corresponding to BleuIO.

On windows , look for COM port on device manager.

HIBOUAIR_SENSOR_ID

For this project, our HibouAir board ID is:

220069

Replace this with the board ID of the HibouAir device you want to monitor.

SCAN_INTERVAL_SECONDS

This determines how often the application starts a new HibouAir scan.

For this tutorial:

SCAN_INTERVAL_SECONDS=30

means approximately one scan every 30 seconds.

You can later change this without modifying the Python source code.

For example:

SCAN_INTERVAL_SECONDS=60

for approximately one reading per minute.

Or:

SCAN_INTERVAL_SECONDS=300

for approximately one reading every five minutes.

CLOUDFLARE_API_URL

Replace this with the URL of the Worker created earlier:

CLOUDFLARE_API_URL=https://hibouair-api.YOUR-SUBDOMAIN.workers.dev/api/readings

CLOUDFLARE_API_KEY

Enter the same secret that was configured in the Cloudflare Worker:

CLOUDFLARE_API_KEY=YOUR_REAL_API_KEY

The info.txt file should not be committed to GitHub because it contains the API key.

Step 9: How the HibouAir Data Is Read

BleuIO communicates with our Python application using simple AT commands over the serial port.

The application first connects to BleuIO and places it in central mode.

It then searches for our HibouAir board ID using:

AT+FINDSCANDATA=220069=5

Here:

220069

is the HibouAir board ID, and:

5

defines the scan duration.

BleuIO handles the Bluetooth Low Energy scanning and returns the matching BLE advertising information over serial.

This means the Python application does not need to directly communicate with the operating system’s native Bluetooth API.

BleuIO then returns the advertising data to Python.

Step 10: Decode the HibouAir Advertisement

The Python application searches the advertising payload for the HibouAir data section:

5B070

For the HibouAir advertisement used in this example, the application extracts the three measurements needed for this project. Temperature, Humidity and CO2. The result becomes a normal Python structure similar to:

{
    "co2": 623,
    "temperature": 24.1,
    "humidity": 43.7
}

The application also performs basic validation before uploading the measurements.

For example, obviously invalid temperature, humidity, or CO2 values are rejected instead of being stored in the database.

Step 11: Sending the Measurement to Cloudflare

Once a valid advertisement has been decoded, Python prepares a JSON request.

For example:

{
  "board_id": "220069",
  "co2": 623,
  "temperature": 24.1,
  "humidity": 43.7
}

This is sent using an HTTP POST request to:

/api/readings

The API key is included in the request header:

X-API-Key

The Cloudflare Worker validates the key and inserts the measurement into D1.

The Python application therefore never connects directly to the database.

Step 12: Run the Application

Before running the project, make sure no other program is currently using the BleuIO serial port.

For example, close any active BleuIO connection in:

  • BleuIO application
  • screen
  • serial monitor
  • terminal program
  • other Python application

Then run:

python3 main.py

The application should connect to BleuIO.

You should see output similar to:

BleuIO + HibouAir + Cloudflare D1
---------------------------------

BleuIO port : /dev/cu.usbmodem4048FDEBA6D01
HibouAir ID : 220069
Scan interval: 30 seconds

Trying BleuIO on /dev/cu.usbmodem4048FDEBA6D01 at 115200 baud...

BleuIO connected successfully.

Setting BleuIO to central mode...
Ready.

The application will then start scanning:

Scanning for HibouAir 220069...

Command: AT+FINDSCANDATA=220069=5

When a valid HibouAir advertisement is received and decoded, the terminal will display something similar to:

============================================
          HIBOUAIR AIR QUALITY
============================================

  CO2                623 ppm
  Temperature       24.1 °C
  Humidity          43.7 %RH

============================================

Uploading to Cloudflare D1...
✓ Reading stored successfully.

Next scan in 23 seconds...

The application continues running automatically.

There is no need to restart it for each measurement.

To stop the application, press:

Ctrl + C

Step 13: Check the Data in Cloudflare D1

Now return to the Cloudflare D1 database console.

Run:

SELECT *
FROM readings
ORDER BY id DESC
LIMIT 10;

You should see the measurements coming from HibouAir.

For example:

id  board_id  measured_at          co2  temperature  humidity

12  220069    2026-10-05 14:58:20  618  24.1         43.8
11  220069    2026-10-05 14:57:50  621  24.1         43.8
10  220069    2026-10-05 14:57:20  623  24.1         43.7

You can also explore the data from your database.

Step 14: Check the Latest Reading Through the API

We also created a simple read endpoint.

Open:

https://YOUR-WORKER.workers.dev/api/readings/latest

The Worker will query D1 and return the latest measurement.

For example:

{
  "success": true,
  "reading": {
    "id": 12,
    "board_id": "220069",
    "measured_at": "2026-10-05 14:58:20",
    "co2": 618,
    "temperature": 24.1,
    "humidity": 43.8
  }
}

Building a Dashboard Later

This tutorial intentionally stops at the database and API level.

The objective is to demonstrate the complete BLE-to-cloud data path while keeping the example easy to understand.

At this point, the data is already available in the cloud.

A developer could later build a dashboard showing:

Current CO₂
Current Temperature
Current Humidity

CO₂ history
Temperature history
Humidity history

A dashboard could request historical readings through additional Worker API endpoints.

It could also display thresholds, warnings, averages, minimum/maximum measurements, or other analytics.

Those features are deliberately outside the scope of this example because the main goal is to demonstrate how easily BLE data can be brought into a serverless cloud architecture using BleuIO.

We kept the project intentionally simple so that the individual parts are easy to understand and modify.

From here, the project can be expanded in many directions. Multiple HibouAir sensors could be monitored, additional air quality parameters could be stored, historical API endpoints could be created, and a complete cloud dashboard could be built on top of the existing data.

Share this post on :