Sondes de température BLE
Sondes de température
Firmware : https://pvvx.github.io/BTH01/
Démarrage d'une VM :
qemu-system-x86_64 \ -cpu host -machine type=q35,accel=kvm -m 2048 \ -nographic \ -snapshot \ -netdev id=net00,type=user,hostfwd=tcp::2222-:22 \ -device virtio-net-pci,netdev=net00 \ -drive if=virtio,format=qcow2,file=ubuntu-24.04-server-cloudimg-amd64.img \ -drive if=virtio,format=raw,file=seed.img \ -chardev serial,path=/dev/ttyUSB0,id=hostusbserial -device pci-serial,chardev=hostusbserial ubuntu@cloudimg:~$ sudo dmesg -T | grep tty [Wed Jul 9 19:26:00 2025] Command line: BOOT_IMAGE=/vmlinuz-6.8.0-60-generic root=LABEL=cloudimg-rootfs ro console=tty1 console=ttyS0 [Wed Jul 9 19:26:00 2025] Kernel command line: BOOT_IMAGE=/vmlinuz-6.8.0-60-generic root=LABEL=cloudimg-rootfs ro console=tty1 console=ttyS0 [Wed Jul 9 19:26:00 2025] printk: legacy console [tty1] enabled [Wed Jul 9 19:26:00 2025] printk: legacy console [ttyS0] enabled [Wed Jul 9 19:26:01 2025] 00:03: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A [Wed Jul 9 19:26:01 2025] 0000:00:03.0: ttyS4 at I/O 0xc180 (irq = 23, base_baud = 115200) is a 16550A [Wed Jul 9 19:26:04 2025] systemd[1]: Created slice system-serial\x2dgetty.slice - Slice /system/serial-getty. [Wed Jul 9 19:26:04 2025] systemd[1]: Expecting device dev-ttyS0.device - /dev/ttyS0... git clone https://github.com/pvvx/THB2.git cd THB2/ # flash boot sudo python3 rdwr_phy62x2.py -p /dev/ttyS4 -e -r wh bin/BOOT_BTH01_v21.hex # flash app sudo python3 rdwr_phy62x2.py -p /dev/ttyS4 -r we 0x10000 bin/BTH01_v21.bin
Gateway BLE <> MQTT
Firmware : https://github.com/shmuelzon/esp32-ble2mqtt
Compilation :
idf.py build
Flash :
esptool --chip esp32 -b 460800 --before default-reset --after hard-reset write-flash --flash-mode dio --flash-size 4MB --flash-freq 40m 0x1000 build/bootloader/bootloader.bin 0x8000 build/partition_table/partition-table.bin 0xd000 build/ota_data_initial.bin 0x10000 build/ble2mqtt.bin 0x310000 build/fs_0.bin 0x350000 build/fs_1.bin
Log :
2025-08-16 18:06:25.158656 (blegw-etage.home): I (8350) BLE2MQTT: Connected to the network, connecting to MQTT 2025-08-16 18:06:25.162437 (blegw-etage.home): I (8350) MQTT: Connecting MQTT client 2025-08-16 18:06:25.179555 (blegw-etage.home): I (8380) MQTT: MQTT client connected 2025-08-16 18:06:25.179740 (blegw-etage.home): I (8380) BLE2MQTT: Connected to MQTT, scanning for BLE devices 2025-08-16 18:06:25.349979 (blegw-etage.home): I (8490) BLE2MQTT: Discovered BLE device: 4b:5b:db:47:06:85 (RSSI: -92), not connecting 2025-08-16 18:06:27.201456 (blegw-etage.home): I (10400) BLE2MQTT: Discovered BLE device: 6f:2b:68:15:3e:e3 (RSSI: -92), not connecting 2025-08-16 18:06:27.400887 (blegw-etage.home): I (10570) BLE2MQTT: Discovered BLE device: a4:c1:38:1f:65:29 (RSSI: -74), not connecting 2025-08-16 18:06:28.216789 (blegw-etage.home): I (11370) BLE2MQTT: Discovered BLE device: 48:b0:2d:06:bd:e7 (RSSI: -65), not connecting 2025-08-16 18:06:28.422484 (blegw-etage.home): I (11590) BLE2MQTT: Discovered BLE device: 40:b7:fc:17:a3:68 (RSSI: -79), connecting 2025-08-16 18:06:28.422627 (blegw-etage.home): I (11590) BLE2MQTT: Discovered BLE device: c1:f7:9c:b5:44:4a (RSSI: -87), not connecting 2025-08-16 18:06:39.896083 (blegw-etage.home): I (23060) BLE2MQTT: Connected to device: 40:b7:fc:17:a3:68, scanning 2025-08-16 18:06:40.442835 (blegw-etage.home): I (23640) BLE2MQTT: Publishing: 40:b7:fc:17:a3:68/GenericAccess/DeviceName = BTH01-17A368 2025-08-16 18:06:40.613123 (blegw-etage.home): I (23760) BLE2MQTT: Publishing: 40:b7:fc:17:a3:68/GenericAccess/Appearance = 768 2025-08-16 18:06:40.710396 (blegw-etage.home): I (23880) BLE2MQTT: Publishing: 40:b7:fc:17:a3:68/GenericAccess/PeripheralPreferredConnectionParameters = 24,24,29,360 2025-08-16 18:06:40.914499 (blegw-etage.home): I (24060) BLE2MQTT: Publishing: 40:b7:fc:17:a3:68/DeviceInformation/ModelNumberString = BTH01 2025-08-16 18:06:40.952098 (blegw-etage.home): I (24150) BLE2MQTT: Publishing: 40:b7:fc:17:a3:68/DeviceInformation/SerialNumberString = C44013-59598320-00 2025-08-16 18:06:41.119143 (blegw-etage.home): I (24270) BLE2MQTT: Publishing: 40:b7:fc:17:a3:68/DeviceInformation/FirmwareRevisionString = github.com/pvvx 2025-08-16 18:06:41.223623 (blegw-etage.home): I (24390) BLE2MQTT: Publishing: 40:b7:fc:17:a3:68/DeviceInformation/HardwareRevisionString = 0014 2025-08-16 18:06:41.325836 (blegw-etage.home): I (24480) BLE2MQTT: Publishing: 40:b7:fc:17:a3:68/DeviceInformation/SoftwareRevisionString = V2.1 2025-08-16 18:06:41.369860 (blegw-etage.home): I (24570) BLE2MQTT: Publishing: 40:b7:fc:17:a3:68/DeviceInformation/ManufacturerNameString = Tuya 2025-08-16 18:06:42.454868 (blegw-etage.home): I (25620) BLE2MQTT: Publishing: 40:b7:fc:17:a3:68/BatteryService/BatteryLevel = 100 2025-08-16 18:06:42.696958 (blegw-etage.home): I (25890) BLE2MQTT: Publishing: 40:b7:fc:17:a3:68/EnvironmentalSensing/Temperature = 2726 2025-08-16 18:06:42.957625 (blegw-etage.home): I (26130) BLE2MQTT: Publishing: 40:b7:fc:17:a3:68/EnvironmentalSensing/Humidity = 5608
Debug série
picocom -b 115200 --omap crcrlf --echo /dev/ttyUSB0
