Splitting a shack automation build between a Pi and microcontrollers: where does each job belong?
- Replies 2
- Views 29
- Created
- Last Reply
A better way to browse. Learn more.
A full-screen app on your home screen with push notifications, badges and more.
A common pattern in ham shack automation is one Raspberry Pi doing everything: Direwolf, rigctld, a web dashboard, rotator control, and antenna switching over GPIO. It works on the bench, but it can get fragile once real RF is in the room. Here is a way to divide the work, and I'd like to hear where others draw the line.
Jobs that suit a Pi (Linux, audio, networking): Direwolf as a software TNC (sound card or USB audio in and out, PTT via GPIO, a CM108-style GPIO, or a serial RTS line), Hamlib's rigctld (TCP, port 4532 by default) so logging and digital-mode software can share one CAT connection, and logging, MQTT, or a web UI. Direwolf will also feed an APRS-IS iGate or a KISS TCP port for other software. The weak points are SD card corruption on hard power loss and a lot of broadband hash from cheap USB supplies, so a decent supply and a read-only or well-backed-up filesystem are worth the effort.
Jobs that suit a Pico or ESP32 (timing-critical, always-on, simple I/O): an iambic CW keyer, antenna switch relay drivers, a rotator controller (reading a potentiometer and driving relays or a motor driver), an SWR/power meter front end, and Si5351 clock generation. Boot time is instant and a hung Linux system doesn't take the keyer down with it. The Pico RP2040 is 3.3 V and its GPIOs are not 5 V tolerant; the ESP32 is also 3.3 V. A lot of older rigs, keyers, and rotator interfaces speak 5 V TTL or true RS-232 levels, so check each line. RS-232 needs a MAX3232-type converter, not a direct connection. Icom CI-V is a single-wire, open-collector style bus that needs a proper transistor or buffer interface.
A few details that tend to cause trouble:
1. The ESP32's ADC2 channels can't be used while Wi-Fi is active, so put analog sensors (SWR detector, rotator pot) on ADC1 pins. The ESP32 ADC is also nonlinear, so calibrate or use an external ADC such as an ADS1115.
2. The Si5351 outputs square waves, so you need a low-pass filter for the band you're using before it goes near a receiver or a transmitter stage. Check the board's I2C level and supply voltage as well. Some breakout boards include level shifting and others expect 3.3 V logic. Frequency accuracy depends on the reference crystal, so calibrate against a known source and store the correction.
3. Keep relay coils off the logic supply where you can. Use a ULN2003 or MOSFET driver with flyback diodes, and consider latching relays for an antenna switch so the selected port survives a reset. Add an interlock so the switch won't change while PTT is active.
4. Control lines that run out to the antenna switch, rotator, or tower act as antennas for RF. Bypass capacitors at the connector, series resistors, ferrites, and shielded cable all help. If a microcontroller resets or a display garbles only when you transmit on a particular band, suspect RF on the I/O or supply wiring before blaming the firmware.
5. Don't wire a GPIO straight to a rig's key jack. Use an optocoupler or small transistor stage. Some older rigs have significant open-circuit key-line voltage, and an isolated stage protects both sides.
How do you decide what goes on the Pi and what stays on a dedicated microcontroller? And is anyone running everything through a single MQTT or serial bus, or keeping each device standalone?
Link to comment
https://www.hamradiobase.com/forums/topic/11301-splitting-a-shack-automation-build-between-a-pi-and-microcontrollers-where-does-each-job-belong/Share on other sites