Directional Antenna Alignment Control System

The goal of the project is to create a control system that can be used to automatically align a directional antenna mounted on a barge to an on-shore omnidirectional antenna. This system will use GPS coordinates of the bow and stern of the barge to determine the directional antenna's position as well as the coordinate of the on-shore antenna to determine the angle of alignment that the system will need to output.

=Problem Definition=

Background
The U.S Navy Acoustic Research Detachment has been conducting research on a barge in North Idaho and have been transmitting their recorded data from the barge to an on-shore omnidirectional antenna.



Their transmitting antenna is not automatically aligned to the receiving antenna on the shore. Thus, those on the barge must go up to the antenna and manually redirect it every time the barge moves to a new location. This wastes time and energy of personnel as well as delays research. Utilizing a control system that automatically aligns the transmitting antenna to the onshore antenna could significantly reduce waiting time. We will be creating a control system that will align the antenna within 30 seconds the moment the system is powered. Additionally, the system will have an on/off switch so that those on the barge will not have to go up to the antenna to power the system, further increasing the convenience of aligning the antenna. The precision of the antenna will also improve as the antenna adjustment will be a mechanical output of a calculated digital input position, which is more precise than the human eye.

Deliverables
The objective of this project is to create a working finalized product that can be mounted and implemented atop the barge. The system will also be configured to be a "plug-n-play" device and made so that maintenance and upkeep is fairly easy to conduct.

6. Schedule Requirements
=Design= The following is a description of the control system's functional process and our design choices for the prototype.

Functional Process
Once the device has been powered on, the first step of our system's process will be receiving a RS232 serial communication from a GPS receiver. This receiver will send the coordinates of the bow and stern of the barge. Once the message is received, a microcontroller calculates the position of the directional antenna and then, using the fixed coordinate of the on-shore antenna, determines the angle that the directional antenna would need to rotate (relative to the bow of the barge) to properly align itself to the on-shore antenna. One thing to note is that the microcontroller will adjust the angle of rotation based on what angle the antenna is currently at (again, relative to the bow).

Next, the microcontroller translates the angle into stepper motor steps and then send the result out to the motor where it will turn accordingly. The mounting rod of the directional antenna will be connected to the shaft of the stepper, therefore turning as the motor turns. To ensure the stepper motor moved to the correct position, an encoder will be attached and will send a signal containing the position back to the microcontroller where necessary angle adjustments will be made. Once the control system has deemed the motor to be in the correct position, the whole process will then repeat.

System Design
The design for our device can be split up into three different subsystems: Housing, Power, and Control.

Parts
For the stepper motor, we elected to use STEPPERONLINE's NEMA 17 Bipolar Stepper Motor. This motor has a step angle of 1.8° with a holding torque of 59Ncm (84oz.in). This motor would, however need a motor driver and would not be able to be driven directly from the microcontroller. Thus, we opted to use the HiLetgo A4988 Stepstick Stepper Motor Driver.

Using this driver would enable us to determine how many steps the motor should move and in what direction (CW or CCW). This driver also allowed for microstepping down to a sixteenth of a step, thus allowing for 0.1125° per step. Since the barge would be, at most, approximately two miles away from the on-shore antenna, we needed to get the motor to have as good of resolution as we could, and at the time of our choosing the driver, 0.1125° was the best we could find.

When choosing a microcontroller, we decided upon the Arduino Uno Rev 3.We chose this device since it had a serial port to communicate with the GPS receiver, a supply voltage of 9 volts, which turned out to be the same as the supply voltage of the motor driver, there were plenty of digital pins for connecting to the motor driver and encoder, and we were familiar with the Arduino coding interface.

The part that caused the most issue and relief was the rotary encoder. Since this was a control system, we needed to create a feedback loop to ensure that the antenna was in the correct position. An encoder would be able to do just that by reading the amount of steps the motor moved from its last position and sending them to the microcontroller to be analyzed. The issue was finding an encoder that worked with our parts. Our first theory was to use a hollow shaft rotary encoder that could slide on top of the motor shaft. This problem with this is that there were no encoders we could find that were small enough to fit around the motor's 5mm shaft. The next idea was to replace our motor with one that had an encoder built in. We managed to find one that contained the exact motor we had already bought, but the encoder was incremental instead of absolute. This is an issue because incremental only reads the motor's distance, speed, and position while the absolute encoders measured angular positions. Also, absolute encoders could maintain the antenna's position after powering down while the incremental could not.

We eventually came across a product called uStepper S. This device served as a microcontroller but also had a motor driver and a rotary encoder built-in. It was programmed to be used with the Arduino interface and had already had an Arduino library ready to use. Also, the motor driver was able to microstep down to 1/256th step (or 0.007°) and the encoder had a resolution of 0.0055°. With these resolutions, our angle and step calculations would become greatly more precise than we had originally planned for. In addition, this microcontroller supported an input voltage of 9V, leaving our power system unchanged. While this product does seem promising, it is sourced out of Denmark, so we have to check with our client to make sure we can use that part.

Code
The code is the core of the whole project. Here, the process for reading the GPS signals, calculating the directional antenna angle, reading the encoder, and controlling the stepper motor take place. Below shows the process of the code.

After initializing the system, the first part of the process is to read in the two GPS signals. There is a receive flag that determines if a serial message has been sent to the Arduino. Once that is confirmed, the GPS message is then parsed and the GPS coordinates, directions, and the transmitter ID is extracted and returned to the main function. Then, the satellite ID is checked to see if it matches the ID of the bow or stern transmitter, and the coordinate data will be assigned to their corresponding variables (bow or stern). This process is repeated once more, with the receive flag being turned off in between.

Once this is completed, the Arduino then uses the GPS data from both messages and the set data coordinate of the on-shore antenna and runs them through a trigonometry algorithm that determines the angle the directional antenna needs to rotate. After this, the angle is then translated into stepper motor steps and the motor turns accordingly. Once the motor stops moving, the encoder is then read to determine the motor's position. The reading, which is read in as angular data, is then compared to the calculated angle, and if they do not match, a new angle is calculated to assess the displacement of where the motor is and where it should be. The Arduino will then move the motor again and continue this process of correction until the encoder reading matches the original calculated angle. After this, the receive flag is turned off and the process goes back to the beginning of the main function.

Algorithm
The algorithm to calculate the angle of movement for the directional antenna is based on a series of trigonometric equations and different cases of the barge's position. Using the coordinates of the bow and stern, a line can be created running through both points. Similarly, a line can be drawn from the position of the on-shore antenna to the directional one. For now, we are assuming the directional antenna falls on the barge's reference line and is halfway between the bow and stern points. The angle going from the bow side of the barge reference line to the antenna reference line is the angle we want to determine. From here, we find the angles of the two reference lines, relative to the positive latitude axis, using the slope of the lines. The angle for the directional antenna is then found using one of the 8 different cases (with 6 sub-cases) of the boat's position. The different cases are listed below. It should be noted that for the listing of these cases, θb is the absolute value of the reference angle of the barge line, θa is the absolute value of the reference angle of the antenna line, θt is the calculated angle the directional antenna should move, lat_stern is the latitude position of the stern, lat_bow is the latitude position of the bow, lon_stern is the longitude position of the stern, and lon_bow is the longitude position of the bow.

Once θt has been found, it will be adjusted to account for where the directional antenna currently is. The larger angle will be subtracted from the smaller one, and if the current position angle is larger, then the motor will turn clockwise rather than counter-clockwise. This result is then sent to a function where the angle will be translated into stepper motor steps and then sent out to the motor.

=Team Members=

=Additional Documentation=

Project Schedule

Meeting Minutes

Presentations

Client Meetings