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=

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 GGA, HDT, and RMC GPS messages which will contain the coordinate of the bow of the barge as well as its True North heading. 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 motor, 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 system will wait for another GPS message to be read in and the whole process is repeated.

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

Housing


There are three aspects of the housing that are important to the final design.

The first is water resistance. The antenna will be mounted to the top of a barge on a lake, so exposure to the elements will be a threat to the electronics of our design. The housing must be able to keep water out from waves, storms, and high humidity. Rubber lining around the access ports of our housing to ensure a sealed environment is a possibility. A barrier around the antenna has also been postulated to keep wind and rain from affecting the position of our antenna.

The second is thermal management of the electronics. The stepper motor and power relay will be creating varying levels of Joule heat (heat shed from electronics) based on the level of control at a given point. In order to make sure the electronics don't overheat, analysis and measurements will be taken to ensure the heat can dissipate before damage occurs.

The third is a firm mounting to the hand railing of the barge. This is vital due to the nature of our control system. Calibration of our rotary encoder will be made to know what position it has to move to in order to point to the onshore antenna. If the mount that the rotary encoder sits on were to move, then this calibration would be off and it would point in the wrong direction, even though our control system would be working perfectly fine. A buckle-like strap will be used to provide a snug fit against the hand railing of the barge. This can be seen in the picture to the right.

The material that the housing will be made out of is fiberglass. This is due to its easy manipulation, fabrication, and price. Parts will be 3D printed and fiberglass will be overlaid. The 3D part will be removed and the fiberglass will be left.

Parts
The power supply system is made up of three components: a 9VDC Power Rectifier/Supply, a 9V PCB Relay, and a control ON/OFF switch.



For the power supply itself, I selected a Meanwell Industrial 9VDC Power Supply. I chose this model because of its impressive operating temperature range and rugged design.

The relay I chose was a miniature PCB version, so that we could put the relay inside our enclosure without worrying about not having enough space for it. I found a model rated for 9VDC input voltage, with an operating voltage of 6.3 volts which matches the output voltage coming from the power supply.

Last I selected a reliable momentary actuation ON/OFF switch, with a clear blue LED indicator to show the system is powered on. Below you can see further specifications on each part.

Circuit


The circuit diagram above shows the wiring schematic of the power system, including how the three components will be connected together as well as to the rest of the system. This screenshot also shows a live simulation, showing that the relay and switch will not impact the output voltage, which reads 9 volts on the output pin of the relay.

The remaining task for the power system is to build it, which depends on the distance from the power panel on the barge to where the antenna will be mounted. I plan on using the picture of the barge that our client has provided us to estimate the maximum length our power supply cord will need to be. From there I will cut the power supply, and extend it using high grade wire, along with adding connectors to the end of wires that can be connected to the switch and relay terminals. This should provide the easiest installation experience when the product is delivered to the client.

Parts
For the stepper motor, we elected to use STEPPERONLINE's Closed Loop NEMA 17 Bipolar Stepper Motor. This device is a combination of a stepper motor and a rotary encoder. The motor has a default step angle of 1.8° with a holding torque of 59Ncm (84oz.in). The resolution of the encoder is 1000CPR, which correlates to approximately a resolution of 1.44°.

We needed a motor driver to interface between the stepper motor and the microcontroller so we opted to use the HitLetgo A4988 driver. Using this driver enabled us to determine how many steps the motor should move and in what direction (CW or CCW). This driver also allows for microstepping down to a sixteenth of a step, allowing for 0.1125° per step (however, this would be restricted due to the resolution of the encoder).

When choosing a microcontroller, we initially 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. Unfortunately, when trying to run tests for our angle calculation algorithm, we learned that the Arduino does not use float data types and therefore is very restricted on how many significant figures would be allowed. Since we were dealing with GPS messages that would have data points where there would be 9+ significant digits after the decimal, we needed a microcontroller that would work with such numbers. Thus, we ended up using the Raspberry Pi 4 Model B. This device was able to use the float data type and also already had libraries that allowed for interfacing between a stepper motor, an encoder, and a serial communication device. In addition, Raspberries use the Python coding language, which we were even more familiar with.

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 takes place. Below describes the process of the code.

After initializing the system, the first part of the process is to read in the GPS message. Once it has been read, the GPS message is then parsed and the bow's GPS coordinates and the barge's true North heading are extracted and returned to the main function.

Once this is completed, the Raspberry selects the GPS data 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. The angle will always be calculated relative to the bow of the barge and in the CCW direction. After this, the angle is then translated into stepper motor steps, those steps are then outputted to the A4988, and the motor turns accordingly. Once the motor stops moving, the encoder is then read to determine the motor's position. The encoder's reading, which is the number of steps the motor moved, is then compared to the calculated angle, and if the motor's angle is not within a 5% error relative to the calculated angle, a new angle is calculated to assess the displacement of where the motor is and where it should be. The Raspberry will then move the motor again and continue this process of correction until the 5% error is achieved. Once this is completed, the control system will proceed to repeat the entire process. The code will run continuously until the system is powered off.

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 true North heading, a line can be created running through the barge, from the bow to the stern. Similarly, a line can be drawn from the on-shore antenna to the directional one. The bow's GPS receiver is very close to the directional antenna, so the bow's coordinate will be treated as the directional antenna's. The angle going from the bow side of the barge reference line to the antenna reference line is the angle we want to determine. This angle will be calculated CCW relative to the bow. Next, 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 2 different cases. The different cases are listed below. It should be noted that θ1 is the angle between the latitude axis and the barge's reference line and θ2 is the angle between the latitude axis and the antenna reference line.

Once the angle has been calculated, the angle will then be converted to stepper motor steps. One issue we have to account for is to not tangle the directional antenna's cord around its mounting rod. To account for this, if the angle is greater than 180° then the motor will move in the CW direction and the angle is then subtracted from 360°. The motor steps are then outputted to the motor.

=Team Members=

=Additional Documentation=

Project Schedule https://vandalsuidaho-my.sharepoint.com/:x:/r/personal/haen3244_vandals_uidaho_edu/Documents/Sea%20Scanners/Team%20Documents/Project%20Management/ProjectSchedule1.xlsx?d=w952118ef20874842ba3bb40f16c0369c&csf=1&web=1&e=ckltoy

Meeting Minutes https://vandalsuidaho-my.sharepoint.com/:f:/r/personal/haen3244_vandals_uidaho_edu/Documents/Sea%20Scanners/Team%20Documents/Project%20Management/Instructor%20Meeting%20Documents?csf=1&web=1&e=3YySU6

Presentations https://vandalsuidaho-my.sharepoint.com/:f:/r/personal/haen3244_vandals_uidaho_edu/Documents/Sea%20Scanners/Team%20Documents/Project%20Learning?csf=1&web=1&e=trB1rK