A lightweight MicroPython demo showing how to:
- Expose a Nordic UART Service (NUS) over BLE
- Control the onboard LED
- Read temperature & humidity from an HDC1080 sensor
Ideal for prototyping sensor-to-mobile IoT applications.
-
Hardware
- Wemos ESP32 D1 Mini (or any ESP32 board)
- HDC1080 temperature & humidity sensor
- Optional: external red LED on GPIO 2
-
Software
- MicroPython Firmware:
esp32-idf4-20210202-v1.14.bin
- Library HDC1080: hdc1080.py
- Tool to upload files: ampy or the built-in WebREPL
- Android: Serial Bluetooth Terminal
- MicroPython Firmware:
-
Flash MicroPython firmware onto your ESP32:
esptool.py --port /dev/ttyUSB0 erase_flash esptool.py --port /dev/ttyUSB0 write_flash -z 0x1000 esp32-idf4-20210202-v1.14.bin
-
Copy files to the board:
ampy --port /dev/ttyUSB0 put main.py ampy --port /dev/ttyUSB0 put hdc1080.py
-
Reset the ESP32. It will start advertising as ESP32.
-
Open your BLE terminal app and connect to ESP32.
-
Send one of these commands:
Command Action red_led
Toggle the red LED (GPIO 2) read_temp
Read temperature (Β°C) & get a notification read_hum
Read humidity (%) & get a notification -
Youβll receive responses ending with
\n
. -
Watch the onboard LED blink when disconnected, solid when connected.
ESP32 D1 Mini HDC1080 Module
--------------- ----------------
GPIO 21 (SDA) βββ> SDA
GPIO 22 (SCL) βββ> SCL
GND βββ> GND
3V3 βββ> VCC
GPIO 2 (optional) ββ(LED)β> GND
This project is licensed under the MIT License.