20261022-0420-key-box-rs485-analog-inputs Key Box 36: RS-485, eight configurable analog inputs and board monitoring
- status: completed
- createdAt: 2026-10-22 04:20
- approvedAt: 2026-10-22 04:20
- relatedTask: 20261022-0420-key-box-rs485-analog-inputs
Context
章节标题:“Context”- After the NMEA 2000 socket (task 20261022-0322) J2 29-32 / 34-35 and J3 / J4 30-35 are spare; GPIO 21 of 22 used, IO8 free (strap, pulled up); UART0 only goes to test pads.
- TIC12400 IN11-IN23 are current-source only, so they cannot read the keys, but every input has a 10-bit 0-6 V ADC mode. Input leakage at the 0 mA setting is specified at +-110 uA max.
Proposal
章节标题:“Proposal”- New schematic sheet
aio.kicad_sch:- THVD1406DR on +3V3, D = TXD0, R -> 1k -> RXD0 (a J6 adapter can override), RE / SHDN high; 10 R pulse-proof + CDSOT23-SM712 per SLLSF87A; 120 R from TERM to B; shield 1M || 4.7 nF.
- Per channel: 1k 0.1 % 2512 pull-up to +5V, 0.1 A PTC, 100 R 0.1 % shunt to a DMN6140L (gate from 74HC595, 100k pull-down), 100 R + 15 nF to the TIC input. 74HC595: SER MOSI, SRCLK SCLK, RCLK IO8, /OE = NOT DO_EN (2N7002 + 10k).
- 10 mR 2512 between Q2 (new net VFET) and VPROT, INA186A3 (100 V/V) -> U9 IN11; NTC 10k + 4.7k on IN12 / IN13; 3.3 V on IN14. U11 / U12 IN15 read +5V.
- PCB anchors for U13 / D12 (under J2), U14, R592 / U15 (next to Q2), TH1 / TH2; the rest is auto-placed; reroute, DRC.
- Docs: P05-key §2.1, new KEY-29 (RS-485) / KEY-30 (analog inputs and monitoring), KEY-28; design §2.3 pin table, circuit and GPIO; guide traceability and V-11; README.
Risks
章节标题:“Risks”- TIC12400 0 mA leakage (+-110 uA max) gives up to about 0.13 V offset through 1.1 k; needs bench data and per-channel production calibration.
- A 32 V short on an AIN in mA mode puts about 0.3 A through the shunt until firmware cuts the FET (ADC threshold interrupt) or the PTC trips.
- RS-485 A / B are rated +-16 V; a short to the supply is not protected.
Scope
章节标题:“Scope”switch: tools/gen_key_box.py, tools/gen_key_symbols.py, tools/gen_key_pcb.py,
regenerated key-box/ outputs and README.
docs: 3 files under bizplan/product/switch/key/, changelog, task / plan.
Alternatives
章节标题:“Alternatives”- External SPI ADC (e.g. ADS7953 / MCP3208): more accuracy, about 15-25 CNY; not chosen.
- Isolated RS-485 (ISO1410 + isolated DC-DC): not chosen by the owner.
- 24 V loop boost: first declined, then added (see annotations).
Annotations
章节标题:“Annotations”- 2026-10-22: owner approved RS-485 non-isolated, 8 configurable channels, no boost; board monitoring (2 NTC, box current, rails) from the same round is included.
- 2026-10-22: owner asked for the boost cost and 12 / 24 V adaptation, then approved the recommended non-synchronous boost (LM51551, 24 V, pass-through above 24 V, transmitters rated >= 36 V) and a second 74HC595 (QA = BOOST_OFF).
- 2026-10-22: owner: "可以用3路aux di + 2路d0" — two high-side outputs (TPS2H160-Q1 version B, 1 A each, 1.54 A limit) on J2 35 (HSO1) and J4 29 (HSO2, replaces AUX4); control from U16 QB-QF, current sense / fault on U10 IN11 / IN12.
- 2026-10-22: owner: "用5A做比较好" — box total 5 A: F1 6.3 A T, Q1 IPB200N25N3 (D2PAK), INA186A2, upstream fuse <= 7.5 A, 1.5 mm2 V+ / GND. The earlier boards routed VPROT / VBATT / VCS at 0.2 mm (net classes never reached the DSN); the DSN now carries 0.4 / 1 / 2 mm classes and In2 is a VPROT plane (+5V routed). High-side outputs stay at 1 A each.
- 2026-10-22: owner agreed to standardise on momentary buttons with lamp state from CAN read-back; new KEY-31 (short-press toggle, long-press toggle with 3 s default, hold-to-run, interlocked pairs); latching buttons kept as a compatibility option. No hardware change.
- 2026-10-22: owner: latching buttons stay a first-class option. A latching key only sends on a position change and sets the load to the new position (no action when the load is already there, none at power-up); this replaces the absolute and toggle modes.
- 2026-10-22: owner: "确定换" — Key Box MCU ESP32-C6-WROOM-1-N8 (8 MB flash, 23 GPIO); Key 4 / 8 panels stay on MINI-1-N4. DO_EN moves from IO14 (not on the WROOM-1) to IO10, IO11 spare. Module on the bottom left edge, antenna flush with the edge, 6.5 x 26 mm keepout on all layers. Footprint from the Espressif KiCad library land pattern, STEP model from the same library.
- 2026-10-22: owner asked where the box reset / factory-reset button goes. Chosen: no lid button or opening (sealing, accidental presses, SEC-04 physical action); SW1 RESET, SW2 SERVICE and the status LED move to the PCB top side, reachable with the lid off. SERVICE short press opens the BLE service window, hold >= 10 s is factory reset (outputs off, configuration and pairing cleared, keys and firmware kept). An external button combination for the service window is left to KEY-O-09.