This library enables you to create your own Do-It-Yourself BLE enabled sensor gadget on the ESP32 platform.
Note: The library has changed in version 1.0.0 and won't work with code using version 0.14.0 or earlier. For a detailed guide on how to migrate your code, click here.
- Live sensor value broadcasting without requiring a BLE connection
- Simultaneous monitoring of sensor data from multiple BLE clients
- Sensirion MyAmbience CO2 App compatibility - allows you to monitor your gadgets, plot the sensor values and share/export the data.
- Buffering of sensor data for later download (sensor history download)
Please see the examples provided as reference on how to use this library.
Important points to keep in mind:
writeValueToCurrentSample
writes the sensor values to the library. But the values are not published to the BLE stack untilcommitSample
has been called- Keep the loop delay at 3ms, to allow the library to provide history data to the smart phone applications and other BLE clients nearby. Increasing this delay will slow down the download process.
- To allow history data downloads, you need to have the
handleDownload
function within the loop.
This project was developed and tested on Espressif ESP32 DevKitC hardware (see e.g. ESP32-DevKitC-32D)
Download the Sensirion MyAmbience CO2 App to monitor your gadget, plot the sensor values and share/export the data:
- Download Arduino IDE and setup the environment for ESP32 platform
-
Follow this guide
-
Detailed Instructions for advanced users: Arduino-ESP32
-
- Connect your ESP32 DevKit to your computer and launch the Arduino IDE
- In the Arduino IDE, make sure you have the
ESP32 Dev Module
selected and the PSRAMDisabled
- Download the library's release zip and unpack it into your Arduino's library path.
- Download the latest release
- How to import a zip library
- Select File -> Examples -> Sensirion Gadget BLE Lib -> Example 1
- Click the upload button
Install PlatformIO Core by following the official instructions.
To install this library (in ~/.platformio/lib
), execute the following command in a terminal.
pio lib --global install "Sensirion Gadget BLE Arduino Lib"
To test an example (e.g Example1_MockedReadings
), navigate to the example directory,
cd ~/.platformio/lib/Sensirion\ Gadget\ BLE\ Arduino\ Lib/examples/Example1_MockedReadings
compile and Upload
pio run -t upload
and start the Serial monitor.
pio device monitor
In order to use this library in your project, add it to the lib_deps
in your platformio.ini
file and include Sensirion_Gadget_BLE.h
.
Follow the instructions in this tutorial.
- /examples - Example sketches for the library (.ino). Run these from the Arduino IDE.
- /src - Source files for the library (.cpp, .h).
- library.properties - General library properties for the Arduino package manager.
If you want to retrieve the data of your new BLE gadget using your own device or application, you will need more information on the protocol used by this library.
Everything you will need should be available in the following document
See LICENSE.