Satellite project - part 3
Electronics
The next stage is to start getting the computer to control the antenna rotator/elevator.
The control chain I mentioned in part 2 actually is missing something. The Arduino doesn't connect directly to
the controller box.
I had assumed that the 5V being output by the Arduino pins would go directly into the control box via the 8-pin
DIN plug. However, before trying it out, I measured the voltage on the DIN connections, and found 15 V there.
Re-reading the document that comes with the rotator, it does clearly say that in order to get the device to
move, you need to complete a circuit - essentially flick a switch.
I decided to use relays triggered by the 5V coming out of the Arduino to complete the circuit.
The relays I bought were 4
Channel Relay Breakout – 5V (
£14
), and the corresponding 6-Pin Molex KK to Dupont Male Cable (
£3
) so that I could connect it.
So the actual control chain looks like this:
GPredict -> (TCP) -> Hamlib -> (ACM over USB C) -> Arduino -> Relays -> (8-pin DIN) -> Yaesu controller box -> (5-core control cables) -> Yaesu rotator/elevator.
Warning: Although the voltages aren't dangerously high here, 15V could probably fry your Arduino, or your USB
port on your computer. You don't want to release the magic
smoke that is carefully put into all microchips when they are made. Check the voltages with a multimeter
before connecting.
There will be 4 x 15V pins (if they're the control ones), and 2 x 0-5V if they're the ones to tell where the
antenna currently is.
The Arduino will output 5V from the PWM pins.
Arduino
Arduinos are a large topic. There is plenty of documentation written about these, so I'll just cover the main steps. For more detail, consult your friendly search engine or AI.
- Install the Arduino IDE (apt-get install arduino)
- Clone the repo: git clone https://github.com/k3ng/k3ng_rotator_controller
- Edit the rotator_feature.h file. For a G-5500 DC I enabled FEATURE_ELEVATION_CONTROL and
FEATURE_EL_POSITION_POTENTIOMETER. I also had to comment out the TEENSYDUINO section and case 6 in
k3ng_rotator_controller.ino for some reason.
I set AZIMUTH_STARTING_POINT_EEPROM_INITIALIZE to 0, AZ_MANUAL_ROTATE_CW_LIMIT to 450, and AZ_PRESET_POT_FULL_CCW_MAP to 450 in rotator_settings.h
My version of the code is available at https://gitlab.com/g7vrd/k3ng_rotator_controller - Compile and push the results to your Arduino.
Your Arduino should now be listening on analogue pins 0 and 1, and sending out 5V on PWM pins 6, 7, 8 and/or 9
Your Arduino should now be running the code. To test it, you can connect via the serial interface.
minicom -D /dev/ttyACM0 -b 9600
You will then be able to enter commands manually. You can find the commands at
https://github.com/k3ng/k3ng_rotator_controller/wiki/820-Command-Reference
Relays
Connect Arduino ports 6, 7, 8, and 9 to the four relays.
The relays will also need a ground and 5V supply. You can connect the VCC and GND on the Arduino to power the
relay.
8-pin DIN
A couple of the wires in the cable are for the controller to send voltage (0-5 V) to tell the Arduino where the antennas are pointing. The others are for closing a 15 V circuit to move the rotators/elevators. Don't get these confused - confirm with a multimeter first.
Note: The documentation supplied by Yaesu with the rotator is wrong. It clearly specifies that the voltage that comes out the controller box to show where the rotator is is 2-4.5V. However, it is definitely 0-5 for both the rotator and elevator. The K3NG is fine with this and works correctly.
| DIN pin | Arduino pin | Function |
| 1 | A1 | Read elevator |
| 6 | A0 | Read rotator |
| 8 | GND | Common ground |
DIN pins 2, 3, 4 and 5 should be connected to the NO (Normally Open) sockets on the relay. DIN pin 8 should be connected to all of the COM (Common) ports of the relay.
rotctld
Run the Hamlib rotator controller. This is a translation layer between your satellite software and the
Arduino.
rotctld --model 603 --rot-file /dev/ttyACM0 -vvvvv
This will listen on port 4533. Model 603 is the GS232B interface.
/dev/ttyACM0 is the device your Arduino will appear on when it is connected.
GPredict
Obtain a copy of this, and run it. The key part is that you need to configure it to talk to Hamlib.
Edit, Preferences, Interfaces, Rotators, Add New:
Name: G-5500DC
Host: localhost
Port: 4533
The rest I left the same.
Choose "Antenna control", and then Engage. You will probably hear a relay or two click.
Then select your satellite, and Track.
What you should see
- The GPredict antenna control interface should show where the antenna is pointing
- The rotctld command should start showing lots of commands
- The Arduino serial LEDs should start flickering
- The relays should click and light up
- The controller box should start ...
- The rotator and elevator units should start moving
Notes
The voltage supplied by the control box is 0-5V, not 2-4.5V as documented. The voltage fluctuates a little bit, so the rotator can move sometimes when it's not necessary. I'm not sure whether this is caused by the resistance measured being wrong, or the voltage being output by the controller being wrong, or some problem with the cabling to the Arduino, or even the Arduino's analogue-in ports not reading it quite correctly.
Grounding is important. Without it, the voltages will fluctuate, and cause the Arduino to be confused as to where the antennas are pointing. This will lead it to constantly adjust. The ground from the DIN pin 8, the relay COM ports, and the Arduino GND all need to be joined up.
Calibration is important.
Turn the elevator to 0 (there is a mark on the casing)
Turn the rotator fully anti-clockwise. Make a mark on the casing.
Adjust the dial screws so the dials read 0
Turn the elevator to the 180 degree mark on the casing.
Turn the rotator 360 until it lines up with the mark you put there before.
Adjust the dials with the screws on the back.
Adjust the elevator voltage with the screw on the back until it reads 5V
Turn the rotator the last 90 degrees
Adjust the rotator voltage with the screw on the back until it reads 5V
If you leave rotctld running and GPredict in "monitor" mode, you can see what GPredict interprets the received
voltages as. These should pretty much match the dials on the controller box.
Alternative tracking software
There is also a simple-to-use Python library called Skyfield that you can use to track celestial objects. It would probably be quite simple to make it output commands that rotctld could understand
Control without the Yaesu controller box
For a simpler setup, it could be possible to make the Arduino supply 22V directly to the rotator and elevator motors, obviating the need for the Yaesu controller box and the 8-pin DIN stuff. Obviously the Arduino couldn't supply either 22V or the amperage needed, so there would need to be either some relays or some transistors involved, but I think it should be possible to do.