/UAV-soil-moisture-robot

This repository contains the original data from the field trial and the programs used to get the data and operate the robot.

Primary LanguageC++GNU General Public License v3.0GPL-3.0

Aerial-robot-field-trial-original-data-and-programs-used

This repository contains the original data from the field trial for both the versions and the programs used to get the data and operate the robot in the final version in detail. Clayton_8_10_21, lake_wheeler 11_11_21, and page_farms_12_1_21 contain the field data from the previous version of the payload tested in North Carolina. 7_24_2023_trial and 8_2_2023_trial contain the field data from the final version of the payload. The gyro data folder contains the accelerometer and height sensor data, the soil moisture data consists of .txt files per replicate, and the lift data contains the linear potentiometer data during sensor insertion. The proof of Version 1.0 in the field is available at https://usu.box.com/s/d43i25aqygvpziy9pooad7j2ewmewl4t. The proof of Version 2.0 is available at https://usu.box.com/s/jot3v8w00x1oojy457q8avlsvsdaxmna.

A simplified overview of the project is a soil moisture payload was developed and mounted on a UAV. The payload should measure soil moisture at three locations upon landing and inform the UAV to fly to the next location autonomously. MyRIO was used for controlling the movements of linear motor sliders and saving the measured data in its internal memory. MyRIO was also used to power the Arduino Mega using the USB connection. The system architecture design is shown in the below figure. image

The LabVIEW program developed in version LabVIEW 19.0, contains the state machine logic that was used to control the sensor insertion, move the sensor, and record soil moisture data. The logic workflow in LabVIEW is explained in detail in the below figure. The gyro_check_1.vi was used as the default state; this will determine whether the UAV is stationary. If this state is passed, the height_sensor_equation_check.vi and linear_motor_slider_vertical.vi were used to check if the sensor insertion was complete and to insert the sensor into the soil, respectively. If this state is passed, the UART_SDI_12_wave_collection.vi was used to communicate with Arduino Mega, where the TDR 305N was connected. Three soil moisture readings are obtained, followed by the TDR waveform data, and are sent to myRIO and stored in a .txt file. Once the .txt file is saved successfully, linear_motor_slider_vertical_upwards.vi is used to remove the sensor from the soil. Then, linear_motor_slider_control.vi is used to slide the sensor by 5 cm. The sequence is repeated until the third replicate measurement. At the end of the third replicate measurement at every location, linear_motor_slider_horizontal_to_home_.vi is used to move the sensor back to the home position. image

The Arduino program was used to measure soil moisture, send it to myRIO, and upload new flight plans so that the UAV could fly to the next location. SDI-12 library was used to get soil moisture data and TDR waveform data. The sensor address was 3. The power data pin was connected to the Arduino Mega Digital pin (11). The UART 1 ports were connected to myRIO UART ports to establish the novel two-way communication. The waveform data was obtained from 1995 to 6000 picoseconds. The GPS coordinates of the interested measurement locations are already loaded as a global variable in the program. The Arduino program waits for the string "1" from myRIO. Once the string is received, three soil moisture measurements are carried out using 3D0! command. The myRIO keeps track of the number of 3D0! received on its end and stops sending the string "1" at the end of three 3D0! received. Arduino keeps track of the number of soil moisture measurements. At the end of the 9th soil moisture measurement, GPS coordinates are requested to the CUBE Orange flight controller using the mavlink(v1.0) library. Once the GPS coordinates are received, the flight mode is changed to POSHOLD, the home location, followed by take-off action and landing action with the correct GPS coordinates, which are loaded to the CUBE Orange flight controller, and the flight mode is changed to AUTO, and the UAV is armed by the Arduino program.

The field_data_to_usable_data.R R program was used to post-process the data and get tabulated forms of soil moisture data with the respective GPS coordinates. The correct folder consisting of soil moisture .txt files should be provided. The program will export three .csv files one for soil moisture, another for travel time, and for TDR waveform amplitude data.

The timed_loop_SDI_12.vi was used in Version 1.0 to perform communication with the sensor directly from NI-myRIO using LabVIEW. It is a novel program where the SDI-12 protocol was successfully implemented with the software.