A microcontroller is a whole small computer on one chip: a processor, memory, and ready-made circuits for reading and driving pins. You write a program, load it once, and it runs the moment power is applied. It is the cheap, flexible brain behind keyers, rotator controllers, beacons and countless gadgets, and it is what boards such as the Arduino, the Raspberry Pi Pico and the ESP32 are built around.
What's inside
Everything on one chip: a tiny computer whose pins connect it to the real world.
The flash memory holds your program and survives power-off; RAM holds the numbers it is working with and doesn't. The peripherals do work in hardware so the processor doesn't have to. A timer can count out a 60 ms dit without the program watching a clock; an ADC (see ADCs and DACs) turns a voltage into a number; a serial port talks to a GPS, a display or a radio.
A microcontroller is not the same as a single-board computer such as a Raspberry Pi: the latter runs a full operating system and is covered in Raspberry Pi and Arduino projects. A microcontroller runs one program, starts instantly, and reacts in microseconds, which is ideal for timing-critical jobs like keying.
What hams build with them
Inputs on the left, outputs on the right. Anything needing real current goes through a transistor, optocoupler or driver, not straight from a pin.
Rotator controllers read the position with the ADC and switch the motor relays to reach a chosen bearing; see Rotators and controllers.
Beacons and WSPR transmitters, where a programmable clock-generator chip sets the frequency and the microcontroller steps it, with a precise timer for the schedule.
Antenna switches, band decoders, SWR and power meters, CAT interfaces and repeater controllers, all small jobs of "read this, decide, drive that".
Any station you build is still a station: an unattended beacon needs identification and control as the rules require; see Control operators and control points.
Connecting to the real world
Drive loads through a part that can take it. A pin supplies only a few mA. Use a transistor or driver for relays and LEDs, with a diode across a relay coil to absorb its voltage spike.
Isolate the radio. Key a transmitter with a transistor or optocoupler across its key jack, after checking the line's voltage and polarity.
Keep RF out. A nearby transmitter can upset a microcontroller: use a metal box, short wires, bypass capacitors on the supply and ferrites on the leads.