Files
2026-10-14 08:32:17 +09:00

59 lines
3.3 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
type: plan
status: active
updated: 2026-10-14
---
# Car Power: Ride Through Cranking, Shut Down at Ignition Off
## Power chain
```
cigarette socket (ignition-switched, 65 W class, crank-sensitive)
→ USB-C PD charger → 15 V PD trigger (15 V / 3 A) → DC jack
→ Waveshare UPS Power Module (C), 3S 21700, 15–19 V in, pass-through
→ Orin Nano carrier
```
Socket power is ignition-switched, so **UPS input loss = ignition off or cranking**. The UPS rides through cranking
(bench: ≥ 20 s holdover across a supply swap). See [BOM](../../BOM.md#waveshare-ups-power-module-c).
## Detection
INA219 on I²C bus 7, `0x41`, monitor-only (the UPS has no control lines). Battery current from the shunt-voltage register (0x01, 10 µV/LSB):
about 0 or positive (charging) with input present, **clearly negative** (discharging) when input is lost. Battery voltage (0x02) is the backstop.
To confirm on the bench: the sign convention and the discharge magnitude at the Orin's real load (pull the UPS input and read).
## Policy (to build)
A small host service polling the INA219 about every 1 s:
| State | Condition | Action |
|---|---|---|
| on input | current ≥ about 0 | nothing |
| on battery | discharging, < grace | publish `system/power` "on battery"; **a short episode that recovers is a crank**: stamp it into the recording |
| ignition off | discharging continuously for grace (start at 60 s; tune after the car crank test) | publish "shutting down" → stop capture (close the session cleanly) → optional parked-at-home step → `systemctl poweroff` |
| battery low | **built 2026-10-14** (svc-core `orin-status --poweroff-below 11.0 --poweroff-after 30`): below 11.0 V *while discharging*, 30 readings (1/s) in a row; a missing reading restarts the count | state `stopping` on `yukart/system/orin-status`, then `systemctl poweroff` through svc-gw's polkit grant (no sudo) |
Optional parked-at-home step: if home WiFi/LAN is reachable at ignition off, stay up long enough to copy recordings off over the LAN
(same LAN-only rule as map sync, project-yukart decision 10), within a hard time cap, then shut down.
The battery-low row came first: on 2026-10-14 the pack ran flat overnight with the Orin up and nothing to stop it,
and the boot's journal ends mid-stream at 06:29:22 (ext4 replayed its journal on the next boot; nothing lost).
11.0 V while discharging at the Orin's ~0.45 A is about 10 % charge, a margin for a clean shutdown; 30 s rides out a
crank or a load spike. The ignition-off rows are still to build.
## Open: getting the Orin back on at ignition on
After `poweroff` the UPS keeps supplying the board from its battery:
1. **Standby drain:** the halted Orin still draws some power, so the pack drains while parked, until the UPS's over-discharge protection cuts out.
2. **No auto-start:** the dev kit powers on when power *appears*. If the UPS output never dropped, ignition on doesn't boot the Orin.
Candidate fixes (hardware, to evaluate):
- Cut the UPS output after shutdown (a latching relay or a timer on the output), so the next ignition-on is a real power-up.
- Pulse the carrier's power-button header from a small circuit when socket power returns.
- Suspend (SC7) instead of poweroff, with wake on a GPIO tied to socket power. Untested on this board, and still drains.
Until this is solved, ignition-off shutdown leaves the car unit off until someone power-cycles it.