Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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.

License

Notifications You must be signed in to change notification settings

2black0/MicroPython-ESP32-BLE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

10 Commits

Repository files navigation

MicroPython ESP32 BLE Demo

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.


πŸ“‹ Prerequisites

  • Hardware

    • Wemos ESP32 D1 Mini (or any ESP32 board)
    • HDC1080 temperature & humidity sensor
    • Optional: external red LED on GPIO 2
  • Software


βš™οΈ Installation

  1. 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
  2. Copy files to the board:

    ampy --port /dev/ttyUSB0 put main.py
    ampy --port /dev/ttyUSB0 put hdc1080.py
  3. Reset the ESP32. It will start advertising as ESP32.


πŸš€ Usage

  1. Open your BLE terminal app and connect to ESP32.

  2. 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
  3. You’ll receive responses ending with \n.

  4. Watch the onboard LED blink when disconnected, solid when connected.


πŸ” Wiring

ESP32 D1 Mini HDC1080 Module
--------------- ----------------
GPIO 21 (SDA) ───> SDA
GPIO 22 (SCL) ───> SCL
GND ───> GND
3V3 ───> VCC
GPIO 2 (optional) ──(LED)─> GND

πŸ“„ License

This project is licensed under the MIT License.

About

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.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /