AVROT rotator controller version 2.0

This design is an antenna rotator controller - a box connected between computer and standard rotator control unit (usually 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.

*** 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.

*** 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 turns between limit 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 can be done without complicated programmer and expensive interfaces - see later. The AVR is in controller board circuitry when programmed, 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! So we need just few other components to connect it to other world.
Next part is a LCD display - any model based on world standard with Hitachi HD44780 chip with 2 lines 16 characters on each line. It operates in 4bit, write only mode.
Program itself is stored in 2Kword flash memory (it occupies about 75% of that), it is completely written in assembler. I apologize to that with deep knowledge of that - I am not an expert, my job is quite different from that, 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 first through LP filter and voltage divider (2 ranges, jumper selection) and then comes to analogue-digital convertor (10 bits) via internal analogue multiplex (Az or El voltage).
The USART 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.
There is also circuitry for IF100 interface (to printer port). It is not supported in current software version.
Timer starts some basic system functions and control timeouts.

*** 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 compatibility (I miss some small details in the description). 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
E - elevation control follows
<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) ***
I wrote a simple DDE client program that creates an interface between AVROT and tracking program. Of course, if you have a program that supports communication protocol of AVROT directly, there is no reason to use it, but some programs (like WinOrbit) don't have any controller protocol implemented and offer the tracking data over DDE interface only. You find an already compilled executable file (AVROT.EXE) and source code of it (for VC++ 6.0) as part of project package. So the AVROT.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 AVROT.EXE. AVROT.EXE also support 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 AVR programming there is a set of rotator configuration parameters in EEPROM memory, that you can use for testing (without rotator connection).
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. In case of any change, the complete procedure must be repeated.
The procedure is simple (the same for azimuth and elevation) - first manually move the rotor to one limit position (counter clockwise CCW or down DWN), then record the potentiometer voltage (ADC value) and position in degrees. Manually move rotor to opposite limit position (clockwise CW or UP), record the ADC value and enter the angle between the two limit positions.

Setup sequence:

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). The 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.

Turn DWN Limit
Degrees
Turn UP Limit
Rot. Range

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 lost / 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 freeware SP12 program version 2.0, from Pictronics (http://www.xs4all.nl/~sbolt/e-spider_prog.html). 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:
(if you run SP12 under Windows 2000/XP you have to install giveio driver in advance - part of software package)
- 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 clear - it contains all LCD texts!
- switch off the AVROT power
- disconnect programmer.


Changes coming with version 1.1

M2 protocol adjusted to Nova prediction software:
- data msg change
- longer TX buffer
- msg sent also by A and E commands

A special build 1.1x exists displaying angle value in highest possible precision (one decimal place - but restricted by A/D converter accuracy) - not recommended for satellite operation.

Changes coming with version 2.0

- Migration to processor type ATmega8 (AT90S4433 is no more available) - no changes in circuit diagram / PCB necessary
- Longer access time for LCD module to perform the action (reported some LCD modules are not fast enough)
- Minor modification of status message

Note:
For compatibility reason fuses (higher byte only) must be also programmed for ATmega8 processor, (parameters for SP12 -wF11111111), the command line sounds like:
sp12 -wF11111111 -wpfC avrot.hex -wefC avrot.eep

73 Pavel OK1DX/KF9VM

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