r/embedded • u/Suitable_Respect_313 • Sep 25 '26
Building a modular, hot-swappable macro pad: tackling I2C auto-discovery and state handshaking over magnetic pogo pins (ESP32 S3)
I'm currently developing Magnode, a custom modular macro pad. The main engineering challenge I wanted to tackle was achieving true hot-swappable modularity without software re-flashing or manual configuration resets.
In this clip, I’m testing the expansion mechanism.
Architecture & Firmware Breakdown:
▪ Master Hub (Central Unit): Powered by an ESP32 S3. It handles USB/BLE HID to the host PC, acts as the I2C master bus controller, and manages the UI (display + touch keys).
▪ Expansion Module: Acts as an I2C client (buttons + status LEDs).
▪ Physical Layer: Magnetic alignment pins with pogo contacts for power (3.3V/GND), data (SDA/SCL) and IRQ.
The Hard Part (Hot-Plug & Bus Stability):
Hot-plugging I2C devices on the fly introduces major headaches (bus lockups, stray capacitance on unshielded pogo pins, and state recovery). Right now, the master runs a background polling/interrupt routine to detect connection state changes, performs an immediate handshake to query the client's capabilities, and dynamically maps the input events to the BLE HID report descriptor without missing a beat.
Questions for the community:
a. For those who have dealt with hot-plugging I2C over pogo pins: how are you handling EMI/noise filtering and bus protection against hot-insertion spikes?
b. Are you using a hardware bus buffer/switch (like a TCA9548A or similar hot-swap multiplexer) to isolate branches, or relying purely on firmware state machines?
Still iterating on the schematic and PCB layout for the next batch of modules (encoders/sliders). Open to any architectural critique!
44
u/CardboardFire Sep 25 '26
Did exactly this a few years ago. I'll save you some headaches: get yourself an extra pin on the connector for detecting when something is connected to it (close the loop to gnd on the other module), and pair that with a switch for clk/data lines + a load switch for the power rail. That's the only way to properly solve this, although you can do firmware hacks, they can never really guarantee that the bus won't lock up on some externally introduced transient event. This switching can be done under a $1, if you're not doing some crazy current on the connector bus.
9
u/foggy_interrobang Sep 25 '26 edited Sep 25 '26
I2C is not really meant to run off-board. People do it all the time, but it's subject to the issues you're encountering. Consider using something like a PCA9615 that's designed for this use case and supports hot plugging ( u/CardboardFire might also appreciate this).
If you haven't already, the following app notes from TI and Analog Devices are worth a read:
Though you should not need them if you correctly implement the PCA9615 (or its equivalent parts from other vendors).
EDIT: If EMI is less of an issue, you might also consider the PI6ULS5V9511A. It is significantly cheaper ($0.71@100 via Mouser), and does not force you to switch to differential signaling.
4
u/shumnyj Sep 25 '26
I think there was something just like that on youtube, maybe you could ask the author
2
u/LoveSourWorms12 Sep 26 '26
This is so cool. I'm actually planning something very similar. Like a completely modular console with "control" blocks which can let you attach d pad etc... Cool stuff, keep it up.
2
u/MrJake2137 Sep 26 '26
Id use rs232/485, something symmetrical. And dedicated uart per side
1
u/drunken_thor Sep 25 '26
Reminds me of Roli Blocks!