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 longitude/latitude coordinate of the bow of the barge as well as the barge's 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) and is also calculated counter-clockwise.

Next, the microcontroller interfaces with a stepper motor to move the motor to the calculated angle position. The mounting rod of the directional antenna will be connected to the shaft of the stepper motor, therefore rotating itself as the motor turns. To ensure the stepper motor moved to the correct position this system will need to be closed loop. An encoder reading the movement of the stepper motor would satisfy this requirement. If the encoder finds that the motor did not move the appropriate amount, then a process will run until the motor is deemed in the correct position. With this closed loop process finished, the system will save the new angle to be used for comparison of the new calculated angle on the next iteration of the system's process. This process will run continually until the system is shutdown.

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 will also be used to keep wind and rain from affecting the position of our antenna.

The second is thermal management of the electronic components. 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. A mirror and heatsinks may be necessary if the heat cannot dissipate fast enough.

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. Snowboard buckles and straps will be used to fasten the 80/20 profile to the hand railing. This can be seen in the picture to the right.

The clear cylinder that the antenna is visible through is acrylic while the baseplate and circular cover are PVC sheets. The lower cylinder is 3D-printed carbon fiber reinforced plastic. The mounting below is an aluminum 80/20 profile.

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 should 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 activate the secondary relay, responsible for switching power to 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.

The RaspberryPi is the maximum load that the ATXRaspi is designed to handle, so I decided to wire it and the stepper motor driver in parallel. This however would cause the driver to be on whenever our device is plugged in, which is undesirable. Consequently I implemented a 5V relay to switch power to the stepper driver. As stated before, this relay is activated by the additional 5V output on the ATXRaspi, and only draws 5mA of current away from the RaspberryPi. The driver is connected on the positive line directly to the power supply via a boost converter, but the connection is only grounded once this secondary relay is activated upon powerup of the ATXRaspi.

Lastly I had to implement a boost converter to compensate for the input voltage discrepancies between the stepper motor, and the new CL57T stepper motor driver. While the motor itself only operates on 5V, the driver requires 24-48VDC. Since we were using the same motor/encoder, I retained the use of 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 XL6009E1 because it has a hefty output current rating of 4A, which should 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:

Circuit


The circuit diagram above shows the wiring schematic of the power system design, including how the five components will be connected together, as well as to the rest of the system. The diagram also includes arrows indicating power flow when the system is switched on using the momentary button

At this point the power system is assembled, but upon interfacing we found that the driver would not respond to PWM signals from the RaspberryPi. We contacted the manufacturer for insight on this issue, and found that the driver itself had much higher power requirements than anticipated that were not covered in the datasheet. The driver itself requires 24-48VDC as specified, but the manufacture told us additionally that it required a minimum of 6A current, equating to a 216W power supply at 36V. We made this discovery with too little time left in our semester to address it in our design, but we recommend to future teams to provided the stepper motor with its own power supply of minimum 216W. This would also require a separate housing for this secondary power supply, as a power supply of that size would not fit in the current housing. This secondary supply could be connected to the driver in the same way as our design reflects through the 5V relay, which is rated for a 300W maximum load.

Plug and Play
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. AC extension cables are common, and will allow us to transmit DC power over a very short distance and therefor minimize voltage drop to control system components. Sample images of these connectors can be seen below:

Port in/out connections will need to be completely waterproof, as these will be four of the few 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, all rated with at least IP65 waterproof protection level for our application. We needed four different ports between power and communications, all of which were addressed by this companies products. The connectors are ported through the bottom baseplate of our housing. The table and figure below reflects the four connectors we used as well as their pin designations, and destinations.

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 first 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, though the driver could move the motor appropriately, reading the encoder from the microcontroller turned out to be unreliable after multiple tests revealed the encoder readings were not consistent. Inconsistent readings would lead to the high probability of step error which would ruin the whole control system process. Thus, we eventually found that STEPPERONLINE supplied a series of closed-loop motor drivers, and so we changed our motor driver to be STEPPERONLNINE's CL57T Closed-Loop Motor Driver. This device would not only be able to handle the encoder readings well but would also run the whole closed-loop aspect of the design itself and could also allow the motor to be microstepped down to 1/280th of a step (0.00703°). So, for our final design, we chose the CL57T driver to be our motor's driver.

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 utilizing serial communication. 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