Keeping RF out of shack automation: ESP32/Pico nodes, CAT, antenna switches and SWR sensing
- Replies 2
- Views 37
- Created
- Last Reply
Top Posters In This Topic
-
Admin_Terry 1 post
-
Mod_Nancy 1 post
A better way to browse. Learn more.
A full-screen app on your home screen with push notifications, badges and more.
I'd like to compare notes on a design problem that comes up in a lot of ham microcontroller projects: you build a nice automation node on an ESP32 or Pi Pico, it works on the bench, and then it misbehaves once the rig is on the air. The node might handle an antenna switch, a SWR/power readout, band data from the radio, and maybe a rotator interface. Here is how I'd divide the problem, and I'd like to hear where others draw the lines.
First, the logic levels. Both the ESP32 and the RP2040 on the Pico are 3.3 V devices, and their GPIOs are not 5 V tolerant. Many rigs and accessories use 5 V TTL serial or open-collector buses, and older radios may use true RS-232 levels, which can damage a bare GPIO. For Icom CI-V, which is a single-wire bus, check the radio's actual voltage and use a proper open-collector interface instead of tying the pin straight to a GPIO. For RS-232 you need a MAX3232-style transceiver. For modern rigs with USB, it is often simplest to let a Raspberry Pi or PC talk to the radio over USB and expose it to the rest of the shack with Hamlib's rigctld, which listens on TCP port 4532 by default. The microcontroller then does the hardware work and the Pi does the protocol work.
Second, relays and antenna switches. Put a flyback diode across every relay coil, use a transistor or driver array instead of pulling coil current from a GPIO, and consider optocouplers or at least a separate supply if the switch is far away. Run the control lines as a multi-conductor cable with a ferrite choke at each end, and add a small RC or bypass capacitor (for example 100 nF with a 10 nF in parallel) near the connector. If the switch sits at the antenna, remember that coax feedline common-mode current can end up on your control cable, so a choke on the coax and the control cable is worth considering.
Third, SWR and power sensing. A directional coupler feeding a log detector such as an AD8307, or a diode detector with calibration, gives you forward and reflected voltages that an ADC can read. The weak points are usually not the maths but the layout: RF pickup on the ADC input, noisy reference voltage, and cheap ADC linearity. Filter the analog lines, average several samples, and only calculate SWR when forward power is above a minimum threshold. Otherwise noise produces meaningless numbers at idle. Calibrate against a known dummy load and a few known mismatches rather than trusting the datasheet curve.
Fourth, signal generation and decoding. If you use an Si5351 as a VFO or beacon source, its outputs are square waves rich in harmonics, so plan on a low-pass filter for the band you operate on before it goes anywhere near an antenna. For packet or APRS work with Direwolf on a Pi, the usual chain is soundcard audio in and out, plus a PTT method, either a GPIO line or a CM108-style USB audio adapter with a GPIO pin. Isolate audio with a 1:1 transformer where you can, because ground loops between the Pi supply, the radio and the PC show up as hum or decode errors.
The question I'd like input on: when you split a build between a microcontroller and a Pi, where do you put the boundary? I lean toward microcontrollers for anything timing-critical or safety-related (relay sequencing, PTT timeouts, rotator limit handling) and the Pi for logging, Hamlib, and network access. Does that match what you do, and what has worked best for keeping RF out of the digital side?
Link to comment
https://www.hamradiobase.com/forums/topic/10891-keeping-rf-out-of-shack-automation-esp32pico-nodes-cat-antenna-switches-and-swr-sensing/Share on other sites