Two PCs, a router and a battery in a carry case, run by custom boards over CAN
  • C 51.6%
  • C++ 35.6%
  • Kotlin 7.6%
  • HTML 3.3%
  • Python 0.8%
  • Other 1.1%
Find a file
vratk0529-arch-desktop 6ac71f5086 Control board: USB status dump, 24 V input limits on the rack
The status dump and the boot log replay waited for more than 128 bytes
free in the USB transmit queue, which holds 127 at most on full speed,
so since September nothing but the live log lines reached USB. They now
start once the queue is empty, when the host has read everything.

control-rack gives vin_volt 24 V limits (errors below 16 V and above
30 V, warnings below 18 V and above 28 V) in place of the briefcase's
12 V ones, which held the rack's input in a latched over-voltage error.

rack-autostart.lua, the rack's autostart: has the PDU mask its vin_volt
low alerts, since a long cable sags it below 20 V under PC load, and
masks them again whenever the PDU reports one after a restart.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 22:53:30 +01:00
.vscode Lay the monorepo out and share one build config 2026-11-02 18:45:41 +01:00
docs Control board: the rack's firmware under the loader 2026-11-22 22:17:41 +01:00
firmware Control board: USB status dump, 24 V input limits on the rack 2026-11-22 22:53:30 +01:00
hardware Low power mode: rename transport mode, and turn off the LED strip and fans 2026-11-03 09:37:51 +01:00
lib Rack PDU: board 9, its bus map, and the shared lib on the STM32F103 2026-11-14 15:19:35 +01:00
phone-app Rack PDU: board 9, its bus map, and the shared lib on the STM32F103 2026-11-14 15:19:35 +01:00
scripts Firmware updates from the web UI: control board OTA slots and the CAN flasher 2026-11-03 10:16:31 +01:00
.gitignore Add the MIT license and third-party notices 2026-11-11 11:50:24 +01:00
LICENSE Add the MIT license and third-party notices 2026-11-11 11:50:24 +01:00
README.md Add the MIT license and third-party notices 2026-11-11 11:50:24 +01:00
THIRD_PARTY_NOTICES.md Control board: use the Ethernet fork instead of patching upstream 2026-11-11 11:57:41 +01:00

Briefcase PC

Two desktop PCs, a router, a Radxa SBC and a 24 V battery in a carry case, run by a set of custom boards talking over CAN. It works plugged in or on battery, reports everything to a web UI, MQTT and an Android app, and powers itself down for transport or overnight.

The briefcase open, one PC in the lid and one in the base

Lid Base
Lid half: motherboard, Wraith cooler, Radeon GPU Base half: second PC, router, SLA batteries, ATX supply

State of the build:

  • The Radxa SBC is not fitted yet. Its output (J7) is there and idle.
  • The bottom PC's front panel is not connected to the body board yet, so that PC can be seen through its PicoPSU but not asked to shut down. On the bus that is PC 1; pc2_pwr is live.
  • The PicoPSU's 12 V switch IC is due for replacement. MB_SLOW_12V_RAMP exists only until then, for a motherboard that faults on the current one (about 1 us rise, 100 A peak).
  • Protocol v3 is on the control, body and battery boards and on PicoPSU 2. The switchboard and PicoPSU 1 follow when the briefcase is stripped, cleaned and conformal coated.
  • The bootloaders are built but not yet on any board. With them, every board updates from the web UI.

How it fits together

flowchart TB
    mains[Mains] --> atx[ATX supply]
    atx -- 12 V main --> sw
    atx -- 12 V --> bms
    atx -- 5VSB --> body
    pack[2 × 12 V 9 Ah SLA] <--> bms[Battery board]
    bms -- 24 V to external 12 V converters --> sw[Switchboard]
    bms -- 12 V --> ctl
    sw -- OUT1 --> p1[PicoPSU 1] --> pc1[PC 1]
    sw -- OUT2 --> p2[PicoPSU 2] --> pc2[PC 2]
    body[Body board] -- J7 --> sbc[Radxa]
    body -- J8 --> router[RB2011 router]
    body -- 4 × RS-232 --> consoles[Consoles]
    body -- BLE bridge --> phone[Android app]
    ctl[Control board] -- Ethernet --> router
    ctl == CAN + 5 V ==> sw & bms & p1 & p2 & body

The ATX supply feeds the switchboard directly. The other 12 V feeds shown between boards are inferred from the board connectors, since the case wiring is not in the KiCad projects.

Board CAN id MCU Does
Control 5, control STM32F405 Web UI, MQTT, Lua, alarms, the briefcase policy. Feeds 5 V to the bus
Body 7, body STM32F412VE Fans, thermistors, ATX supply, PC front panels, Radxa and router outputs, lid, LED strip, buzzer, RS-232, BLE
Battery 4, bms STM32F412RE Pack monitoring, charger, 12 V regulator, 24 V output, state of charge
Switchboard 1, switchboard STM32F412RE Mains to backup changeover for both PCs
PicoPSU ×2 2, 3, picopsu1/2 STM32F412RE 12 V to ATX for each motherboard
BLE bridge ESP32-C3 BLE to I2C, on the body board
Two control boards Control board (two made: the other is for a rack at home, which is why this one looks different) Body board Body board
Battery board Battery board Switchboard Switchboard
PicoPSU PicoPSU Switchboard on the ATX supply Switchboard wired to the ATX supply, as it is connected in the case

More in docs/photos.

Who decides what

Protection is local. Policy is on the control board. A board protects itself with the bus down, and the control board makes the decisions that need the whole picture.

Stays on each board Control board
Battery over-voltage and charger cut-off, 24 V cut on a bad cell Going back to absorption after a discharge
ATX sequencing and PWR_OK timing PicoPSU standby: restored if one resets under a running PC
Changeover comparators Remembering the charge across power loss
Fan curve and the overheat buzzer Low power and wake sequences
Alarm table, history, MQTT, Lua

If the control board goes quiet, the others hold their state and raise controller_lost. On battery, though, its buck is the only 5 V on the bus, so losing that takes every board down, protection included. On mains the body board back-feeds ATX 5VSB onto the same pin.

The policy is in firmware/control/src/policy.cpp.

Repo layout

Path What
firmware/ one PlatformIO project per board, common.ini shared by all
lib/briefcase-can/ the bus, measurements, alerts, faults, the board skeleton
lib/BCP_BLEBridge/ STM32 side of the BLE bridge
phone-app/ the Android app, the briefcase's GUI
hardware/ board facts, bodges and quirks, body board reference
docs/ everything below
scripts/build-all.sh build every firmware
scripts/identify-board.sh which board the probe is on, read-only

History from the separate repos this replaced was kept: git log --follow works across the move.

Build

scripts/build-all.sh                 # every firmware
cd firmware/battery && pio test -e native   # host tests

See docs/flashing.md before flashing anything, including which board gets what and when, and the rebuild checklist. The phone app is covered in phone-app/README.md.

Using it

Web UI http://control.lan (172.16.0.50). Everything the app can do: PCs, outputs, fans, LED strip, low power mode, RS-232 consoles. Plus alarms, each board's firmware commit, Lua editor, config
Phone Pair by opening and closing the lid three times within 6 s
MQTT <hostname>/TX/..., <hostname>/RX/..., optional Home Assistant discovery
Lua firmware/control/docs/lua-api.md

Docs

can-protocol.md frames, commands, compatibility between versions
alerts.md warnings, errors and named faults
battery.md how the percentage works, and what it assumes
flashing.md flashing, and the rebuild checklist
bootloader.md the CAN bootloader plan
phone-protocol.md what the app speaks
hardware/ MCUs, bodges not in the schematics, quirks

License

MIT, see LICENSE. Vendored third-party code (Lua, an ST linker script, the Gradle wrapper) keeps its own license; see THIRD_PARTY_NOTICES.md.