Developing a GATT server
When we want to share sensor data with client applications, we need more than a simple beacon. In this example, we will develop a Bluetooth temperature sensor that we can connect to and receive temperature readings by using a mobile application, such as nRF Connect. One interesting feature is that the sensor will be able to push data to the client application when a new reading is available.
The hardware preparation is easy. We will only use a DHT11 connected to GPIO17 of ESP32. After the hardware setup, we configure a new project:
- Let's start with a new PlatformIO project with the following
platformio.ini
:[env:az-delivery-devkit-v4] platform = espressif32 board = az-delivery-devkit-v4 framework = espidf monitor_speed = 115200 lib_extra_dirs = Â Â Â Â ../../common/esp-idf-lib/components
esp-idf-lib
contains the driver for DHT11. The source code is located here: - Then we need to add two files,
app.h
andapp.c
, into the project...