Rotator Controller

Rotator Controller - How it Works


This type of rotator uses two main components -
  1. A 24V AC motor, which can be operated in either direction by changing the phase of the motor windings. This is achieved using a capacitor between the windings (in the control box). To turn one way, power is applied to one winding, and to turn the other way, it is applied to the other winding, using switches on the front of the control box. The motor is geared down to turn the rotator, which is physically constrained to slightly more than one complete turn.

  2. The position of the rotator is reported back to the controller by a 500 Ohm wirewound potentiometer. The pot has about 6V DC on one end, and near 0V at the other. As the rotator turns, so does the wiper on the pot. The voltage returned to the controller is nearly 0V at the fully anticlockwise end of rotation, and nearly 6V at the clockwise end.
The KR-400/G-400 controller does not do anything clever with the signal from the pot, it simply displays the voltage returned on a simple voltmeter calibrated in heading degrees. Operation is completely manual.

Adding Computer Control

In order to add computer control, two main functions are required. First, some means of digitally determining the rotator position is required, which is done by reading the voltage on the pot. This signal is notoriously noisy, and can contain large switching transients, considerable noise and hum, as well as scratchy noise from the pot as the rotator turns. A special analog to digital (A-D) conversion technique is required to guarantee reliable reading.

The second control function involves comparing the present position with the user's request (the demand). If the demand is greater than the present position, the rotator must be moved clockwise until the current position back from the pot coincides with the demand. The same is true if the demand is smaller, but in this case the rotator moves anticlockwise. When the two coincide, the controller sits idle. A small amount of hysteresis (small differences between position and demand are ignored) prevents the rotator from hunting up and down, as the rotator does not stop instantly when the correct position is reached.

In order to move the rotator, the motor is activated by one of two small relays, which are in effect connected across the control box "LEFT" and "RIGHT" switches, so the controller "presses the switches" for you.

Computer control is achieved by sending commands to the ZL1BPU Rotator Controller via the PC serial port. Most of the commands are different types of movement commands, where a value is sent in degrees, and interpreted by a mathematical routine into a demand value. Four different command methods are supported, allowing the ZL1BPU Rotator Controller to operate with just about all computer applications. The controller also handles offsets in the rotator pot voltage, so the commands are generally in real heading degrees. There are other commands for the PC to stop rotation, enquire about the current position, and determine the controllers firmware version.

The Controller Block Diagram

Analog to Digital Converter

Many of the conversion techniques normally used are inappropriate for measuring the signal from the rotator pot, as they require sample and hold to work with noisy signals, plus sophisticated filters to remove the noise and hum. The micro controller used here does not have a digital to analog converter, but it does have an analog comparator, and a means of generating an accurate reference voltage. This reference voltage is generated by a dedicated timer using pulse width modulation, and is operated in the micro hardware. The range is 0V to 5V, in 1024 steps (i.e. about 5mV per step).

An input voltage to the comparator can be determined by altering the reference voltage to find the point at which the comparator switches (the comparator compares the pot voltage with the reference). There are several ways to do this, but the most appropriate way is to step the reference up and down one step at a time, so that the reference ramps up to the pot voltage, and then iterates back and forth a few counts either side. The step decisions are made every millisecond, so the A-D converter is slow, taking about one second to go from 0V to 5V. Of course the rotator is much slower again, as it takes about one minute to fully rotate. The slow tracking of the pot voltage means that the technique is virtually unaffected by noise and hum. This technique is called a closed loop controller with integrating feedback.

After a few seconds from power-up, the reference voltage will match the pot voltage, and so the reference voltage command contains a number which represents the pot voltage, scaled 0 - 1023. This value is divided by four to reduce the noise further, and used as an 8-bit (0 - 255) value. At power up, the present position is also read and stored as the current "demand". This means that the rotator control will be stable when first powered up, so will not shoot off to zero or some previously remembered position.

Closing the Loop

As mentioned previously, the present position and the user's demand are compared to determine whether, and which way, the rotator should move. The necessary hysteresis is achieved using a software "window comparator". This consists of two comparators, both comparing the present position with the demand, but each with a small offset - one compares with demand -1, the other with demand +1. Thus when the demand and present position are exactly the same, or within one step of the same, one comparator will be set one way, and the other the other way. When this is the case, the rotator is idle.

If the present position is lower than the demand by 2 or more, both comparators switch the same way, and a relay is switched to move the rotator clockwise to correct the error. If the present position is similarly higher than the demand, both comparators switch the other way, and the other relay is switched to move the rotator anticlockwise to correct the error.

This control loop is independent of the A-D converter and also the demand. Thus it will continue to maintain position if the rotator is pushed around by the wind, and will "fight" any attempt to manually turn the rotator with the front panel switches. (To manually turn the rotator, the micro controller is disabled by disconnecting the relay supply).

The relays are driven by small bipolar transistors driven into saturation. They are powered from the 12V unregulated rotator supply. The relay contacts are conected in a special way so that the connections of the relays and front panel switches are "interlocked". It is simply not possible to accidentally drive the motor both ways at once (which will damage the motor and the power transformer), either through failure of a relay, relay driver, or manual interference with the switches while the controller is turning the rotator.

Sending Commands

Understanding commands from the PC requires a special program module called a command interpreter. This is operated in an interrupt routine, so is virtually an independent program. Four different positioning commands are looked for, by looking initially for the first letter in each command. These are "A" (ORION),"G" (ZL1BPU KISS), "M" (YAESU) and "P" (SARTEK). Once one of these letters is found, an appropriate section of firmware will read further characters from the serial input and then process them appropriately into a demand value. For example, two of the commands send a requested heading as three decimal digits, "000" to "359", which is of course the requested heading in degrees. The firmware reads these three values, then multiplies, divides and adds them together to create a single number 0 - 180, which represents the demand. The demand is therefore represented in 2 steps.

Since the rotator pot does not read exactly zero when fully anticlockwise, a small offset is added before the demand is sent to the position control loop. The controller is calibrated so that the clockwise reading from the A-D converter is exactly 180 counts higher than the anticlockwise value. So the present position is also reported in 2 steps.

There are three further commands, used to report position, stop the rotator, and report the ZL1BPU Rotator Controller firmware version. This is useful if PC control software is required to work with several different versions.

Bells and Whistles

While the rotator is moving, the ZL1BPU Rotator Controller reports the present position back to the PC, twice every second. It also reports its heading while initializing, allowing PC software to know where to start, and can optionally report the position every two seconds when idle. It also reports errors in the same way. An optional LED is also turned on when the rotator is moving.

Two error types are specifically detected - potentiometer errors (voltage from the pot is too high or too low, as happens when a wire falls off) and rotator errors (a timeout has been reached before the rotator reached demand, such as happens when the rotator jams or unexpectedly hits an end stop). Motion is disabled to prevent damage. Operation is restored by cycling the power or giving a further command. The optional LED flashes slowly when an error has been detected.

Command errors are also handled. Invalid commands and impossible commands are ignored. If the heading requested is outside the range 0 - 360, the command is ignored. Negative commands -180 to -359 are converted by adding 360 and handled correctly.

Circuit Description

See the controller schematic. Preferably print out a copy to refer to. At the top left is the power supply. The input is around 11 - 16V from the rotator unregulated supply. D4 provides reverse protection, but also helps reduce ripple, since small as it is, C4 cannot discharge back into the supply. U1 is a simple three-terminal 5V regulator, which requires the output capacitor C5 for stability reasons. D1 is the status LED, pulled low by the micro. In order to save supply current, the port current is limited by a high resistor value (R4), so if fitted, the LED D1 should be a high brightness type.

The big square in the middle is of course the micro U2. On the top left of it is the 10 pin programming header. Below are the two analog inputs. AIN0, the positive input, receives the pot voltage, reduced to 0 - 5V range by R1/R2, arranged to provide 5V x 180/256 at full scale. D7 provides transient supression. A shunt 10nF capacitor may be fitted across R2 to prevent RF instability. AIN1 is the negative comparator input, and receives the reference comparason voltage from the D-A converter.

The D-A converter output from the micro T1 timer output compare is from the OC1 pin. This has a controlled pulse width at a frequency of around 1 kHz, and through low pass filter R3/C1 generates an accurate DC voltage with 5mV steps on AIN1.

Below the micro can be seen the simple crystal reference and capacitors used for the micro clock oscillator. 4 MHz is a good compromise frequency, and specifically sets the serial communications baud rate, and incidentally the operating speed of the whole device.

At the top right of the micro are the two relay driver transistors TR3 and TR4. BC337s were chosen since they have good saturation characteristics and good gain at high current. The base resistors R12 and R13 provide 450uA drive and thus assure saturation to well over 100mA collector current. The diodes D5 and D6 protect the transistors, by absorbing inductive switching energy from the relays, limiting the positive excursion of the collector to just above the supply. The relays are powered from the unregulated supply.

The RS232 interface is at the bottom right. Commands are received from the PC by TR1, acting as an inverter. The idle condition of the RS232 line is negative, and so D2 conducts via R6, TR1 stays off, and the micro UART RXD input is held high by R7. When the RS232 line goes high, current flows in R6 and the base of TR1, so the collector pulls RXD low. When the RXD line is idle, D3 also conducts, charging reservoir capacitor C8 to about -8V.

The RS232 transmitter buffer is TR2. When the UART TXD is idle, the output sits high, and TR2 is held off. The RS232 output is passively held low by the charge in C8 via resistors R10 and R11. When TXD is active (low), current flows in the base of TR2 via R8, and the collector of TR2 is pulled high, to almost 5V. The RS232 output goes high, R11 providing current into the receiver at the other end. R11 is essential to prevent damage to TR2 in case the RS232 line is shorted to ground.