Ah yes, time to write about one of my favorite and most used projects. In amateur radio, antennas come in many different shapes and sizes. Some are just wires strung between trees, some are omni directional vertical antennas and some are beam or yagi type directional antennas. In my station, I use three different yagi antennas for 6 meter (50MHz), 2 meter (144MHz) and 70 cm (432MHz).

Since these antennas are directional, they need to be turned to the direction that you want to talk or listen. When I first got my “new” station up and running, I purchased an RCA VH226F antenna rotator. This is the absolute cheapest cost, cheapest built, cheapest feature item out there to get this job done. But, guess what, this thing has been up there for about 6 years now in the rain, sleet, cold and wind, and has got the job done. The premium rotators cost hundreds of dollars. But, to be honest, until it fails or I upgrade the mast, I have no reason to change it out currently.

These machines are bare bones, and do not have any actual feed back for the direction they are actually turned. They use a timing logic to calculate where it “thinks” it is pointed. I have always worked around this. If I knew it was going to last another 10 years, then maybe I would look at putting some positive feed back on it.
Originally I had the control box sitting in my “shack” by the radios, so directing it was as easy as pushing the buttons. But, as I have wrote about in the past, I operate remote often. I needed a way to operate the rotator from anywhere.
So in to the control box I went, first to come out was the push button control board. After some probing around with a multi meter, I figured out which wires needed to touch to emulate a button push.



To close the circuits and operate the control box, I decided to use 5V relay boards and a Raspberry Pi 3B+. I wanted it to be able to move the rotator up fast (increase the degree), up slow, down fast (decrease the degree), down slow, calibrate, and turn the main power to the control box off and on. The calibration cycle returns the motor back to zero degrees.

The above schematic outlines how I wired it to the Pi. Off note, the antenna connected to GPIO 4 is for a different project and the DHT11 is a temperate and humidity sensor.

Now comes the fun stuff – getting the relays to work. GPIO 17 and 27 are the pins that have been designated to control up and down, respectively. To trigger all of these relays, I wrote simple bash scripts; “Fast” up and down, “slow” up and down (which moves it only a slight amount when triggered), “stop” which returns both relays to off, when the correct heading is reached and then finally calibrate (simulates a one time button push). The scripts are shown below:
Fast Up:
#!/bin/bash gpio export 17 out
Fast Down:
#!/bin/bash gpio export 27 out
Slow Up:
#!/bin/bash gpio export 17 out sleep 0.5 gpio export 17 in
Slow Down:
#!/bin/bash gpio export 27 out sleep 0.5 gpio export 27 in
Stop:
#!/bin/bash gpio export 17 in gpio export 27 in
Calibrate:
#!/bin/bash sleep 1 gpio export 22 out sleep 1 gpio export 22 in
Once the scripts are in place, the next step was to ensure that the permissions are correctly set. Since this was going to be a “closed access website”, and only viewable from inside my home network or via a VPN, I was not too concerned with permissions.
First you can check the existing permission:

As you can see “up.sh” has no executable permissions. To change that, we change the permissions for the file using chmod:

You can see the permission is now set to executable for all users. This is something you should never ever do, as now all users can execute it…but if you did you can now run this script, one would enter in the the shell:
./up.sh
Then of course, to stop it from turning, if you changed the permission for “stop.sh” you would run:
./stop.sh
All of these scripts are in my /var/www/html (the default root web server in Linux) folder, as I want to be able to manipulate them from my Dashboard. In part 2 of this post, we will add a camera for reference of the relative position of the antenna and also add web based controls for it.