This page describes the Bluetooth API that you can use to work with Atmotube directly via BLE connection (without Atmotube App). e.g. you can write custom program for Windows, Raspberry Pi, etc.
There are 2 ways to get data from an Atmotube device:
You can check the following code samples:
To analyze Bluetooth packets and check GATT characteristics, you can use the Nordic “nRF Connect” app for Android and iOS.
Note: This page describes the data format for the latest available firmware. Previous firmware versions may work in a different way.
Bluetooth Broadcast
To view a raw packet, press the RAW button.
Raw Atmotube PRO packet example:
0x0201060FFFFFFF00D9F4982B1900018BC74135090941544D4F545542451107B48A324AD96ED7AD18489A8E010045DB0CFFFFFF00040005000674051B
BLE Advertising Packet Format
Len | Type | Description | Value |
2 |
| Flags |
|
15 |
| Manufacturer Specific Data |
Company Identifier
SGPC3 VOC, ppb
Device ID
BME280 humidity, %
BME280 temperature, ℃
BME280 pressure, mbar * 100
Info Byte
Battery Level, %
|
9 |
| Complete local name |
|
17 |
| Complete List of 128-bit Service Class UUIDs | Atmotube PRO |
12 |
| Manufacturer Specific Data (scan response) |
PM1, ug/m³
PM2.5, ug/m³
PM10, ug/m³
FW Version Major
FW Version Minor
FW Version Build
|
SGPC3 data format
Size, bytes | Example | Description |
2 |
| VOC data 0294 (hex) -> 660 (int) ppb / 1000 = 0.66 ppm |
BME280 data format
Size, bytes | Example | Description |
1 |
| humidity 1E (hex) -> 30 (int) % |
1 |
| temperature 1C (hex) -> 28 (int) ℃ |
4 |
| pressure 182E0 (hex) -> 99040 (int) / 100 = 990.40 mbar |
SPS30 data format
Size, bytes | Example | Desription |
2 |
| PM1 -> 0004 (hex) -> 4 (int) ug/m³ |
2 |
| PM2.5 -> 0005 (hex) -> 5 (int) ug/m³ |
2 |
| PM10 -> 0006 (hex) -> 6 (int) ug/m³ |
Info byte data format
Bits | Description |
MSB | Reserved |
7 | SGPC3 pre-heating status |
6 | Reserved |
5 | Device charging timer status |
4 | Device charging status |
3 | Device bonding status |
2 | Device error status |
LSB | PRO only - PM sensor status |
GATT characteristics
UUID | Description |
6E400001-B5A3-F393-E0A9-E50E24DCCA9E | UART service |
6E400002-B5A3-F393-E0A9-E50E24DCCA9E | UART RX characteristic |
6E400003-B5A3-F393-E0A9-E50E24DCCA9E | UART TX characteristic |
Atmotube PRO
UUID | Description |
DB450001-8E9A-4818-ADD7-6ED94A328AB4 | Atmotube PRO service |
DB450002-8E9A-4818-ADD7-6ED94A328AB4 | SGPC3 characteristic (4 bytes) - little-endian |
DB450003-8E9A-4818-ADD7-6ED94A328AB4 | BME280 characteristic (8 bytes) - little-endian |
DB450004-8E9A-4818-ADD7-6ED94A328AB4 | Status characteristic (2 bytes) - little-endian |
DB450005-8E9A-4818-ADD7-6ED94A328AB4 | PM characteristic (12 bytes) - little-endian |
Data History Protocol
History data sending is implemented via UART service. You have to send commands via RX and handle device answers via TX UART characteristics.
1. After UART connection, mobile device sends HST (history) request with current timestamp. UART service responds with HOK (history OK) acknowledge.
Command, ASCII, 3 bytes | Unix time, 4 bytes—current system time |
HST | XXXX |
Command, ASCII, 3 bytes |
HOK |
2. If the device has not synced history available, it starts data sending with HT packed following one or several HD packets. HT packet contains timestamp of the starting HD packet and number of HD packets and size. Mobile devices acknowledge HD packets received by sending the HOK command with the current timestamp.
Command, ASCII, 2 bytes | 1 byte | Unix time, 4 bytes—first HD packet time | Number of HD packets, 1 byte | Size of the one measurement in bytes, 1 byte |
HT | 0 | XXXX | X | X |
Command, ASCII, 2 bytes | 1 byte | Packet number, 1 byte | Measurement 1 | - | Measurement N |
HD | 0 | X | XXXX | - | XXXX |
Command, ASCII, 2 bytes | 1 byte | Packet number, 1 byte | Measurement N+1 | - | Measurement N+1+x |
HD | 0 | X | XXXX | - | XXXX |
Measurement
N | Size in bytes, 1 byte | Description |
0 | 1 | Temperature, ℃ |
1 | 1 | Humidity, % |
2 | 2 - little-endian | VOC (ppb) |
3 | 4 - little-endian | Pressure (mbar * 100) |
4 | 2 - little-endian | PM1, ug/m³ |
5 | 2 - little-endian | PM2.5, ug/m³ |
6 | 2 - little-endian | PM10, ug/m³ |
If a mobile device receives HT + all HD packets, it acknowledges data by sending the HOK command.
Command, ASCII, 3 bytes | Unix time, 4 bytes—current system time |
HOK | XXXX |