# Image-Based Gimbal Control in a Drone for Centering Photovoltaic Modules in a Thermal Image +
## 4 Gimbal Control Experiment  
In order to verify the validity of the developed system, we conducted an experimental test as shown Figure 11. Our system consists of a drone system with a gimbal, GCS with dual camera, experiment panel with photo of PV module, and remote display. The experiment process is as follows:  
* Produce the PWM signal correctly in the GCS and observe the transmission to the GCB. * Calculate the center value and horizontal angle of the PV module by image processing. * Analyze the gimbal control and tracking convergence according to changes in target vertical-position and target horizontal-angle. Firstly, we confirmed whether the PWM signal was well generated by the main controller and transmitted to the GCB. As shown in Figure 12, the PWM waveform period was confirmed to be stably generated at 18 ms, and the width value was changed according to the position. Also, we confirmed that the gimbal's BLDC motor rotated properly by generating the PWM signal. Figure 10: Implementation of image processing. Secondly, we extracted the central and horizontal angle values of the PV module from the image. Figure 13 shows one sample case for the image processing process. The image obtained through the image processing process, the PV module region extraction image, the binarization image, the hop transform image, and the overall result derivation image were sequentially displayed. We acquired a visible image and extracted the area of PV using the inRange function. The HSV range of the inRange function is 80 to 140 for hue, 65 to 255 for saturation, and 65 to 255 for brightness. To find the module's center position, we binarized it with a threshold of 50 gray-value and find the boundary using the contours function. We use the Hough function with a threshold of 250 gray-value to find the PV module's horizontal line. Figure 14 shows various angle and center point extraction experiments with  
Figure 14: _Cont._ \begin{table}
\begin{tabular}{c c c c c c c c} \hline \hline
**Case No.** & **(a)** & **(b)** & **(c)** & **(d)** & **(e)** & **(f)** & **(g)** \\ \hline Horizontal angle [degree] & 20.0 & 6.0 & \(-14.0\) & \(-26.6\) & \(-43.2\) & \(19.0\) & \(-1.0\) \\ Ground truth & 20.0 & 7.0 & \(-15.0\) & \(-34.0\) & \(-44.0\) & \(20\) & \(-1.0\) \\ Error & 0 & \(-1\) & \(-1\) & \(-7.4\) & \(-0.8\) & \(-1\) & \(0\) \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Experiment result for horizontal angle cases. Figure 13: Experiment result image processing: (**a**) original image from visible camera; (**b**) extracting the area of PV (Inrange function); (**c**) binarized image from image (**b**) with threshold of 50 gray-value; (**d**) binarized image from image (**b**) with threshold of 250 gray-value; (**e**) converted value from the Hough function; (**f**) center position of module from image (**c**). In the experiment, we tested whether the tilt and roll were corrected to the target position and angle when the center position and horizontal position of the target PV module were randomly changed. As shown in Figure 15, the tilt correction result shows that the vertical angle of the gimbal is adjusted to the target position when the center position of the target PV module changes to 200, 400, 100, and 350. At this time, the tilt correction error is about 6 pixels, and the PV module seen from the drone camera is positioned at the center. As shown in Figure 16, when the horizontal angle of the target PV module was changed to 43, -75, 10, and 70 degrees, the roll rotated to approximate each horizontal angle. At this time, the roll correction error was around 3 degrees, and the PV module seen by the drone camera was aligned horizontally. Through this, the ROI of the PV module is located at the center, and it is confirmed that the proper image is taken in real-time.