ESP32-WROOM-32 (board: ESP32 Dev Module), TFmini Plus, 146-pixel 5V strip, Bluetooth Classic serial.
| Item | Value |
|---|---|
| TFmini green (sensor TX) | IO16 (Serial2 RX) |
| TFmini white (sensor RX) | IO17 (Serial2 TX) |
| TFmini baud | 115200 (sensor default) |
| Pixel data | IO18 → level shifter → 300–500 Ω → DIN |
| Pixel count | 146 |
| Power | 12A 5V supply, all grounds common; program with VBUS disconnected |
Defaults live at the top of the code. Every value can also be changed over Bluetooth (after unlock) and is saved to flash, so field adjustments survive the nightly power-off without reflashing.
| Setting | Default | Notes |
|---|---|---|
SENSOR_HEIGHT_CM | (measure in field) | Lens to ground. Fallback and clamp for the auto-learned ground distance. |
GROUND_CLAMP_CM | 30 | Learned ground distance may differ from SENSOR_HEIGHT_CM by at most this. |
MIN_TRIGGER_HEIGHT_CM | 70 | Set with toddlers in mind. |
MIN_FLUX | 100 | Below this (or dist = 0) a reading is “unknown”, not “gone”. |
PRESENCE_STABLE_MS | 500 | Height must hold this long to trigger. |
ABSENT_MARGIN_CM | 15 | Reading within this of ground = nobody there. |
HOLD_AFTER_LEAVE_MS | 1000 | Show continues this long after the person steps away. |
REMEASURE_DELTA_CM | 10 | Height change that counts as a different person. |
REMEASURE_STABLE_MS | 500 | New height must hold this long before restarting. |
FIRST_VIEW_LED | 0 | Raw index of lowest visible LED. |
LAST_VIEW_LED | 145 | Raw index of highest visible LED. |
CAL_LOW_LED / CAL_LOW_CM | 20 / 30.48 | Raw LED index lined up with the 1 ft mark. Placeholder index so bench testing works; set in field. |
CAL_HIGH_LED / CAL_HIGH_CM | 130 / 182.88 | Raw LED index lined up with the 6 ft mark. Placeholder index; set in field. |
SIM_AT_BOOT | false | Compile-time only. true boots straight into simulation for bench work. |
BRIGHTNESS_MAX | 128 (of 255) | Global cap. |
DAZZLE_MS | 3000 | Also the measurement window. |
RISE_SPEED | (tune) LEDs/s | Ease-out: fast start, slows near the top. |
DRAIN_SPEED | (tune) LEDs/s | Slower than the rise. |
IDLE_FADE_IN_MS | 1000 | Idle fades in after the outro. |
BT_NAME | NorthPoleLidar | |
BT_PASSWORD | ll |
CAL_HIGH_LED < CAL_LOW_LED, the strip is reversed. Open item: confirm this replaces a separate reverse flag (two settings that could disagree).FIRST_VIEW_LED / LAST_VIEW_LED and the direction.GROUND_CLAMP_CM). Trigger when height ≥ MIN_TRIGGER_HEIGHT_CM holds for PRESENCE_STABLE_MS → DAZZLE.DAZZLE_MS. Collect every valid sample; height = median. Abort to IDLE if the person leaves.REMEASURE_DELTA_CM for REMEASURE_STABLE_MS → back to DAZZLE (different person).HOLD_AFTER_LEAVE_MS → OUTRO.
Height = ground distance − measured distance. Absent = reading within ABSENT_MARGIN_CM of ground. Unknown readings (low flux, dist 0) never count as absent.
Palette: Christmas red, green, white, gold. Gamma-corrected fades. All non-blocking (no delay()), so the sensor is read every frame.
Both channels are identical: all status output goes to both, and every command is accepted from either. USB serial (115200) needs no unlock — physical access to the board is treated as trusted. Bluetooth still requires unlock ll for config, sim, demo and play commands.
| Command | Unlock needed | Action |
|---|---|---|
help | no | List commands. |
status | no | Current state, last reading, ground distance, counts. |
unlock <pw> | — | Unlock config until the client disconnects. |
get | no | List all settings. |
set <key> <value> | yes | Apply immediately and save to flash. |
defaults | yes | Restore code defaults. |
led <n> / led off | yes | Light one raw LED (for calibration). Suspends the normal show until led off. |
count | no | Season total and tonight's count. |
count reset | yes | Zero the season total. |
reboot | yes | Restart. |
sim on / sim off | yes | Ignore the TFmini; use simulated readings. Never saved to flash, so a reboot always returns to the real sensor (unless SIM_AT_BOOT is set in code). |
sim height <cm> | yes | Simulated person of that height steps in. Sent again with a different height during SHOW = sibling swap. |
sim leave | yes | Simulated person steps away (reading returns to ground). |
sim noise <cm> | yes | Add random jitter to simulated readings, to exercise the median, remeasure and hold logic. 0 = off. |
sim dropout <on/off> | yes | Random low-flux “unknown” readings mixed in. |
sim fault | yes | Simulated sensor loss → FAULT state. sim height or sim leave ends it. |
demo on / demo off | yes | Loop the full cycle automatically: random height in, step out, wait, repeat. Exercises every state and random pick hands-free. |
play <type> <name> | yes | Run one animation by name, outside the state machine, looping until play stop. Types: idle, dazzle, show, outro, offcharts. show/outro use the last simulated height (or 120cm). |
play list | no | List animation names by type. |
next <type> <name> | yes | Force the next random pick for that type (one time), so a specific animation can be tested inside the real flow. |
[SIM]) so logs can't be confused with real ones.