Skip to content
View in the app

A better way to browse. Learn more.

Ham Radio Base

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Ham Radio Base — Education, Resources, Projects and Community
☀ Solar
SFI 90
SN 22
A 3
K 1 Quiet
X-Ray B1.4
Wind 332.7 km/s
Aurora 2
Updated 06:00 UTC HamQSL · N0NBH
Day 80/40m Fair 30/20m Good 17/15m Fair 12/10m Poor
Night 80/40m Good 30/20m Good 17/15m Fair 12/10m Poor

Callsign Lookup
_
Vanity Call Signs Available
Enter filters above and click Search.
ⓘ Callsign lookups are in real time via the FCC database. Vanity callsign availability is refreshed daily at 6:00 AM CST. The vanity search may be unavailable for a few minutes during this update.
Live DX spots
Live DX Spots — 70cm via PSKReporter · scroll or pinch to zoom
Band
Mode
Time
Loading map data…
MHz DX Spotter Info
Recent spots —
Select a band above to load spots
Ready — select a band to fetch live spots

Designing a Pico or ESP32 shack controller that survives RF: CAT levels, grounding, and fail-safe relay handling

ci_cover.jpg

Many shack automation projects start the same way. A Pico or ESP32 reads band data from the rig over CAT, drives an antenna switch or band-pass filter bank, and maybe adds a small LCD with SWR and temperature readings. On the bench it works fine. Once it is connected to a transmitter and an antenna system, it can reset, lock up, or throw garbage onto the display.

This thread is for the design side of that problem, before anyone starts adding ferrites at random. A few questions to get the discussion going:

1. What is the best way to interface 3.3 V microcontrollers to the different CAT schemes? Icom CI-V is a single-wire open-collector bus. Some Yaesu and Kenwood rigs offer TTL-level serial on a jack, others use true RS-232 levels, and newer radios often present USB. The ESP32 and RP2040 should be treated as 3.3 V-only, so what level-shifting or isolation approach is worth the extra parts?

2. When the controller sits near HF coax and a 100 W signal, where does the RF usually get in? Candidates are the USB cable, the relay control wiring, the power lead, or the sensor and display wiring.

3. For an antenna switch or filter bank, what should the firmware do after a reset or brownout? For example, should the relays default to a safe antenna, drop everything, or hold the last state?

Details on rigs, wiring practices, and failure symptoms are welcome, particularly when they point to a specific cause.

  • Replies 2
  • Views 10
  • Created
  • Last Reply

Top Posters In This Topic

Featured Replies

  • Administrators

I'd treat the lockups as a common-mode problem until proven otherwise. A microcontroller board is a small circuit with long wires attached, and every wire (USB, CAT, relay leads, sensor cables, power) can act as part of an antenna. RF picked up on those wires gets rectified in ICs, and that shows up as resets, corrupted I2C traffic, or garbled serial data.

A sensible order of attack:

First, find out which cable matters. Disconnect everything except power and see if the fault goes away on one band. Then add the cables back one at a time. It is slow, but much better than guessing. Lower HF bands often behave differently from 20 m or 10 m, so note which band causes the trouble, as that hints at which cable length is resonant.

Second, put common-mode chokes where cables enter the enclosure. For HF, a ferrite mix suited to that range (type 31 is a common choice for broad HF suppression) with several turns through the core is more effective than a single pass. Do this on both the USB cable and the power lead. For serial lines, a choke at the enclosure plus a small RC filter at the MCU pin can help, but keep the RC values low enough not to damage the edges at your baud rate.

Third, decoupling and layout. Put a 100 nF ceramic right at each IC power pin and add bulk capacitance near the regulator. Keep I2C runs very short. If the LCD or sensors must be remote, consider slowing the I2C clock and using shielded cable with the shield bonded to the enclosure at one end, or both ends if the enclosure is metal and the cable is short.

Finally, a metal enclosure bonded to the station ground point makes a big difference compared with a plastic box. Also make sure the station's RF common-mode currents are not travelling through your controller. If the coax shield and the antenna system are putting current on the shack wiring, fixing the antenna feedline choke is better than trying to harden every gadget.

  • Moderators

On the CAT side, the details really do matter, and it's worth reading the CAT section of the manual for your specific model, because voltage levels and baud rates vary a lot.

For Icom CI-V, the bus is open-collector with a pull-up, so a simple transistor or a small level shifter on the TX line works, and the RX and TX are commonly tied onto the same wire with a diode or transistor arrangement. Remember that each radio has its own CI-V address, and baud rate may be fixed or auto depending on the model, so check it in the menu. For TTL serial from some Yaesu or Kenwood rigs, a bidirectional level shifter or just a resistor divider on the rig-to-MCU line is usually enough, and the MCU-to-rig line may need a series resistor or buffer depending on the radio's input threshold. If the radio gives you real RS-232 levels, use a MAX3232-type converter and don't connect the radio directly to a GPIO, because RS-232 swings can be well beyond what the MCU pin tolerates.

If the rig has a USB port, using a Pi as the CAT host is often simpler than building your own interface. The Pi talks to the radio, and a Pico or ESP32 handles only relays and sensors. That also lets you put an optocoupler or isolator between the Pi and the hardware that touches antenna switching.

On the fail-safe question, I'd design the hardware first and make the firmware second. Use relay drivers with flyback diodes, pull-down resistors on the driver inputs so relays stay in a known state while the MCU boots, and enable the hardware watchdog. Choose the default state deliberately: for example, grounding unused antenna ports is a common safety practice, while an amplifier PTT line should default to receive. Also don't change a band-pass filter or antenna relay while the transmitter is keyed. Use the rig's PTT or a sense line to inhibit switching, since hot-switching can damage relays and, worse, the radio or amplifier.

If Direwolf is part of the same system, give the audio path its own attention. A USB sound adapter with isolation transformers or a proper isolated interface on the rig's data port avoids ground loops that otherwise show up as hum or decode failures. PTT from a GPIO should go through a transistor or optocoupler rather than driving the radio's PTT line directly.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Affiliate Disclosure: As an Amazon Associate, Ham Radio Base earns from qualifying purchases. Some links throughout this website may be affiliate links. If you purchase a product through one of these links, we may earn a commission at no additional cost to you. Your support helps us continue creating free articles, tutorials, reviews, and resources for the amateur radio community. N0TLB © Ham Radio Base - Powered by the Ham CQ DX Community. All rights reserved.

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.