Chart Android Bluetooth Low Energy app graphs raw numerical string data from an Internet Of Things (IOT) device like the ESP32-S3 using MicroPython optimized for microcontrollers. Fun educational projects are illustrated for your enjoyment below.
Amazon Parts
ESP32-S3 Buy at least 512K RAM version
HC-SR04 Ultrasonic Sensor A generic educational module will do
Setup Instructions
- Install MicroPython on ESP32-S3 device
- Install Thorny IDE
- Download BluetoothLE library file onto ESP32-S3 device
- Download HCSR04 library file onto ESP32-S3 device
MicroPython Ultrasonic Sensor code
from time import sleep_ms
from BluetoothLE import ESP32_BLE
from hcsr04 import HCSR04
# Bluetooth LE
ble = ESP32_BLE("ESP32BLE-SR04")
# modify pin locations if need be
sensor = HCSR04(trig_pin=38, echo_pin=40)
while True:
distance = sensor.distance_cm()
print('Distance:', distance, 'cm')
if distance != -1:
ble.send(str(distance))
sleep_ms(500)
Schematic