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 0 Quiet
X-Ray B1.3
Wind 336.5 km/s
Aurora 2
Updated 07:00 UTC HamQSL · N0NBH
Day 80/40m Good 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

Arduino or Raspberry Pi for shack automation? Deciding where the logic should live

ci_cover.jpg

I'd like to compare notes on a design question that comes up in nearly every shack automation project: should the control logic run on an Arduino-class microcontroller, on a Raspberry Pi, or on both?

The two boards are good at different things. A microcontroller such as an Uno, Nano or similar AVR or ARM board starts instantly, has predictable timing, and gives you direct access to analog inputs, interrupts and hardware timers. That suits antenna switch control, band-decoder outputs, rotator pulse counting, tone generation, and reading forward and reflected voltages from an SWR bridge. A Raspberry Pi runs a full Linux system. It is better for logging, web interfaces, networking, Hamlib's rigctld, sound-card digital modes, Direwolf, and anything else that depends on existing software.

Several practical points tend to decide the design:

Logic levels. Raspberry Pi GPIO is 3.3 V and is not 5 V tolerant. Many Arduino boards use 5 V logic. Connecting a 5 V output straight to a Pi pin is a common way to damage it. Use a level shifter or a resistor divider for slow signals, or choose a 3.3 V microcontroller board.

Analog measurement. The Pi has no built-in ADC. For a power or SWR meter you will need an external converter such as an I2C ADC, or you can let a microcontroller do the measuring and send the results over serial.

Driving loads. Neither board should drive a relay coil directly from a pin. Use a transistor or MOSFET driver with a flyback diode across the coil, or a relay module that already includes one. Keep the relay supply separate from the logic supply where practical.

PTT. Keying a transmitter is the one output where a software fault matters. A stuck PTT line can mean a transmitter on the air with nobody listening, or a hot-switched amplifier. Opto-isolated or transistor-isolated keying and a hardware timeout are worth the extra parts.

The pattern I find most sensible is a split: a microcontroller handles anything hardware-facing and time-critical, and a Pi handles the user interface, logging and network integration. The two talk over USB serial, or MQTT if you have several nodes. That keeps a crashed desktop session or a corrupted SD card from taking the antenna switch or PTT line down with it.

Where do you draw the line? Do you let the Pi drive GPIO directly for things like PTT, or do you always put a microcontroller or other hardware in between?

  • Replies 2
  • Views 60
  • Created
  • Last Reply

Top Posters In This Topic

Featured Replies

A split design is usually the safer way to go, and the interface between the two halves is worth keeping simple. A plain line-based serial protocol is often enough, for example BAND 20, ANT 3 or PTT 0, with the microcontroller replying with a status line. It is easy to test from a terminal, easy to log, and you can swap the Pi for a laptop later without touching the firmware.

The microcontroller should also own the safety behavior. If it stops receiving a keepalive message from the Pi for a set time, it should drop PTT and optionally return the antenna switch to a known state. A heartbeat plus the AVR watchdog timer, or the equivalent on other chips, covers both a hung host and a hung sketch. Treat the Pi as a request source, not as the thing that guarantees the transmitter unkeys.

For rig control, Hamlib's rigctld is useful here. Logging software, WSJT-X and other programs can share one CAT connection over the network instead of fighting over a serial port. If the rig's CAT port is TTL or RS-232 level, check the actual voltage levels before connecting it to a Pi or Arduino. The Pi's serial pins want 3.3 V, and true RS-232 swings well beyond that.

The RF environment deserves its own planning, because many projects that work well on the bench misbehave once a transmitter is running. Cables to the board act as antennas, and common-mode current on USB, sensor and control leads can cause resets, garbled serial data or phantom inputs. A few habits help:

Put the electronics in a metal enclosure where you can, and bring each lead through with a bypass capacitor or ferrite. Use a clamp-on ferrite or a few turns of the cable through a suitable core on the USB lead. For long sensor or switch lines, add a series resistor and a small capacitor at the input. Debounce in software too, since a noisy input and a mechanical switch look alike to the code.

Also look at your power supplies. Cheap switching converters, including the small buck modules used to make 5 V from 12 V, can radiate hash across HF that shows up as birdies or a raised noise floor on the receiver. Try the shack with the converter powered but the radio on a dummy load or a quiet band, and compare. A linear regulator, a better-filtered module, or a ferrite and LC filter on the input and output often helps.

One more detail on PTT: GPIO pins on a Pi are not guaranteed to sit in a safe state while it boots, and an Arduino pin floats briefly as an input at reset. A pull-down resistor on the transistor or optocoupler input makes sure the transmitter stays unkeyed until your code deliberately sets the pin. Test it by power-cycling the controller with the transmitter connected to a dummy load.

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.