Amateur radio and embedded systems

Universal antenna rotator controller

This is one of my older projects. I designed it for a friend of mine when he became fed up with his Rot1prog controller going bonkers all the time. I wanted it to be something as simple as possible, but still doing its job, easy to use and easy to service.


A rotator controller basically does a few simple tasks:

  1. Switch an electric motor on and off, left and right
  2. Count pulses coming from rotator's feedback sensors (and store them when device is turned off)
  3. Translate those pulses to azimuth in degrees
  4. Check if the rotor is not turning too far, otherwise feeders can be torn up
  5. Display the azimuth and status to the operator
  6. Communicate with a PC application like HamRadioDeluxe for automated control
  7. Handle some other tasks like automatic rotation to a desired azimuth


I designed the controller around most common parts:

  • ATmega8 microcontroller to run the firmware
  • FT232 for USB communication with a PC
  • DS1307 RTC chip as battery backed NVRAM
  • CNY17 optocoupler to handle pulses coming from rotator's feedback sensor
  • two relays to make a H-bridge for motor control
  • split power supply for the motor (unregulated) and the logic part (7805)
  • 2x8 character LCD
  • 4 buttons


The schematic is quite straightforward. I placed two optocouplers to maybe handle a second pulse sensor for elevation control in the future. There are two completely separate power supplies to be used with separate transformers (or windings), but the 7805 can also be wired to the higher voltage supply with a resistor. Split power supplies guarantee that the microcontroller will have reliable power without much interference from the motor switching on and off.

A controller must keep track of feedback pulses and store them when power is off. ATmega8 has a built-in EEPROM that could be used to store pulse count, but updating it on every pulse (commonly there can be someting like 800 pulses per 450 degrees of rotation) would make it wear out (as EEPROMs have a finite write-erase endurance). I could have added more complexity implementing a wear-leveling algorithm to spread the wear across all cells, but I decided to use battery-backed SRAM in the form of a common real-time clock - DS1307. This chip, besides timekeeping has also some general purpose memory that can be written unlimited number of times that is also battery backed. Usually a single coin cell can sustain the chip for 10 years with the clock running, since I do not use the clock, the oscillator is stopped and uses even less power. I update the pulse count in the chip every time a new pulse arrives.

Everything fits a single-layer PCB. Most of the components are thru-hole. The LCD connector is mirrored, so that a ribbon cable can be attached from the rear of a display board. When testing the prototype using a 40V transformer to power the motor I had problems with sticking of the relays - the contacts just welded together and did not switch off. I tried adding a snubber (D1,D2,C22), but it also did not help. In the end I used a 15V transformer and the (new) relays did not have problems. Today I would use a cheap, high-power solid-state H-bridge (with the possibility to implement soft-start and soft-stop of the motor).



I implemented a simple bootloader based on AVR109. A bootloader is a special application that allows the microcontroller to update its own software without using a programmer, which makes it easy for anyone to upgrade the device eg. using USB. It proved very useful when my friend started using it and found some bugs that I could fix "remotely" and deliver him the latest firmware.


The bootloader is activated when UP button is pressed at power on. A power failure during programming does no harm, as the bootloader itself is never updated and can always be started again.


Main application can support any rotator, no matter the pulse-per-degree rate. To do so it must first learn the pulse count and user must input the corresponding azimuths.


Learning procedure:

  1. Press DOWN and power up the device
  2. Using LEFT/RIGHT buttons rotate the antenna to azimuth 0 degrees (looking out the window ;) ) - the controller has no safety limits
  3. Press DOWN to confirm
  4. Using LEFT/RIGHT buttons rotate the antenna to the furthest "clockwise" azimuth (also looking out the window) - it can be over 360 degrees
  5. Press DOWN to confirm
  6. Input the "left" azimuth (preferably 000), the cursor can be moved over all three digits with LEFT/RIGHT, UP button increments the digit (wraps around 9), DOWN button confirms the azimuth
  7. Do the same for the furthest "right" azimuth
  8. Press DOWN to confirm, done :)


The only limitation right now is that, if the rotator has mechanical limit switches, the furthest left (counterclockwise) limited position must be at azimuth 0 (or little further left). Also if the antenna can be rotated more than 360 degrees then it must be set explicitly, like: 410 degrees (410 and 50 "distinct" positions).

During normal use the controller protects the installation in two ways:

  1. It compares the programmed limits to not exceed the maximum left/right postitions - it stops after the furthest safe position is reached.
  2. It automatically stops when no pulse is received within 500ms of starting the motor, so a broken feedback cable will not ruin the whole installation.

Computer control

The controller talks using standard Yaesu GS-232B protocol at 9600bps. It has been successfully tested with HamRadioDeluxe :)

Design files

All designs files, including schematics, PCB layout, source code and binary firmware are freely available here so you can build your own :) MG_rotor_1.0.zip. I release the project in public domain.

Build by 9A3BDE

There is a second build in the wild now. :-) This piece has been build by 9A3BDE. mg-rotor-9A3BDE