From 3a397cfb4b99dd9f109e039fe27b1993c5d27f5e Mon Sep 17 00:00:00 2001 From: Roman Priesol Date: Wed, 30 Sep 2026 21:17:20 +0200 Subject: [PATCH] ANT+ via ESPHome: mcu-nrf-ant (RadiANT) sends heart rate to mcu-nrf-dk over packet_transport Replaces the E73 running the archived nrf-ant-bridge firmware and drops mcu-ant-host, which read that bridge's line protocol. --- mcu-ant-host.yaml | 34 ---------------------------------- mcu-nrf-ant.yaml | 43 +++++++++++++++++++++++++++++++++++++++++++ mcu-nrf-dk.yaml | 23 ++++++++++++++--------- secrets.yaml.default | 3 +++ 4 files changed, 60 insertions(+), 43 deletions(-) delete mode 100644 mcu-ant-host.yaml create mode 100644 mcu-nrf-ant.yaml diff --git a/mcu-ant-host.yaml b/mcu-ant-host.yaml deleted file mode 100644 index 3799743..0000000 --- a/mcu-ant-host.yaml +++ /dev/null @@ -1,34 +0,0 @@ -# Hardware: Linux host (ESPHome host platform) -# Pinout: -# /dev/ttyACM3 nRF52840 DK running ant_bridge (J-Link VCOM, usb-SEGGER_J-Link_000683492497) -substitutions: - device: ant-host - name: ANT+ Host - comment: ANT+ heart rate monitor via nRF52840 DK bridge - -esphome: - name: mcu-${device} - friendly_name: ${name} - comment: ${comment} - -host: - -packages: - api: !include common/api.yaml - logger: !include common/logger.yaml - -external_components: - - source: github://randybb/esphome-components - components: [ant_plus] - -uart: - # the host uart only takes /dev/, not /dev/serial/by-id/... - port: /dev/ttyACM3 - baud_rate: 115200 - -ant_plus: - device_number: 655730 - heart_rate: - name: Heart Rate - filters: - - throttle: 1s diff --git a/mcu-nrf-ant.yaml b/mcu-nrf-ant.yaml new file mode 100644 index 0000000..2a22d11 --- /dev/null +++ b/mcu-nrf-ant.yaml @@ -0,0 +1,43 @@ +--- +# Hardware: Nordic nRF52840 DK +# Pinout: +# P0.06 UART0 TX -> logger (J-Link VCOM) +# P1.01 UART1 TX -> mcu-nrf-dk UART1 RX (P1.01), packet_transport; plus GND +# Radio: ANT+ receiver (RadiANT), no network of its own; values go to mcu-nrf-dk +esphome: + name: mcu-nrf-ant + friendly_name: nRF ANT+ + +# needs the esphomeplatformzephyr fork (esphome-zephyr); RadiANT needs NCS +zephyr: + variant: NRF52 + board: nrf52840dk/nrf52840 + framework: + type: ncs + +logger: + hardware_uart: UART0 + +external_components: + - source: github://randybb/esphome-components + components: [ant_plus] + +ant_plus: + network_key: !secret ant_plus_network_key + device_number: 655730 + heart_rate: + id: heart_rate + name: Heart Rate + +uart: + id: link + port: UART1 + tx_pin: P1.01 + baud_rate: 115200 + +packet_transport: + - platform: uart + uart_id: link + update_interval: 1s + sensors: + - heart_rate diff --git a/mcu-nrf-dk.yaml b/mcu-nrf-dk.yaml index 97e4a2b..13558dc 100644 --- a/mcu-nrf-dk.yaml +++ b/mcu-nrf-dk.yaml @@ -9,7 +9,7 @@ # P0.16 LED 4 (active low) -> LED 4 (light binary) # P0.24 Button 3 (active low) -> Button 3 (binary_sensor gpio) # P0.25 Button 4 (active low) -> Button 4 (binary_sensor gpio) -# P1.01 UART1 RX <- Ebyte E73-TBM-01 (E73-2G4M04S1B, nRF52832) ant_bridge TX (P0.24) +# P1.01 UART1 RX <- mcu-nrf-ant UART1 TX (P1.01), packet_transport; plus GND esphome: name: mcu-nrf-dk friendly_name: nRF DK @@ -34,20 +34,25 @@ api: encryption: key: !secret api_key -external_components: - - source: github://randybb/esphome-components - components: [ant_plus] - -# ANT+ from the E73 test board running ant_bridge (the ANT stack doesn't work on NCS 3.4) +# ANT+ values from mcu-nrf-ant (second nRF52840 DK) over UART uart: + id: ant_link port: UART1 rx_pin: P1.01 baud_rate: 115200 -ant_plus: - device_number: 655730 - heart_rate: +packet_transport: + - platform: uart + uart_id: ant_link + providers: + - name: mcu-nrf-ant + +sensor: + - platform: packet_transport + provider: mcu-nrf-ant + remote_id: heart_rate name: Heart Rate + internal: false filters: - throttle: 1s diff --git a/secrets.yaml.default b/secrets.yaml.default index 14a8e6b..55e65e3 100644 --- a/secrets.yaml.default +++ b/secrets.yaml.default @@ -32,3 +32,6 @@ ble_beacon_toyota_yaris_honda_minor: 61958 # Thread active dataset (hex TLV) from Home Assistant thread_tlv: "0E080000000000010000" + +# ANT+ network key (8 bytes hex), from thisisant.com +ant_plus_network_key: "0000000000000000"