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 four components: a 5V AC-DC Power Rectifier/Supply, an ATXRaspi Power relay, a momentary control switch, and an XL6009 boost converter. This subsystem is responsible for controlling and supplying power to the system components, including the RaspberryPi and the stepper motor.



For the power supply itself, I selected a universal KFD 5V power supply. I chose this model for it's wide variety of applications, including the RaspberryPi specifically. It also is intended for outdoor use if desired, and has a stout current rating of 4A needed for our our power demands. The system components combined in total could consume 20W of power at maximum output, which is the maximum output of this power supply. Luckily our system will not be running at maximum output, and this power supply will sufficiently provide the ATXRaspi with enough power to run the RaspberryPi and the stepper motor.

The ATXRaspi was an easy decision for this project, as it is designed specifically for RaspberryPi applications using a momentary switch. This relay takes in a 5V DC input utilizing a 2.1mm DC jack, and allows the user to power on, off, reboot, and force a shutdown using the pushbutton switch. The relay initiates these functions based on the users button press, displays its status using the LED, and communicates/controls the RaspberryPi through two input/output signals and a provided shutdown script. The model we are using also includes a USB A output port, which allows us to use the preferred method of powering our RaspberryPi, via USB C connection. The ATXRaspi also features an additional 5V output, which is used to supply the stepper motor driver.

I selected a reliable momentary actuation ON/OFF switch, with a clear blue LED indicator to show the system is powered on. This switch is rugged and waterproof, and the built in LED can connect directly to the ATXRaspi LED status pins to reflect what the system is doing.

Lastly I had to implement a boost converter to compensate for the input voltage discrepancies between the stepper motor, and the stepper motor driver. While the motor itself only operates on 5V, the driver requires 8-35V. With no change in power requirements, a simple variable boost converter takes the 5V input from the ATXRaspi and steps up the voltage input for the stepper motor driver. I chose the XL6009 because it has a hefty output current rating of 4A, which will be more than sufficient if powering our stepper motor, which is rated for a maximum of 2.5A at 5VDC. Reusing one of the extra heat sinks provided with the drivers will also ensure the converter does not overheat.

Below you can see further specifications on each part:

Cicruit


The circuit diagram above shows the wiring schematic of the power system design, including how the four components will be connected together, as well as to the rest of the system. The diagram includes all the input/output voltages for each component, and other important ratings essential to functionality.

At this point the power system is assembled, lightly tested, and functional, but not finished. It was assembled using cheaper connections and wires for testing purposes, but certain points like the current carrying line to the boost converter will be reinforced with sturdier wire, and directly soldered connections to improve durability and longevity. This is critical as the stepper motor/driver will easily consume the most power in our design.

There are also a few more steps to be taken in order to make this system a plug and play installation for the navy. This will include extending the power supply cable to a suitable length, and integrating port connectors into the housing. DC extension cables are common, with male/female DC 2.1mm ends that will mate directly with our existing connections.

Port in/out connections will need to be completely waterproof, as these will be the only orifices in our housing, and will make or break our unit's environmental performance. A company called CNLinko manufactures several different series of high-quality industrial waterproof connectors. We will need a few different ports between power and communications, but this company will be able to meet our needs as their products range from ethernet RJ45 ethernet connectors, to universal power/signal connectors ranging from 2-8pins. Once I finalize the necessary connections we will need to make, which depends on the control system and the antenna, I can select the exact connectors we need. These all include mounting dimensions, which can be incorporated into our housing model.

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