-
Notifications
You must be signed in to change notification settings - Fork 2
Arduino Rotator Controller Remote Commands
January 20201 I created a rotator controller on the Teensy 4.1. In the interest of shortening development time I reused the command code from the RF Wattmeter/Band Decoder which also permitted reusing the Desktop app buttons to send commands and see the status messages from the controller in the Python command window. I plan to add the classic Yeasu GS232 commands later.
The desktop app can be used to send commands today by:
- Edit the meter IP address and port number to match that of the controller. From the Python script you can see I commented out the .188 address and related port numbers and added a new address for .189 and new port numbers. Eventually there will be connections for both addresses as I add rotor support into the app.
From the Python app:
#addressing information of target
IPADDR_OF_METER = '192.168.2.189' # for Rotator controller testing
PORTNUM_OF_METER_LISTEN = 7947
PORTNUM_OF_METER_SENDTO = 7946
#IPADDR_OF_METER = '192.168.2.188' # For normal RF wattmeter/Band Decoder
#PORTNUM_OF_METER_LISTEN = 7942
#PORTNUM_OF_METER_SENDTO = 7943
-
Simply editing the 2nd parameter for any of the GUI button command functions. Here I have copied commands for 3 buttons, HF, 50 and 144. These buttons send a command number to change to a new band on the meter. These band change commands require no 2nd argument so the 2nd arg is normally blank or "" as seen in band_144 example below. I reused many of the button codes in the controller to speed up testing. The Band_144 has 242 assigned and no argument. 242 is a stop command in the rotator controller so no arg is required either.
def band_144(self):
rx = Send_Mtr_Cmds() print("Jump to 144MHz Band ") # Write command to jump to band 1 rx.send_meter_cmd("242","", True)
To turn the rotor right or left to a heading the 2nd arg is used. Replace "" with "xxx" where xxx is your desired heading. IF the heading is beyond a limit the rotor will stop at the limit. Band_50 will move the rotor right (CW) to a heading of 160 or until a limit is reached, a stall is detected or a stop command. If the position is already at the destination heading it wont move.
def band_50(self):
rx = Send_Mtr_Cmds()
print("Jump to 50MHz Band ")
# Write command to jump to band 0
rx.send_meter_cmd("241","160", True)
def band_HF(self):
rx = Send_Mtr_Cmds()
print("Jump to HF Band")
# Write command to speed up data rate output from meter
rx.send_meter_cmd("240","300", True)
The actual command message format is simple. You can write your own GUI control program easy enough. Here is an example:
100,120,241,160\r\n
100 is the meter ID. Needs to match the target's configured MeterID. This allows for multiple meter or controllers, mostly from the point o view of the Desktop app to permit monitoring multiple meters.
120 is the message type for a command.
241 is the actual command number.
160 is the heading target. Most commands do not use this 2nd argument so is normally blank.
In the Arduino Serial Monitor you can just type in 100,120,242 and hit enter to send a rotor stop command. The last arg is blank for a stop command so can be left off. The Monitor window should be set to send CR\LF at the end of each line.
Look in the Arduino code for the actual codes used. They are all in the get_commands() function with comments labeling their function
139) {val} // Reset to default settings on next reboot. val = 'R'
230) {} // Move Az rotor CCW up to manual limit.
231) {} // Move Az rotor CW up to manual limit
239) {val) // Set the Az rotor Offset. val = degrees antenna is pointed different than the hard stop heading.
240) {} // Move Az rotor CCW. Will stop at first limit encountered
241) {} // Move Az rotor CW. Will stop at first limit encountered
242) {} // STOP Az rotor
244) {val} // Calibrate Az rotor analog voltage full CCW. val = Manually Set Rotor Full CCW counts
245) {val} // Calibrate Az rotor analog voltage full CW. val = Manually Set Rotor Full CW ADC Counts
246) {val} // Set Az rotor Manual Limit CW = val
247) {val} // Set Az rotor Manual Limit CCW = val
248) {val} // Set Az rotor_StartPos = val
249) {val} // Set the Az rotor stall detection distance it must travel within the timeout period = val
250) {val} // Set the Az rotor stall detection timeout period (in seconds) = val
251) {val} // Set the Az rotor Stopband. allows a small window for deciding when to stop rotation. val = number in degrees
252) {} // Report Az rotor Position
254) {val} // Move Az rotor to Preset heading. val = 0-9