Share this

Pesticide spraying system based on TMS320DM642

2026-04-06 08:00:40 · · #1
Currently, most pesticide spraying machinery relies on manual operation. Sprayers determine the timing, location, and dosage of chemical agents based on experience. However, the acquisition, dissemination, and mastery of mature experience are limited by factors such as years of accumulation, educational level, and media, hindering widespread application and leading to the overuse of agricultural chemicals. Furthermore, the entire pesticide spraying operation involves high labor intensity for operators, who are in direct contact with pesticides, making them highly susceptible to harm. Additionally, manual operation results in low efficiency. The purpose of researching intelligent pesticide spraying systems is to target dryland crops (cotton, wheat, corn) and fruit trees (or roadside trees) with real-time image acquisition of target status. Image processing technology is used to process and analyze these images, making scientific decisions about when and where to apply pesticides and automatically controlling the spraying operation. The working principle of an intelligent pesticide spraying system : An intelligent pesticide spraying system consists of a data acquisition system, a control system, and a machine vision system. The data acquisition and control system mainly includes a data acquisition card, conditioning circuit, liquid storage tank, liquid pump, flow sensor, pressure sensor, speed sensor, overflow valve, proportional pressure reducing valve, spray boom, and nozzle. The system is shown in Figure 1. The liquid storage tank contains the liquid medicine. When the pump starts, the liquid is sprayed out of the nozzle through the overflow pressure regulating valve, pressure sensor, proportional pressure reducing valve, and flow sensor. The flow sensor and speed sensor transmit the liquid flow rate and tractor speed to the computer via the data acquisition card. The computer then adjusts the proportional pressure reducing valve to determine a suitable pressure value. The computer adjusts the overflow pressure regulating valve based on the input from the pressure sensor to ensure that the pressure in the pipeline remains constant. [img=500,174]http://editerupload.eepw.com.cn/200803/8bbb7349ad512819283741907995069b.jpg[/img] The machine vision system uses two CCD video inputs to acquire crop images from two angles. The DM642 processes the image data in real time and sends control signals to the extended I/O of the CPLD based on the processing results to determine whether to spray pesticides. Machine Vision Hardware System Principle The system uses the TI TMS320DM642 chip as the main processor. The TMS320DM642 is a high-performance 32-bit fixed-point DSP specifically designed for digital media applications, with a maximum operating frequency of 720MHz and a processing performance of up to 5760MIPS. Its powerful image processing capabilities provide a strong guarantee for the system's real-time performance and reliability. Hardware Composition The basic hardware block diagram is shown in Figure 2. Here, we briefly introduce the video input and video output sections. [img=352,415]http://editerupload.eepw.com.cn/200803/ff77271d106b36adc3562b0daac87d37.jpg[/img] Video Input Section In order to accurately and comprehensively identify crops, this system collects images of cotton seeds from two different angles for identification. The DM642 has three video ports, each of which can connect two video streams. This system uses the VP2 port as the video input port. The video input end converts the analog signal collected from the camera into CIF (352×288), YUV (4:2:2), ITU-R BT.65 format by TVP5150, and sends the embedded synchronization signal to the VP2 port of the DM642. Figure 3 is a schematic diagram of the hardware connection between TMS320DM642 and TVP5150[2]. [img=357,505]http://editerupload.eepw.com.cn/200803/12eb18a2e1ac5d89bfadbf172984954b.jpg[/img] The system uses the simplest connection circuit, interconnecting the IIC bus interfaces SCL and SDA of both sides, and connecting the video output ports D[0~7] of the TVP5150 to the VP port of the DM642. Since the video stream uses the ITU-R BT.65 format, the horizontal and vertical synchronization signals of the image are embedded in the EAV and SAV time base signals in the video data stream. The video port only needs the video sampling clock and the sampling enable signal (to control the start of sampling). The TVP5150 uses the system clock SCLK to provide the sampling clock and the programmable output pin GPCL to provide the sampling enable. Video Output Section This system extends the video output for local playback. This function can be discontinued after the system debugging is completed. Video output is implemented using Philips' SAA7121. The SAA7121 converts the PC signal transmitted from the DM642 into PAL (50Hz) or NTSC (60Hz) format for external TV output. The principle is shown in Figure 3. This system uses the VP0 port as the video output port. The clock is generated by the TVP5150 as the input clock (VP0CLK0) and the output clock (VP0CLK1) for the SAA7121. When used as a video output port, the video port must provide the SAA7121 with horizontal/vertical synchronization signals, as shown in Figure 3, generated by the three reserved synchronization signals VP0CTL0 and VP0CTL1 on the VP0 port. Software Design Green Segmentation Algorithm Real-time identification of green plants under natural light conditions requires minimizing the impact of brightness on the image and simplifying the processing to reduce processing time. Therefore, an improved green identification method is used to process the image. Its principle is based on whether the proportion of the green component value to the brightness value reaches a threshold. The calculation method is as follows: (1) Since the acquired signal is YCbCr, the green signal G in the RGB color space is calculated according to the values ​​of Y, Cb and Cr of the pixel: G=Y-0.34414*(Cb-128)-0.71414*(Cr-128) (2) The ratio of green component to brightness is calculated according to the following formula: E=G/(Y+0.1) (Adding 0.1 is to prevent Y from being 0 when the pixel is black (0,0,0), and the result overflows) Determine whether E is greater than the threshold. If it is greater than the threshold, it is judged as green; otherwise, it is not green. The threshold is mainly determined by experiment. In the experiment, multiple photos of green plants with different shades under different lighting conditions are selected, and cross-shaped templates are selected at different positions of the plants in the photos to measure their E values. A cross-shaped template refers to selecting a pixel and taking a point above, below, left and right of it, forming a cross-shaped template with a total of 5 points. Then, the average value of these five pixels is taken as the experimental data. The 100 measured data constitute the IE distribution map. As shown in Figure 4, it can be seen that under different brightness, whether it is dark green or light green, the E value is greater than 1.05 97% of the time. Therefore, we determined the threshold to be 1.05. The binarization result is shown in Figure 5. Then, the obtained binary image is processed by median filtering and opening operation in mathematical morphology to remove the speckle noise in the image and fill the small holes generated during the processing [6]. Finally, the ratio of the plant area in the image to the area of ​​the entire sampled image is calculated and compared with the threshold K to determine whether to spray pesticide. [img=291,192]http://editerupload.eepw.com.cn/200803/8a92c93f8f1da49f005e61466a35e879.jpg[/img] Software framework based on DSP/BIOS The system adopts CCS and DSP/BIOS, as well as the DSP software architecture RF5 advocated by TI. The software system is divided into input, processing, output and other modules. The process is shown in Figure 3. The input module writes the image acquired by the VP port into designated memory and sends a message to the processing module. The message structure stores the starting address of the memory space where the image data is located. The input module then waits for a reply from the output module to continue acquiring the next frame of image. The processing module is responsible for executing the recognition algorithm. It extracts the image data address from the message structure sent by the input module for image algorithm processing, and finally sends a message to the output module. Simultaneously, it sends a signal to the PLC controller based on the image processing result and continues to wait for a message from the input module. The output module outputs the original image to the LCD for display, and then sends a message to the input module to continue acquiring the next frame of image. At this time, the output module waits for a message from the processing module, and the thread is in a suspended state. Code Optimization The program is mainly written in C, so the quality of C language optimization directly affects program efficiency. The program extensively uses space-for-time tradeoffs to improve code execution efficiency, such as splitting multiple loops into single loops, which increases the amount of code but achieves software pipelining; using static inline functions for frequently used or simple functions as much as possible, or using the -pm -oe options during program compilation. Inline functions do not require stack push and pop operations when called; instead, the expanded code is directly inserted, thus improving execution speed. In addition to the above, the program also uses bit shifting instead of multiplication and division, and table lookup instead of floating-point arithmetic as much as possible. Experiments and Summary To verify the feasibility of the system's image recognition algorithm, experiments were conducted on the SEED-VPM642 development board. Figures 7a-c are a set of plant images collected in a natural environment, with a size of 400x320. Figures 8a-c are the final images after binarization and processing of the corresponding images in Figure 7 using the green component segmentation algorithm. Table 1 shows that when the tractor travels at a speed of 0.5 meters per second, the system's recognition accuracy is almost 100%. When traveling at a speed of 1 m/s, its accuracy is only about 60%. The longest single detection time is 37 ms, basically meeting the real-time requirements. Experimental results show that the machine vision-based intelligent sprayer system, using the green component segmentation method, can correctly identify and spray plants during the spraying period. The processing method is simple and meets the system's real-time requirements. [img=500,525]http://editerupload.eepw.com.cn/200803/90c863fceeb2ad619e314eb31349a4f3.jpg[/img] References : 1. Research on Image Processing and Automatic Control Technology in Pesticide Sprayers, by An Yongsheng, March 2004 2. Principles and Applications of TMS320C6000 Series DSPs (2nd Edition), by Li Fanghui, Electronic Industry Press, January 2003 3. SEED-VPM642 User Guide (Rev. B), by Hezhongda, April 2005 4. TMS320C64x Image/Video Processing Library Programmer's Reference (Rev. B), TI, October 2003 5. TMS320C6000 DSP/BIOS Application Programming Interface (API) Reference Guide, TI, December 2001 6. Image Processing and Analysis—Mathematical Morphological Methods and Applications, by Cui Yi, Science Press, 2000.
Read next

Analysis: Latest Developments in Automotive Drive Belt Technology

Automotive drive belts are crucial components of car engines and an integral part of the transmission belt system. Many ...

Articles 2026-02-22