65 lines
2.5 KiB
Markdown
65 lines
2.5 KiB
Markdown
# Budka link — a Chytra Budka as a sensor source
|
|
|
|
A Chytra Budka (ESP32-S3 bird box) sends its readings over a one-way UART line
|
|
to a XIAO nRF52840 running `simple_sensor`; the sensor serves them as
|
|
CayenneLPP telemetry to anyone on the mesh. The line format and the budka side
|
|
are documented in the chytra-budka repo, `firmware/MESHCORE.md`.
|
|
|
|
## Build
|
|
|
|
`BudkaLinkSensorManager` (`src/helpers/sensors/`) replaces the variant's
|
|
`EnvironmentSensorManager` when the env defines `BUDKA_LINK_RX_PIN`; every
|
|
other env is unchanged.
|
|
|
|
```ini
|
|
[env:Xiao_x1_budka] ; platformio.local.ini
|
|
extends = env:Xiao_nrf52_sensor
|
|
build_flags =
|
|
${env:Xiao_nrf52_sensor.build_flags}
|
|
${test_radio.build_flags} ; bench: test band only
|
|
-D BUDKA_LINK_RX_PIN=0 ; D0 = the only pad LoRa + I²C leave free
|
|
```
|
|
|
|
Optional: `BUDKA_LINK_TX_PIN` (default `LED_GREEN` — nothing is ever sent, the
|
|
idle-high line keeps that LED dark), `BUDKA_LINK_BAUD` (115200),
|
|
`BUDKA_LINK_METERS` (3), `BUDKA_LINK_STALE_MS` (120 s).
|
|
|
|
## Wiring
|
|
|
|
Budka `mc_tx` pad → XIAO **D0**, GND ↔ GND, each board on its own USB. A
|
|
1 kΩ series resistor protects against back-powering when one side is off.
|
|
|
|
## Telemetry layout
|
|
|
|
| channel | content |
|
|
|---|---|
|
|
| 1 | the node itself |
|
|
| next | budka: temperature, humidity, pressure, motion count (generic sensor) |
|
|
| next + k | UC96 meter *k*: voltage, current, power (analog input), energy (kWh) |
|
|
|
|
A line with a bad checksum is dropped whole; a value not refreshed for 2 min is
|
|
left out. Meter channels stay reserved while a meter is missing.
|
|
|
|
Read it with `.tth/tools/budka_telem.py <companion-port> <sensor-name>`. The sensor
|
|
answers only clients in its ACL — a request from anyone else is dropped
|
|
(`recv matches no peers` in a `MESH_DEBUG` build). Add the companion from the
|
|
sensor's USB console with `setperm <companion-pubkey> 1`, or log in as admin.
|
|
The port may be a pyserial URL (`socket://…` for an openHop companion), and the
|
|
name may be the sensor's public key when the companion does not have it yet.
|
|
|
|
## Bench result (13. 10. 2026)
|
|
|
|
x1 (sensor, test band) fed by the bench budka; x4 as USB companion:
|
|
|
|
```
|
|
ch2 temp_C 25.3 humidity_% 59.0 generic 29
|
|
ch3 voltage_V 4.94 current_A 0.10 analog_in 0.49 energy_kWh 0.111
|
|
ch4 voltage_V 4.94 current_A 0.18 analog_in 0.89 energy_kWh 0.311
|
|
```
|
|
|
|
## Not done
|
|
|
|
Alerts (reed opened, budka WiFi down) and the return direction (mesh → budka).
|
|
The sensor build has no `dfu` console command — reflash with
|
|
`pio run -t upload`, one touch per power session.
|