AVROT rotator controller version 1.1

This design is an antenna rotator controller - a box connected between computer and standard rotator control unit (containing usualy power supply, direction indicator and control buttons). The controller 'pushes buttons' on control unit in order to point the antenna to correct direction based on commands from computer. The controller supports both azimuth and elevation control (simultaneously), so it can be used for satellite tracking. Azimuth only or elevation only operation is also possible, of course.

*** Interfaces ***
Control unit side:
output isolated signals (220V 8A max, depending on relay type used) - CW rotation, CCW rotation, brake for both AZ/EL. input DC voltage between 0 and +30V (against common ground) from potentiometer in rotator (power supplied from control unit)
Computer side:
RS232 COM port interface - 9600 Bd 8N1, hardware control not used. See later for details about protocol.

*** Prediction software compatibility ***
Nova for Windows (NLSA) - using the M2 RC2800P controller protocol
WinOrbit (K8GC) - using DDE interface; more details later
WiSP (ZL2TPO/G7UPN) - using the GS232 controller protocol

*** What the controller DOES NOT SUPPORT ***
Speed control of motor; it can be only running or stopped.
Motor is simply stopped when position is reached.
Digital incremental/absolute angle sensors on rotor.
Lot of different communication protocols - see later.
Accuracy bellow 1 degree. Control is done in 1 degree steps (but the analogue digital convertor's accuracy is higher).

*** Some other interesting features ***
LCD display indicating current azimuth/elevation, last received setpoint, status of motor (stopped, moving CW/UP or CCW/DWN).
Azimuth rotation angle up to 999 degrees (for rotors with more possible rotation between end switches) as well less than 360 degrees (in case the setpoint is in not covered region, the closest end switch position is selected).
Dead zone feature - if the received setpoint is very close to current position, it is ignored. Width of the dead zone is configurable.
Setup - using buttons on front panel and that on control unit it is possible to configure all rotor parameters in a while. Configuration is then stored in controllers permanent memory.
Cheap design - all components together can be obtained for less than 40 EUR. The AVR CPU (heart) just only about 4 EUR...
Availability - the design is HAMWARE (free for HAM use; but no commercial use is allowed without authors approval!!!) Source code is available for possible adaptation by user.
Easy to build - just one PCB, minimum components. Programming of the AVR chip can be done without complicated programmer and expensive interfaces - see later. The AVR chip is in controller board circuitry during programming, it is connected to printer port of PC via programmer connector.
Only one supply voltage (+12V) - the controller can be easily used for portable operation.

*** Circuit description ***
The heart of controller is a single chip RISC controller AVR AT90S4433, manufactured by Atmel. In 20 pin DIL package is CPU, RAM, EEPROM, USART, 10 bit AD converter, timer,..), all we need for our project! Just few other components are necessary to connect it to other world / complete the design.
LCD display - any model based on world standard with Hitachi HD44780 chip with 2 lines 16 characters each. It operates in 4bit, write only mode.
Program itself is stored in 2Kword flash memory (about 75% full), it is completely written in assembler. I apologize to those with deep knowledge of that - I am not an expert, my job is quite different from AVR programming, and this is my first real project with AVR! I know my code is far to be optimal.. But it works :=)
EEPROM memory is used for two purposes - to hold configuration data and text strings being displayed (to spare space in flash).
Voltage signal from rotor's potentiometer goes through LP filter and voltage divider (2 ranges, jumper selection) first and then comes to analogue-digital convertor (10 bits) via internal analogue multiplex (Az or El voltage).
The UART is used for bidirectional communication with computer. It is possible to receive commands from the PC and also send present status of the rotator to the PC. Signal levels are adjusted for RS232 standard.
There is also circuitry for IF100 interface (to printer port). It is not supported in current software version.
I have attached OrCAD capture 7.1 files as part of the project, but I don't guarantee they are 100% correct. Perhaps someone can find them useful...

*** Communication protocol ***
Because of lack of information, I have implemented in current version a protocol used by M2 rotators (tks info OK2TEJ). I have no opportunity to verify the full compatibility, (I miss some small details in the description), so the controller is "tuned" to get correct response to/from prediction software (Nova). Additionally I implemented a W command used by GS232 controller (I have no description of that protocol, it is just the command that Wisp program sends out..), so it will probably work with some programs that support GS232. Sorry, my intention is not to create another protocol, I guess the number of that used these days is high enough. Perhaps the compatibility will be better in next software version... Every information is appreciated.

The communication can be tested easily using any terminal program (Hyperterm, Minicom,..), just set it to 9600Bd, 8 data bits, 1 stop bit, no parity, no flow control.

Supported commands:
(each terminated by <CR>)

A - azimuth control follows + request for azimuth value
E - elevation control follows + request for elevation value
<empty, just <CR>> - request for current rotor status
S - stop the motion
Sx - speed (for compatibility only, no functionality), x=1..9
x - setpoint (required azimuth or elevation in degrees), x=0 to 359 (unsigned integer number)
U - start autoupdate (controller sends data to PC every 1 sec)
N - stop autoupdate
Wx y - setpoint (GS232 version), x=0 to 359 (azimuth), y=0..180 (elevation)

*** DDE Client example (connection to prediction software) ***
Some prediction programs don't support communication with rotator controller directly (i.e. over serial port) but make the data available by other ways. I wrote a simple DDE client program for MS Windows that creates an interface between AVROT and tracking program WinOrbit.
WinOrbit sends the data to the client using DDE (protocol for data exchange between windows applications) and client passes it to AVROT via COM port. You can find an already compilled executable file (AVROTDDE.EXE) and source code of it (for VC++ 6.0) as part of project package. So the AVROTDDE.EXE can be immediately used as interface between WinOrbit and AVROT. Just start both programs and select correct serial port, that's all. Serial port number can be used as command line parameter of AVROTDDE.EXE. AVROTDDE.EXE also supports manual control, so it is possible to control the AVROT controller directly (i.e. for testing). The program is for MS Windows (all 32 bit versions - I hope so..) only, I appologize to users of other operating systems...

*** Setup procedure ***
After burning the firmware into the AVR there is a set of default rotator configuration parameters in EEPROM memory available for testing. Later when you connect it to rotator you will have to adjust some of them.
Setup procedure allows you to adjust AVROT parameters to your rotator in a while. You should have connected both rotators during the setup; azimuth parameters are adjusted first, elevation follows. If you plan to use just one rotator, don't worry, just go through the unused section. In case of any change, the complete procedure must be repeated.
To enter setup, press Setup/Next button for more than 2 sec. Use the same button to move to following setup items.

Dead zone - set the width of zone using UP/DWN buttons. The value should correspond to design of system (esp. beam width of antennas used). Example of functionality: zone width set to 5 deg, antenna in position 260 degs; commands between 255 to 265 degrees are ignored, but 266 will cause the ant to start moving. Main purpose is to avoid unnecessary movement of antenna caused by small change of satellite position.

AZIMUTH

Turn CCW limit - move the antenna to CCW end limit position using buttons on power/control unit; a raw ADC value is displayed. When the Setup/Next button is pressed, the ADC value is stored.

Degrees - enter CCW limit azimuth in degrees using UP/DWN buttons (hold the button for a while for faster change). That value is stored and should correspond to ADC value of CCW limit.

Turn CW limit - same as for CCW limit

Rot. range - difference in degrees between CW and CCW limit, how many degrees the rotor is able to turn. Can be more than 360 degrees!

ELEVATION

same as for azimuth; rotation range limited to 180 degs.

Setup data store

UP button - STORE; press for 2 sec to store newly modified data (into EEPROM memory); the data are immediately used, no restart necessary.

DWN button - CANCEL just return to main program, all changes will be ignored/ are not saved (it can be used to verify parameters or check the raw ADC value).

Note: current ADC value is displayed together with the "Turn..." command. It is a number between 0 and 1023 (interpreted as :23 to spare one display position). The highest value corresponds to highest voltage applied (30V without / 15V with jumper). The program remembers both limit values and interpolates the degree value. So the value itself is not very important (no need for external adjustment of potentiometer voltage); just remember that more ADC steps (difference between higher and lower limit) mean higher calculation accuracy (esp. when you use rotators with more than 360 degs rotation range). So try to use the lower voltage range if possible. But the voltage must never cause the ADC converter to reach the limit!

*** Printed circuit board ***
One design is available as part of project documentation. Please bear in mind that it is not complete design ready for production, it needs to accommodate changes as transformer and relay dimensions, connector, thick connections/ copper where high current can be expected (relay outputs) etc.

*** AVR programming ***
Note: the program has been written and compiled using AVR STUDIO version 3.00 (free available from Atmel WWW pages). To burn the target code into AVR I use a SP12 program, version 0.7, from Pictronics. I recommend you to use the same for your AVROT project if you don't have any other programmer.
Description (including hardware connection) is in DL7UNO article in Funkamateur 6/2000, the program itself is on Funkamateur CD. It has been tested under DOS and W9x on P166 computer (be careful with too fast new PC's!). The program detects AT90S4433 as AT90S4434, but works correctly. The AVR is in application circuitry during programming, the 'programmer' (just several wires and one resistor) is connected to programmer connector on controller PCB. Parallel port of PC is used for data exchange during programming.

How it is wired:

Pin nr on AVROT PCB

Signal AVR

Signal LPT

Pin nr LPT

1

Ground

Ground

25

2

MOSI

DATA7

9

3

MISO

BUSY

11

4

SCK

DATA0

2 *note

5

RESET

DATA1

3

note - SCK signal is connected with DATA0 via 220 ohm resistor.

The controller must be powered during programming.

Programming sequence:
- switch off the AVROT power
- start SP12 once to initialize LPT port (write zeroes)
- connect programmer to AVROT
- switch on the AVROT power (LCD uninitialized)
- do programming (start SP12 with required parameters)

Example of command that performs programming of flash and
EEPROM:
sp12 -wpfC avrot.hex -wefC avrot.eep
All is done in 20 seconds...
Remember: EEPROM must be always programmed after AVR memory reset - it contains all LCD texts!
- switch off the AVROT power
- disconnect programmer.


73 Pavel OK1DX/KF9VM

packet radio OK1DX@OK0PPL.#BOH.CZE.EU
email ok1dx@amsat.org