Computer-Controlled Chemical Sprayer

University of Kentucky Computer Science

Senior Design

Spring 2005


Computer-Controlled Chemical Sprayer

Table of Contents

  1. Personnel 3
  2. Disclaimer 3
  3. Abstract 3
  4. Introduction 3
  5. Problem Description 4
  6. Specifications 4

A) Overview of the Project

B) Steps for each Iteration

C) Interface

  1. Planning 5

A) Context and Scope of the Project

B) Effort and Size Estimation

C) Schedule and Milestones

D) Platforms, Tools, Languages

  1. Design 6

A) Project Description Overview

B) Environment

C) Primary Module Descriptions and Data Flow

D) Screenshots

E)  User Scenarios

F)  Desired Considerations

G) Specific Documentation and Instructions

  1. Implementation 11

A) Results of Code Review

B) Problems During Implementation

C) Restrictions

D) Test Plan and Results

  1. Future Enhancements/Maintenance 12
  2. Conclusions 12
  3. References 12
  4. User's Manual and Installation Guide 12

A) Loading a Map

B) Running a GPS Simulation

C) Beginning a Spray Session

D) Testing Nozzles


I. Personnel

·  Sharfaraz Husain

·  Nicholas Pendley

·  Brian Raney

Computer Science Senior Design

University of Kentucky

April 29, 2005

II. Disclaimer

This project has been designed and implemented as a part of the requirements for CS-499 Senior Design Project for Spring 2005 semester.

While the authors make every effort to deliver a high quality product, we do not guarantee that our products are free from defects.

Our software is provided "as is," and you use the software at your own risk.

We make no warranties as to performance, merchantability, fitness for a particular purpose, or any other warranties whether expressed or implied.

No oral or written communication from or information provided by the authors

or the University of Kentucky shall create a warranty.

Under no circumstances shall the authors or the University

of Kentucky be liable for direct, indirect, special, incidental,

or consequential damages resulting from the use, misuse, or inability

to use this software, even if the authors or the University

of Kentucky have been advised of the possibility of such damages.

III. Abstract

The goal of this project is to develop a control system for agricultural chemical sprayers that determines when nozzles should be activated based on the comparison of a global positions system and a digital map. This will automate the process of spraying chemicals or water in agricultural or turf management settings, providing efficiency and decreasing manual labor and training time.

IV. Introduction

The goal of the project is to develop a control system to automate spray in agriculture and turf settings. Currently, laborers are required to manually switch spray nozzles on or off. Aside from being required to manually switch nozzles on and off, there is no individual nozzle control – either all nozzles are activated or none are activated. A solution would automate this process so that the user would be responsible for navigating the vehicle, but not for managing the nozzles.

V. Problem Description

The advantage of having an automated sprayer system would be the benefit for the employees in agriculture or turf maintenance jobs. Such a system would allow for an operator to run the sprayer with less knowledge the spray areas and spray operation. Additionally, it would allow the user to spend less time managing the sprayers.

This system could be used in many agriculture settings – in any situation in which there is a crop that needs to be sprayed with either chemicals or water. Also, businesses for whom turf management is essential, such as golf courses, would benefit from an automated sprayer system.

The problems associated with this project lie in three categories: determining current location, comparing current location to a pre-defined spray area, and activating sprayer nozzles.

VI. Specifications

A. Overview of the Project

The system should use a Global Position System (GPS) technology to determine when spray nozzles should be activated. It will make this determination by comparing the current location to a stored digital map of the spray area. The nozzles will function independently, with each nozzle turning on when it enters the spray area. There will be one GPS device located on the center of the sprayer's boom. There will be spray nozzles located ten inches to the left and right of the device, and thirty inches to the left and right of the device. The GPS will feed data to a notebook computer via an RS-232 cable. The sprayer nozzles will be networked together with a Controller Area Network (CAN). This CAN will be provided by the customer, and it will be manipulated via a signal from the notebook computer over an RS-232 cable.

B. Steps for each Iteration

1. Read in GPS coordinates from tractor (via RS-232 communication port).

2. Take one current GPS reading and calculate all (four) nozzle positions.

·  determine direction tractor is traveling based on previous GPS reading.

·  account for delay in nozzle device.

3. Compare each individual nozzle position with target map.

4. Send signal back to nozzles (via RS-232 communication port):

·  If position is inside desired boundary on target map, then send signal for nozzle to spray.

·  If position is outside desired boundary on target map, then send signal for nozzle to turn off.

Note: Frequency of iterations may be as high as 10 cycles per second (Hz).

C. Interface

The user should be able to use a graphical user interface to:

·  Select and load an ArcMap map file to define the spray areas

·  Start/stop sprayer control

·  Test individual sprayer nozzles

VII. Planning

A. Context and Scope of the Project

Despite being part of a larger project which involved mechanical and electrical engineering elements, the scope of our project lies withing the realm of software development. Our project customers, the agriculture team, are responsible for the design of the project beyond the point where our software sends a message via RS-232 designating which nozzles to activate and deactivate.

B. Effort and Size Estimation

As the team grew familiar with the ArcGIS applications and libraries, it learned that the project would be less code intensive (because of the vast library of functions provided by ArcGIS) and more work would be required in gaining familiarity with the libraries. This ultimately proved to be true.

C. Schedule and Milestones

February 10 Team Web Site Due

February 18 Receive sample target maps from Agriculture Team

February 24 Begin familiarizing team with ArcGIS and how to use it with Visual Studio.NET

February 25 Screen shots/user Interface

March 1 Project Design

March 3 Agriculture Team Adviser

March 4 Begin Programming / Documentation

March 7 Receive delay time of mechanical elements from Agriculture Team

March 21-25 Begin testing

March 21-25 Prototype Due to Agriculture Team

April 1-2 Receive feedback from Agriculture Team

April 3 Debug and correct errors

April 21 Final Project Presentations to Class

May 5 Final Project Presentation to Professor

D. Platforms, Tools, Languages

The program should run with a graphical user interface that is easy to understand for anyone familiar with the project. There is no platform requirement, Windows is suggested so that the ArcGIS suite of applications may be used. ArcGIS is a suite of geoinformation systems applications which would be useful in completing this project.

Regardless of the platform, the application should run on a notebook computer.

If the ArcGIS suite of applications is used, input provided to the program by the user will be a map file in .mxd format, which is a format readable by the application ArcMap. If the ArcGIS suite is not used, the map will be provided in the National Marine Electronics Association (NMEA) standard format for GPS coordinates.

If Windows is the platform selected, the development environment will be Microsoft Visual Studio.NET, and one of the .NET languages will be selected. Otherwise the language and development environment will be selected based on the platform and past experience of the team members.

VIII. Design

A. Project Description Overview

The goal of the project is to develop a control system to automate spray in agriculture and turf settings. The control system uses GPS to communicate with a computer program on a remote device that determines if individual components (nozzles) on a boom should be spraying or not. The GPS device is to be located on the center of the boom, and the data will be sent to the computer program in periodic iterations. During each iteration the program must calculate the location of each nozzle and whether or not the nozzle is inside the target map.

Steps for each iteration

  1. Read in GPS coordinates from transmitter on tractor (via RS-232 communication port).
  2. Take one current GPS reading and calculate all (four) nozzle positions.

o  Each nozzle is 20 inches apart, centered on the middle of the tractor. Therefore a nozzle will be located at 10 and 30 inches in each direction on the boom.

o  Determine direction the GPS device is moving.

  1. Compare each individual nozzle position with target map.
  2. Send signal back to CAN Device on nozzles (via RS-232 communication port):

o  If position is inside desired boundary on target map, then send signal for nozzle to spray. If position is outside desired boundary on target map, then send signal for nozzle to turn off.

* Iterations may be up to 10 cycles per second (10 Hz).

B. Environment

The program has been developed to run on a Windows based PC/Laptop. The programming environment to be used is Visual Studio (using C++). Visual Studio has the ability to communicate with ArcGIS objects. ArcGIS is the tool that the users will use to design the prescription map (target map). Using Visual Studio meets needs of the customer as well as incorporating the team's previous expertise of programming in C++.

The PC/Laptop will require either multiple RS-232 communication ports or a RS-232 hub/splitter to accommodate both the input and output RS-232 connections.

C. Primary Module Descriptions and Data Flow

The program allows the user to start and stop functionality. The program allows the user to load the desired prescription map (target map) and setup input/output connections. It also allows the user to test the individual nozzles by simply sending a "Sprayer On" signal to each nozzle.

·  Load Prescription Map - Receives the prescription map from the user. The prescription map will be the target map that the user wishes to spray. This function will receive GPS coordinates that can be referenced later.

·  Setup Connections – These functions allow the user to configure the input/output COM port connections. The input connection is used for the GPS device and the output connection is used for the Sprayer System.

·  Get current GPS coordinates - This function will receive the current GPS coordinates in NMEA form from the RS-232 communications port at a rate of up to 10 Hz. This function will also be responsible for determining the direction that the tractor is moving. If the tractor is determined to be idle (not moving at all), then the program will not move onto the next step.

·  Calculate nozzle locations and determine spray signals - Using the GPS coordinates that were received; this function will calculate the exact locations of the four nozzles. Each nozzle is spaced 20 inches apart and is centered on the middle of the boom. Combining the direction that the tractor is moving with the GPS coordinates received, this function will be able to determine the actual coordinates of each nozzle. After calculating the nozzle locations this function will determine the spray signals to send to each nozzle. Using the geometric segments previously created, this function will compare each nozzle location with each geometric segment from the target map. If a nozzle is inside a geometric segment, the nozzle will be sent a "Sprayer On" signal. If it is not inside any of the geometric segments, the nozzle will be sent a "Sprayer Off" signal. The signal sent to the nozzles will be sent via another RS-232 connection in another function.

For all Nozzles
Calculate Nozzle[i] location
If Nozzle[i] location is inside target map
Nozzle[i].spray = "Sprayer On"
Else
Nozzle[i].spray = "Sprayer Off"
Next

·  Send signals to nozzle (clean this one up) - This function will be responsible for sending the nozzle signals to each nozzle. The signals will be sent via a RS-232 connection to a CAN-bus (Controller Area Network) system which will be hooked up to each nozzle.

Most modules are triggered every time the GPS position changes, causing them to run the entire time the tractor is moving. Below is a flowchart that illustrates the flow of the Sprayer Control Program.


D. Screenshots

Screenshot for the main window of the program

This is the main interface. It allows the user to setup the connections, load a shape file, start/stop the sprayer system, and view the nozzle activity. This interface shows the nozzles operating, checked if the nozzles are on and unchecked if the nozzles are off. The console output shows the output being sent to the sprayer system through the COM port. The longitude and latitude fields show the current coordinates of the GPS device.


Screenshot for the GPS connection settings

The following snapshot shows the connection interface of the program. It allows the user to choose between com ports 1-4, change the baud rate (recommended at 9200), no parity and stop bit at 1. The user can click on the test connection button to test the connection between the program and the hardware device connected.

Screenshot for the nozzle serial connection settings

The final screenshot is the outgoing interface setup. This interface displays the outgoing data to the com port ( choose from port 4 and 5). The user can open the COM port and test the port.

E. User Scenarios

1. The primary user scenario will be to use the program in the following steps: