Next Article in Journal
Integrating Satellite and UAV Technologies for Maize Plant Height Estimation Using Advanced Machine Learning
Previous Article in Journal
Coffee Growing with Remotely Piloted Aircraft System: Bibliometric Review
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Technical Note

Cotton Gin Stand Machine-Vision Inspection and Removal System for Plastic Contamination: Hand Intrusion Sensor Design

1
Agricultural Research Services, Cotton Production, and Processing Research Unit, United States Department of Agriculture, Lubbock, TX 79403, USA
2
Cotton Incorporated, Cary, NC 27513, USA
*
Author to whom correspondence should be addressed.
AgriEngineering 2024, 6(1), 1-19; https://doi.org/10.3390/agriengineering6010001
Submission received: 29 August 2023 / Revised: 14 November 2023 / Accepted: 11 December 2023 / Published: 22 December 2023

Abstract

:
Plastic contamination in cotton lint poses significant challenges to the U.S. cotton industry, with plastic wrap from John Deere round module harvesters being a primary contaminant. Despite efforts to manually remove this plastic during module unwrapping, some inevitably enters the cotton gin’s processing system. To address this, a machine-vision detection and removal system has been developed. This system uses inexpensive color cameras to identify plastic on the gin stand feeder apron, triggering a mechanism that expels the plastic from the cotton stream. However, the system, composed of 30–50 Linux-based ARM computers, requires substantial effort for calibration and tuning and presents a technological barrier for typical cotton gin workers. This research aims to transition the system to a more user-friendly, plug-and-play model by implementing an auto-calibration function. The proposed function dynamically tracks cotton colors while excluding plastic images that could hinder performance. A critical component of this auto-calibration algorithm is the hand intrusion detector, or “HID”, which is discussed in this paper. In the normal operation of a cotton gin, the gin personnel periodically have to clear the machine, which entails running a stick or their arm/hand under the detection cameras. This results in the system capturing a false positive, which interferes with the ability of auto-calibration algorithms to function correctly. Hence, there is a critical need for an HID to remove these false positives from the record. The anticipated benefits of the auto-calibration function include reduced setup and maintenance overhead, less reliance on skilled personnel, and enhanced adoption of the plastic removal system within the cotton ginning industry.

1. Introduction

The research reported herein is a continuation of previous research; as such, the introduction provided herein was also reported in [1,2] and is duplicated here for convenience to the reader. The elimination of plastic contaminants from cotton lint represents a pressing challenge for the U.S. cotton industry, exacerbated by the widespread implementation of new harvesting technologies. These advanced harvesters, which employ plastic wrapping for cotton modules, have significantly increased plastic contaminants detected by textile mills in cotton bales. U.S. classing offices attribute the primary source of such contamination to the plastic used in module wrapping, specifically by the latest John Deere harvesters. Despite concerted efforts by gin workers to remove plastic during the unwrapping of modules, contamination persists in the ginning process, as noted in recent studies [1,2].
This plastic contamination has led to a notable decline in the international market value of U.S. cotton, which formerly enjoyed a USD 0.02/kg premium for its cleanliness. Presently, it faces a USD 0.01/kg discount, culminating in an overall loss of USD 0.034/kg when compared to pre-contamination values [3,4]. This loss, when projected across the annual U.S. cotton yield, amounts to over USD 750 million, causing considerable distress among cotton producers and ginners [5,6,7,8,9,10].
In response to this economic impact, a novel inspection system employing low-cost color cameras has been developed. This system is designed to detect plastic on the module feeder’s dispersing cylinders, areas typically obscured by the cotton feed. Investigation revealed that improper unloading or unwrapping of modules often leads to plastic becoming trapped beneath them, thus entering the feeder (Figure 1).
This would invariably lead to large pieces of module wrap plastic entering the module feeder dispersing cylinders, as shown in Figure 2.
The accumulation of plastic on the dispersing cylinders of the module feeder can result in fragmentation as little pieces shed and rip off during operation, leading to widespread contamination across substantial quantities of cotton. Optimal detection and extraction of plastic fragments could be performed on the feeder apron, just before the gin stand, where the cotton stream is singulated and is the most dispersed. Consequently, the feeder apron presents an optimal location for implementing a vision system to identify and eliminate plastic contaminants in the seed cotton flow. A significant challenge at this juncture is the necessity for high-speed detection due to the limited 0.5 m length of the feeder apron available for plastic detection and removal. With the cotton advancing along the feeder apron at approximately 3 m per second, the machine-vision software is allocated merely 25 ms to capture an image, process it, and activate a digital output to trigger a solenoid that expels the plastic from the cotton stream. To manage these operations within the constrained timeframe, the software was developed in C++, integrating custom routines with high-performance, open-source machine-vision libraries.
The aim of this technical note is to elaborate on a subset of the system that is designed to eliminate false-positive images that occur when gin personnel stick their hands under the cameras during routine clearing operations. These false-positive images interfere with another automatic calibration sub-system that is in the process of being designed. The overall system software architecture is for a novel, automated, machine-vision-based system for inspecting and removing plastic contamination at cotton gin stands. This system incorporates a machine learning algorithm capable of autonomously detecting and extracting plastic contaminants. It currently features a semi-automated adaptive learning component that refines its recognition of the color spectrum of processed cotton. This adaptability is crucial for minimizing false positives, particularly when the natural coloration of the cotton—such as the commonly found spotted yellow hue—closely resembles that of yellow plastic used in module wrapping. Highly desirable and needed by the industry is a fully autonomous system that has a fully automated calibration system that will be enabled by a hand-intrusion detection system, which is the focus of this report.
The advancement of an auto-calibration system that autonomously monitors and adjusts to the variations in cotton flow constitutes a significant enhancement to the existing system and is the focal point of this research. In pursuit of this goal, a pioneering algorithm has been formulated [1,2] that adeptly tracks the cotton flow and excludes the usage of true-positive plastic contamination images in calibration. Utilizing such images for calibration would compromise the system’s integrity by causing it to overlook the plastic it aims to detect. The auto-calibration algorithm presumes a minimal occurrence of false-positive images, which typically arise when gin personnel interrupt the camera’s view to dislodge static cotton clumps, an event that transpires frequently. It was posited that a sensor could be developed or identified to discern these false-positive instances, thereby maintaining the purity of the image dataset for autonomous classifier training.
The paramount goal of the auto-calibration algorithm is to accrue a representative sample of the current cotton flow, free of plastic contamination images, to optimize the classifier build process. The integrity of the auto-calibration process relies on the exclusion of false-positive images. This research paper details the development, analysis, and design of a Human Interaction Detection (HID) sensor, which effectively identifies images with a high likelihood of being false positives. The operational principle of the HID sensor involves using LiDAR to measure the distance to a reflector placed across the gin stand. A shorter distance reading, indicative of a beam break or HID event caused by an obstruction such as a hand or arm, prompts the software to log the occurrence. This timestamp is then used to filter out any potential plastic contamination images captured concurrently with the HID event. The methodology for developing the HID sensor is elaborated in the subsequent sections of this report.

2. Materials and Methods

This section will cover the electronic and software designs for an HID sensor that is designed to enable auto-calibration algorithms by removing images where technicians have falsely triggered image captures by the VISN system. The objective of this sensor is to identify time stamps when HID events occurred and add those HID time stamps to the database so that later post-processing on the server can omit any images captured during these gin stand maintenance events. In theory, this will allow for the removal of all HID images and thereby enable the use of auto-calibration algorithms.
The initial design was created and tested utilizing off-the-shelf electronic modules, and then once the design was proven, commercial-quality printed circuit board designs were created. The modules were purchased from Sparkfun Electronics, Niwot, CO, USA. Prototype systems were installed into 2 commercial cotton gin plants and tested on 10 gin stands in these commercial facilities for use and testing in the 2022–2023 cotton ginning season in W. Texas, USA.

2.1. Lidar HID Sensing

The hand intrusion and detection (HID) system operates using a Garmin International (Lenexa, KS, USA) Lidar-Lite V3 sensor, which offers a resolution of ±1 cm with an update rate of 650 Hz. In practice, it was found that multiple lidars are required to capture all the HID events. The lidars are positioned 1.5–2.0 m away from the Visual Inspection System Node (VISN), located on the right side of the gin stand. In the first iteration, I2C extenders were utilized to directly connect the lidar units to the ARM computer running the primary machine-vision system. The design provided by this report seeks to improve upon this first design iteration by simplifying access to up to four lidar units from a single reading. This frees up the main ARM machine-vision system from having to poll numerous lidar units for beam break HID events. The design also sought to improve its reliability, as the first generation saw multiple issues with I2C unreliability that were found to be due to the RJ45 cable connectors that were utilized in the I2C extenders from Sparkfun Electronics. When mounted on the gin stand, a high-vibration environment, we found numerous times that the RJ45 connector would work fine until the machine was started and then would stop working. Messing with the connectors could generally eventually get them going; however, even then, they might end up failing later. It was clear that better connectors would benefit the reliability of the system. The design presented herein achieves this by placing a microcontroller in near proximity, less than 15 cm, to all of the lidar units, thereby avoiding the need for an I2C extender so the connection from the lidars to the microcontroller can utilize vibration-robust JST connectors. To address the unreliability of the RJ45 connector connection from the microcontroller to the ARM machine-vision system, the design utilized an ethernet module connected to a m12 ethernet connection that is designed for high-vibration environments. The advantage of this approach is that it will allow any of the ARM systems to read any of the lidar units, thereby providing more fault tolerance to the system. To illustrate the implementation of the HID system on a gin stand, Figure 3 shows the installation location and how the sensor looks across the cotton gin stand to assess when a technician has stuck his hand, arm, or a stick under the viewing area of the VISN imaging sensor.
The central component of the system is an ARM CPU-based Visual Inspection System Network (VISN), which runs a machine-vision algorithm to automatically detect plastic in the cotton, and it slides underneath the VISN system station. A separate process was run in parallel to connect the HID system to the VISN node via an ethernet Cat-5 cable that is running an I2C network protocol, both electrically and in software. Communication between the lidars and the local VISN system’s Raspberry Pi units is facilitated through the I2C electronic bus using I2C communication protocol. A Cat-5 cable connects the two systems, with each end terminated by a Sparkfun QwiicBus EndPoint (COM-16988; Niwot, CO, USA). The EndPoint incorporates NXP’s PCA9615 IC differential booster (Eindhoven, The Netherlands), enabling extended-range I2C communication and ensuring signal integrity between the two systems. During the deployment process, it was discovered that the hand-made Cat-5 cables were unreliable, leading to the replacement of all hand-made cables with commercially manufactured cables, resulting in improved reliability. However, even with commercially made ethernet cables, there were still reliability issues. These were attributed to the high vibrations of the gin stand exhibits, so it is recommended that future systems avoid RJ45 connects and instead use industrial M12 connectors.
Given the long 1.5 m distance between the VISN node and the HID sensor location, which is well beyond the allowable I2C network distance, the I2C signals were conditioned with an I2C extender to enable running over this extended distance. The I2C extender utilized a PCA9615 I2C extender semiconductor chip from NXP Semiconductors (www.nxp.com, accessed on 10 October 2023). The PCA9615 extends the I2C bus to allow it to run over cat-5 cables up to 3 m at full speed and further at lower clock speeds. The I2C extender module, Sparkfun product COM-16988, required several adjustments to suit the system application requirements. Figure 4 shows one of the modified Sparkfun I2C extenders, “EndPoints”, that was situated on each side of the connection, with one unit within the HID enclosure and the other inside the VISN nodes. The attached 6-pin lidar cable, shown in figure, connects the I2C extender to the Garmin Lidar-Lite V3 module, Sparkfun module SEN-14032, which was also configured electrically to communicate over the I2C network.
Figure 5 presents the schematic wiring of the I2C EndPoint connections between the lidar unit and the VISN camera node.
For deployment, communication between the ARM-based VISN and the lidar HID system was established using the software standard I2C communication protocol utilizing open-source I2C libraries written in Python.
The lidar’s datasheet specified the need for a 680 µF capacitor to be placed as close as possible to the lidar to optimize performance when using I2C. This capacitor provides the burst electrical energy needed for each laser pulse from the lidar. This capacitance is provided in the PCB circuit board design through the addition of three 220 μF capacitors for each lidar unit. The lidar also includes a pulse-width modulation (PWM) channel, which can be utilized for communication with the host processor (this research did not utilize this mode; standard I2C communications was used exclusively). For deployment and testing with the HID sensing application, the PWM mode was not utilized. During initial testing, it was determined that I2C would provide some advantages to the VISN system by off-loading some of the processing back onto the lidar unit. However, in the event that any readers want to implement PWM mode, during testing, it was found beneficial to alter the datasheet recommended 1 k resistor that connects to the mode-control pin on the lidar unit. Testing revealed that substituting a 2 k resistor results in an improved waveform with less digital noise, which will make it easier to capture a clean signal transition when digitizing the pulse-width signal from the lidar unit.

2.2. Lidar HID Sensor Design

Due to reliability issues, it was necessary to implement optimization to enhance the lidar performance with an alteration to its operating mode. This was accomplished by changing from default mode to short–fast, so that the lidar was able to take more frequent measurements. This was accomplished by modifying the values stored in the lidar’s internal registers through the use of the Python programming language and Adafruit’s open-source Garmin Lidar-Lite Library, which was modified to enable long-term 24/7 use and enhanced reliability. These changes proved to be beneficial in terms of overall system performance, delivering quicker distance readings and enabling the system to run without faulting out during extended run-time periods. For reader’s convenience, the full test source code is provided in the supplementary materials. The section on setting the lidar to short–fast mode can be found on line 322 in file lidarlite_test_r8.py. This line calls into a custom “class lidarlite_ext(adafruit_lidarlite.LIDARLite):” found in same file starting on line 124. This code extends the Adafruit Lidarlite interface class to improve long-term reliability. The benefit of switching to short–fast mode is that in the default configuration, many of the shorter-duration HID events, i.e., a quick hand insertion, would fail to be detected. Upon switching to the short–fast mode, the system’s ability to detect short-duration HID events was significantly improved, reducing the required dwell time from >5–10 s to >2–5 s. Note: the range in required dwell times is a feature of the lidar’s firmware, as our system was polling as fast as the lidar allowed.
After deployment of the system, it was concluded that a single lidar unit was inadequate for adequate detection performance of HID events. The team came to this realization after encountering recurrent instances of undetected objects due to the limited coverage area of a single lidar unit. In order to mitigate the issue and ensure improved accuracy, the authors determined that incorporating multiple lidar units would broaden the area of detection and minimize the possibility of missed detections.

2.3. Dual HID Sensor Design

Upon realizing the limitations of a single lidar unit during field deployment, it was determined that incorporating additional lidars would be necessary to enhance the system’s detection capabilities. To address this, during the cotton ginning season, the initial design was upgraded to include two lidars, which were found to significantly improve the total coverage area and reduce the instances of missed detections. However, it was also determined that even more lidar units would be needed to achieve the high efficacy required to enable near-complete removal of all HID images, which is a prerequisite for enabling the auto-calibration algorithms. The success of the two-lidar system paved the way for the development of a more advanced four-lidar sensor design.

2.4. Quad HID Sensor Design

To address the efficacy issues, a four-lidar-sensor HID design was developed with the design specification to provide a robust system architecture that can withstand the harsh industrial environment into which it will be deployed. The design is compact, fitting onto a single printed circuit board, PCB, that was engineered to resist electrical interference and withstand severe vibrations. The circuit board incorporates the following features:
  • A footprint for an RP2040, Pi-Pico, Broadcom microcontroller (www.raspberrypi.org; Raspberry Pi Foundation, Cambridge, UK), along with proper voltage spike suppression to ensure stable operation in potentially harsh environments.
  • Communication back to the machine-vision system can be achieved either via I2C or or the system can utilize an ethernet module that was incorporated in the design, for future research. To provide ethernet connectivity, the PCB design utilizes a W5500-io network module from wiznet.io to provide reliable and efficient communication between the HID and any of the VISN systems. The advantage of the ethernet approach is that it can connect directly to the cloud database server, or the control room computer displaying the data on a web interface which increases its flexibility.
  • To improve vibration hardening and more reliable communications, the W5500 ethernet module utilizes a M12 ethernet connector.
  • A lidar interfacing circuit provides the necessary components for communication between the lidar sensors and the microcontroller, allowing for flexibility in the choice of communication method. The user can choose to communicate with the lidar using either pulse width modulation (PWM) or the I2C protocol.
  • Spare pin headers provide the user with the option to connect external equipment to the system, whether it be analog or digital in nature.
  • A linear voltage regulator provides a stable and reliable power supply to the system, with proper noise filtering and over-voltage protection to ensure that the system remains operational even in harsh environments. This regulator drops the incoming 5 V power required for the lidar unit down to the 3.3 V required by the Pi-Pico.
  • A lidar LED indicator circuit provides a visual indication of the lidar’s status, making it easier for the user to determine if the lidar is functioning properly.
  • A 4-pin M12 connector for ethernet and a 5-pin M12 connector for power and auxiliary output signals were designed to provide a robust and industrial-grade solution for power and external communication. These industrial standard connectors are specifically designed for use in harsh industrial environments and have a well-proven record of providing reliable and durable connections for systems deployed in industrial environments subject to high levels of vibration and electrical noise.
Figure 6 shows the final PCB layout design of the HID board, which features the Wiznet W5500-io network module (Santa Clara, CA, USA). The illustration provides a visual representation of the board layout and its various components, including the Pi Pico’s footprint with proper voltage spike suppression, the lidar interfacing circuit, spare pin headers for connecting external equipment, the linear voltage regulator with noise filtering and over-voltage protection, the lidar LED indicator circuit, and the 4- and 5-pin M12 connectors for power and external ethernet communications. The image is an important representation of the hardware design of the HID board and provides essential information for anyone looking to send the PCB board out to commercial PCB fabrication for seamless replication as well as further understanding of the system. All designs were created in KiCad open-source PCB design software, and the schematic and PCB layout designs for this project are included in the supplementary materials for this technical note.

2.4.1. Pi Pico PCB Schematic Section Connections

The Raspberry Pi Pico microcontroller is equipped with connections to the power enable, trigger, and monitor pins of each lidar sensor. The analog-to-digital ADC pin header provides convenient and rapid connection to external analog circuits, and even digital ones can be used should the operator choose to add additional functionality. The B130-E3 Schottky diode is integrated to prevent unintended reversed voltage connection to the Vbus pin. Additionally, 2 k ohm pull-up resistors are integrated into the I2C network, allowing the user to utilize the I2C feature with the lidar sensors. The use of pull-up resistors is standard practice for the I2C electrical bus; the reader is referred to any of the I2C bus application notes for more detail, such as the primer provided in [11]. The Pico board design also features the necessary synchronous-serial SPI connections to communicate with the w5500 network communication module. Figure 7 details the schematic wiring to the Pi-Pico.
Table 1 lists the design components and vendors utilized in the HID PCB board design for the Pi-Pico section of the PCB board.

2.4.2. W5500 Ethernet Schematic Section Connections

Communication between the Pi-Pico and the Machine-Vision system via I2C, or the Wiznet W5500-io network, is a critical component in the HID system design as it allows for communication between the Pi Pico microcontroller and the cloud server, as well as the control room computer displaying the overall system reports. The research utilized I2C and found it was unreliable in a high vibratory environment, so the next generation version PCB design presented here included the W5500-io as an option. Of note is that the Pi-Pico utilizing W5500-io was not utilized in the research, all testing was performed via I2C interface. The W5500-io however was tested via a parallel development of a Raspberry-Pi daughter board and was found to provide robust solution for use on the high vibratory gin-stands. The W5500-io Raspberry Pi version will be presented in a future publication. Given the dramatic improvement, the W5500-io was also incorporated into the Pi-Pico version detailed herein. The W5500-io module is an integrated Ethernet module that provides ethernet connectivity to embedded systems. It features a hardwired TCP/IP protocol stack and supports multiple communication interfaces, including SPI and 8/16-bit parallel interface. For the HID sensor design, it opted to utilize the SPI interface to communicate between the Pi-Pico and the W5500. As the objective was to avoid RJ45 connectors, a non-standard approach was utilized, bypassing the manufacturer’s suggested design in order to avoid utilizing unreliable RJ45 connectors with integrated magnetics that have connection difficulties in high-vibration environments. Instead, the design utilized a stand-alone ethernet magnetics H1102NL transformer (www.pulseelectronics.com, accessed on 10 October 2023; Pulse Electronics, San Diego, CA, USA), which provides signal conditioning output to the 4-pin M12 ethernet connector. Details on design of the H1102NL pulse transformer and the W5500-io module are shown in Figure 8. Of note is that the ethernet lines carry high-frequency signals, so each PCB trace line was impedance-matched to 50 ohms, and care was taken to remove all the copper flood fill from the PCB region where these lines were located. Further, care was taken to provide good separation between each trace and proper usage of bypass capacitors. For more detail on high-speed layout, consult any number of textbooks and online application notes on the subject [12,13,14,15,16,17,18,19,20]. To further aid in high-frequency performance and layout, all components utilized 0805-sized surface-mount ceramic chip capacitors and surface-mount chip resistors. As target was a high-vibratory environment, in several cases, use of multiple smaller chip capacitors in parallel was utilized to reduce the mass and enhance the adhesion to the circuit board for higher-value capacitors.
Table 2 lists the design components and vendors utilized in the HID PCB board design for the w5500 section of the PCB board.

2.4.3. Lidar Circuit

Each of the four Garmin (Olathe, KS, USA) Lidar-Lite V3 lidar units is connected to the printed circuit board through the use of surface mount JST 6-pin SM06B-GHS-TB connectors. The JST connectors provide an industry standard connector that provides a comprehensive and robust connection for power and communication between the lidar and the PCB as well streamlines manufacturing, as JST cables are readily available and the JST connectors can be placed by commercial pick-and-place machines, thereby avoiding the need for high-labor and cost through-hole connections. In combination, the use of JST connectors significantly eliminates many steps in the manufacturing process of the HID units. To ensure reliable performance of the lidar units, three 220 μF surface mount capacitors are used to filter and stabilize the power input to the lidar unit. These capacitors help to smooth out any voltage fluctuations due to large power dump that occurs when the laser fires and prevent any adverse effects on the I2C communication between the lidar and the Pi Pico microcontroller. If pulse width modulation (PWM) is the desired method of communication with the Pi Pico, it is recommended to include a 2 k ohm resistor in the circuit to smooth out any noise and split the mode control pin into a trigger and monitor pin, as shown in Figure 9 (the PWM mode, which requires the 2 k resistor, was not utilized in the research reported on herein. The research utilized I2C for all communications between the microcontroller and each of the lidar units).
Table 3 lists the design components and vendors utilized in the HID PCB board design for the lidar section of the PCB board.

2.4.4. M12 Connectors

The HID system utilizes two industrial-grade M12 connectors, one male and one female, to facilitate the power supply and communication between the system and the control room computer. The 5-pin M12 female connector is designed to bring the necessary 5 V power to the system and provides optional I2C communication and an additional analog line for extended functionality. The 4-pin M12 male connector, on the other hand, contains the outputs from the H1102NL transformer, transmitting signals back to the control room computer, allowing for communication between the two systems. These robust M12 connectors ensure a secure and reliable connection between the components, offering optimal performance and seamless integration of the HID system in the control room infrastructure. The circuit connections to the M12 connectors are detailed in Figure 10.
Table 4 lists the design components and vendors utilized in the HID PCB board design for the M12 connectors section of the PCB board.

2.4.5. Input Voltage Regulation

The input voltage design for the system is 5 V, as that is what is required by the four Garmin Lidar-Lite V3 modules. To obtain power for the RP2040 microcontroller, the design of the circuit board incorporates a linear voltage regulator, MIC5205-3.3YM5, www.microchip.com, which steps down the incoming 5 V power to a stable 3.3 V output. This 3.3 V output is also used to power the Wiznet W5500-io module and serves as the source voltage for the I2C pull-up resistors, which enable the board to communicate via I2C to other 3.3 V devices such as an ARM-based micro-computer. The voltage regulation circuit has been optimized to maintain stability with the inclusion of three 10 μF decoupling capacitors and a 0.1 μF decoupling capacitor, along with a transient voltage suppressor diode (TVS8501V5MUT5G) that safeguards against voltage spikes that are common in industrial environments, such as the target deployment destination. Additionally, a 1 nF bypass capacitor that is connected to the bypass pin enhances the low-noise performance of the circuit. To maintain operational stability and prevent oscillation, two 10 μF output capacitors are connected in series. The use of two 10 μF capacitors allows for use of smaller surface mount chips, which are less expensive as doubling up the components, rather than introducing a new part, lowers the cost by allowing for volume discounts as well as reduces part count of the design, thereby lowering inventory requirements. The schematic details are provided in Figure 11.
Table 5 lists the design components and vendors utilized in the HID PCB board design for the linear voltage-regulation section of the PCB board.

2.4.6. Light-Emitting Diode, LED, Indictor Circuits

The circuit design of the system features indicator LEDs for each of the lidar units. The LEDs serve as a quick diagnostic tool, providing the operator with real-time insight into the status of each of the lidar units. Each LED is connected to the monitor pin on its corresponding lidar module, thereby causing it to switch on and off in response to the transmission of data between each lidar and the RP2040 microcontroller. To control the flow of current to the LED, a MOSFET transistor is utilized, ensuring a reliable and consistent source of illumination. With this design, the operator is able to quickly and easily determine the operational status of the lidar units, improving system performance and maintenance. In implementing the housing design, it is suggested to utilize light pipes to bring out each of the indicator LEDs to provide high visibility of the state of operational status for each lidar unit and the RP2040.
Table 6 lists the design components and vendors utilized in the HID PCB board design for the LED indicators section of the PCB board.
Table 6. List of components and their functions in the schematic, as depicted in Figure 12.
Table 6. List of components and their functions in the schematic, as depicted in Figure 12.
QtyValuePartsPart #VendorDescription
4 LED 1-4HSMY-C170Broadcom Limited (San Jose, CA, USA)Yellow LED
1275 ΩR 9-20RMCF0805JT75R0Stackpole ElectronicsResistor (0805 SMD)
4 Q 1-4BSS127IXTSA1Infineon Technologies (Neubiberg, Germany)MOSFET

2.5. HID Software Design

The data-acquisition process from the lidar devices was developed in Python and utilized Adafruit’s CircuitPython LIDARLite I2C library module code. In initial testing, the I2C library code was found to be faulty after extended runtimes due to not handling all situations correctly. To provide a solution that could run continuously for days, it was necessary to extract the I2C library code, modify it, and embed the key structures directly in our lidar code, hereafter known as “modified I2C” library code. To establish I2C communication with the lidar devices, the modified I2C library module is leveraged, offering a streamlined and effective approach to interface with the lidars via I2C network protocol. The libraries provide abstracted functions that operate at a higher level, facilitating data transmission and reception over the I2C bus. These functions encompass operations such as specifying the target device address, conducting read and write operations, as well as handling errors and allowing access to the devices’ internal registers. To visually illustrate the step-by-step process of the lidar software workflow, Figure 13 presents a comprehensive flowchart showcasing the I2C communication and data flow between the host device and sensor. This code is specifically designed for utilization on the VISN system’s ARM micro-computer.
The flowchart in Figure 13 showcases the software protocol utilized to obtain the lidar distance data and highlights the employment of I2C communication for acquiring precise distance and return-signal-strength, RSSI, measurements from the lidar. The feed-forward process steps encompass the setup of the lidar, data retrieval via I2C, and subsequent storage of the acquired data into a local SQL database.
The writing of the data into SQL databases is achieved through a set of purpose-built helper functions. These functions are designed to simplify the structure of the code into high-level and lower-level tasks to improve the readability and maintenance of the code utilized in the reading, writing, and updating of the SQL tables. The use of abstract data types provides enhanced convenience and efficiency in the overall process. Figure 14 provides a list of the available functions located inside the module.
The utility functions, shown in Figure 14, are designed to provide efficient and convenient interactions with the database, encompassing tasks such as reading, writing, and updating the data in the SQL databases. There are two sets of SQL utility functions: one set is targeted at reading and writing to the local SQL database, and the other set provides equivalent functions targeted at reading and writing to an SQL database on the cloud server that acts as the master controller and data store. The cloud-SQL utility functions are utilized by a background Python process that copies the data from the local SQL database up to the cloud SQL database for use by the auto-calibration algorithms running on the cloud server.
The latest software module developed facilitates interaction with a Wiznet W5500-io network module connected to an RP2040 microcontroller (Pi Pico), which is the master controller that provides data collection for each of the four lidar units. The communication between the Pico and the Wiznet W5500-io module is established using SPI (Serial Peripheral Interface). SPI is an industry-standard synchronous serial electrical bus and communication protocol that allows for high-speed data transfer between devices over short distances. Pico and W5500-io are configured to communicate with each other using SPI with up to a 10 MHz clock, thereby enabling efficient and reliable data exchange between the two devices. The custom Pico PCB board was designed to simplify testing and setup of the W5500 module. Figure 15 presents a visual representation of the startup sequence of the module, providing an overview of its configuration. The W5500 was configured to utilize DHCP (Dynamic Host Configuration Protocol) to establish its IP address. Given the non-deterministic nature of DHCP, the Pico board was designed with the intent to only upload data to the cloud server data via a simple web-based Javascript object notation (JSON) protocol to an application programming interface (API) running on the cloud server’s website.
This concludes the overview of key highlights of the code. For complete details, the reader is referred to the actual code, which is well documented and is included as a supplementary material to this technical note.

3. Conclusions

This technical paper describes in detail both the electrical and software designs of a hand intrusion detector (HID) that was developed to prevent false-positive images of technicians’ hands and arms from interfering with advanced auto-calibration algorithms that require clean images, only including cotton or images with cotton and plastic-contamination. Several prototypes were tested in the 2022–2023 cotton ginning season at 2 commercial gins on 10 cotton gin stands. All of the electronic PCB board and software design files are included as supplementary materials, open-source, for anyone wishing to utilize these designs to further their research efforts.

Supplementary Materials

The following supporting information can be downloaded at: https://www.mdpi.com/article/10.3390/agriengineering6010001/s1. The KiCad PCB design files as well as the software source code files are available, along with this technical note in the supplementary materials, online and have been released into the public domain as open-source software under the license provided by the relevant software packages, such as an MIT open-source license. The code is written in Python and utilizes standard open-source numerical, statistical, and machine learning libraries; each with various open-source licenses.

Author Contributions

Conceptualization, M.G.P., G.A.H., J.D.W., N.K. and J.R.W.; methodology, M.G.P., G.A.H. and J.D.W.; software, M.G.P. and J.D.W.; validation, M.G.P. and J.R.W.; formal analysis, M.G.P. and J.R.W.; investigation, M.G.P., G.A.H., J.D.W., J.R.W. and N.K. All authors have read and agreed to the published version of the manuscript.

Funding

This research received funding from Cotton Incorporated, Cary, NC 27513, USA, under Grant 21-804.

Data Availability Statement

The pertinent data to this Technical Note is the design files and software source code which are included in the supplemental files.

Conflicts of Interest

Mention of a product or trade name in this article does not constitute an endorsement by the USDA-ARS over other compatible products. Products or trade names are listed for reference only. USDA is an equal opportunity provider and employer.

References

  1. Pelletier, M.G.; Holt, G.A.; Wanjura, J.D. A Cotton Module Feeder Plastic Contamination Inspection System. AgriEngineering 2020, 2, 280–293. [Google Scholar] [CrossRef]
  2. Pelletier, M.G.; Wanjura, J.D.; Holt, G.A.; Kothari, N. Cotton Gin Stand Machine-Vision Inspection and Removal System for Plastic Contamination: Auto-Calibration Design. AgriEngineering 2023, 5, 1243–1258. [Google Scholar] [CrossRef]
  3. Devine, J.; (Cotton Incorporated Economist). Phone and email interview conducted on 6 January 2020, 2020.
  4. Barnes, E.; Morgan, G.; Hake, K.; Devine, J.; Kurtz, R.; Ibendahl, G.; Sharda, A.; Rains, G.; Snider, J.; Maja, J.M.; et al. Opportunities for Robotic Systems and Automation in Cotton Production. AgriEngineering 2021, 3, 339–362. [Google Scholar] [CrossRef]
  5. Blake, C. Plastic Contamination Threatens U.S. Cotton Industry. Southwest Farm Press. 24 May 2013. Available online: https://www.farmprogress.com/node/319085 (accessed on 5 July 2020).
  6. Adams, G. A Very Serious Matter. Cotton Farming. 3 August 2017. Available online: https://www.cottonfarming.com/cottons-agenda/a-very-serious-matter/ (accessed on 5 July 2020).
  7. Ramkumar, S. Plastic Contamination Not Just a Cotton Problem. Cotton Grower. 13 September 2018. Available online: https://www.cottongrower.com/opinion/plastic-contamination-not-just-a-cotton-problem/ (accessed on 5 July 2020).
  8. O’Hanlan, M. With Cotton Harvest Underway, Farmers Fear Grocery Bags, and Plastic Contamination. Victoria Advocate. 25 August 2019. Available online: https://www.victoriaadvocate.com/news/local/with-cotton-harvest-underway-farmers-fear-grocery-bags-plastic-contamination/article_9f8c90b0-c438-11e9-9c61-03c92ae351a7.html (accessed on 5 July 2020).
  9. Adams, G. A Reputation at Stake. Cotton Farming. 1 October 2019. Available online: https://www.cottonfarming.com/cottons-agenda/a-reputation-at-stake/ (accessed on 5 July 2020).
  10. Pelletier, M.G.; Holt, G.A.; Wanjura, J.D. Cotton Gin Stand Machine-Vision Inspection and Removal System for Plastic Contamination: Software Design. AgriEngineering 2021, 3, 494–518. [Google Scholar] [CrossRef]
  11. Afzal, S. I2C Primer What Is I2C? Application Note by Analog Devices. 2023. Available online: https://www.analog.com/en/technical-articles/i2c-primer-what-is-i2c-part-1.html (accessed on 14 November 2023).
  12. Ott, H.W. Noise Reduction Techniques in Electronic Systems, 2nd ed.; John Wiley, Inc.: Hoboken, NJ, USA, 1988; ISBN 0-471-85068-3. [Google Scholar]
  13. Montrose, M. EMC and the Printed Circuit Board; Wiley-IEEE Press: Hoboken, NJ, USA, 1999; ISBN 978-0780347038. [Google Scholar]
  14. Hu, R. PCB Design and Layout Fundamentals for EMC; Amazon Kindle: Seattle, WA, USA, 2019; pp. 91–133. ISBN 978-1082079252. [Google Scholar]
  15. Woodahl, L. Ethernet PHY PCB Design Layout Checklist; SNLA387; June; Texas Instruments: Austin, TX, USA, 2021; Available online: https://www.ti.com/lit/an/snla387/snla387.pdf?ts=1701194571237&ref_url=https%253A%252F%252Fwww.google.com%252F (accessed on 29 November 2023).
  16. Johnson, H.; Graham, M. High Speed Signal Propagation: Advanced Black Magic; Prentice Hall: Upper Saddle River, NJ, USA, 2023; ISBN 10 013084408X/13 978-0130844088. [Google Scholar]
  17. Kester, W. High Speed System Applications; Analog Devices: Wilmington, MA, USA, 2006; ISBN 10 1-56619-909-3. [Google Scholar]
  18. Schmitz, T.; Wong, M. Choosing and Using Bypass Capacitors (Part 1 of 3). Planet Analog. 19 June 2007. Available online: https://www.planetanalog.com/choosing-and-using-bypass-capacitors-part-1-of-3/ (accessed on 29 November 2023).
  19. Schmitz, T.; Wong, M. Choosing and Using Bypass Capacitors (Part 2 of 3). Planet Analog. 19 June 2007. Available online: https://www.planetanalog.com/choosing-and-using-bypass-capacitors-part-2-of-3/ (accessed on 29 November 2023).
  20. Schmitz, T.; Wong, M. Choosing and Using Bypass Capacitors (Part 3 of 3). Planet Analog. 19 June 2007. Available online: https://www.planetanalog.com/choosing-and-using-bypass-capacitors-part-3-of-3/ (accessed on 29 November 2023).
Figure 1. Module feeder floor system. (a) Unloading of round module onto module feeder floor (b) Where module accidentally tipped over, trapping plastic underneath it so that the crew could not remove the tail. Whenever this situation occurred, the gin crew was not always able to remove all the plastic before it went into the gin. (Pictures previously published in [2]).
Figure 1. Module feeder floor system. (a) Unloading of round module onto module feeder floor (b) Where module accidentally tipped over, trapping plastic underneath it so that the crew could not remove the tail. Whenever this situation occurred, the gin crew was not always able to remove all the plastic before it went into the gin. (Pictures previously published in [2]).
Agriengineering 06 00001 g001
Figure 2. Module feeder image capture by inspection system with plastic on dispersing cylinders. (Picture previously published in [2]).
Figure 2. Module feeder image capture by inspection system with plastic on dispersing cylinders. (Picture previously published in [2]).
Agriengineering 06 00001 g002
Figure 3. Layout of the hand intrusion detection (HID) system installed on a Lummus Gin Stand (Savannah, GA, USA) is shown in front view in frame (a) and side view with cotton flowing down the feeder apron in frame (b).
Figure 3. Layout of the hand intrusion detection (HID) system installed on a Lummus Gin Stand (Savannah, GA, USA) is shown in front view in frame (a) and side view with cotton flowing down the feeder apron in frame (b).
Agriengineering 06 00001 g003
Figure 4. Modified Sparkfun QwiicBus EndPoint (COM-16988). The green circles indicate the 26 AWG wire connecting the GRNW to the 3.3 V pin. The red circle highlights the cut 0-1 jumper bridge. The yellow circle depicts the 680 µF capacitor connected between VCC1 and GND.
Figure 4. Modified Sparkfun QwiicBus EndPoint (COM-16988). The green circles indicate the 26 AWG wire connecting the GRNW to the 3.3 V pin. The red circle highlights the cut 0-1 jumper bridge. The yellow circle depicts the 680 µF capacitor connected between VCC1 and GND.
Agriengineering 06 00001 g004
Figure 5. Schematic representation of the VISN connection to the HID system.
Figure 5. Schematic representation of the VISN connection to the HID system.
Agriengineering 06 00001 g005
Figure 6. The printed circuit board (PCB) for the HID system, which utilizes a Raspberry Pi Pico microcontroller and four JST surface mount SM06B connectors. The image highlights the inclusion of the Wiznet W5500-io network module, which serves as the communication link between the HID system and the control room computer. The illustration provides an overview of the HID system’s hardware design, including key components and their interconnections, and serves as a reference for anyone looking to understand the system’s architecture and functionality.
Figure 6. The printed circuit board (PCB) for the HID system, which utilizes a Raspberry Pi Pico microcontroller and four JST surface mount SM06B connectors. The image highlights the inclusion of the Wiznet W5500-io network module, which serves as the communication link between the HID system and the control room computer. The illustration provides an overview of the HID system’s hardware design, including key components and their interconnections, and serves as a reference for anyone looking to understand the system’s architecture and functionality.
Agriengineering 06 00001 g006
Figure 7. The schematic and connections of the Raspberry Pi Pico microcontroller. The diagram provides a visual representation of the 5 V power input to the VSYS and highlights the usage of a B120-E3 Schottky diode. The figure also showcases the connections between the lidar and the W5500-io network module, including the relevant wiring and electrical components.
Figure 7. The schematic and connections of the Raspberry Pi Pico microcontroller. The diagram provides a visual representation of the 5 V power input to the VSYS and highlights the usage of a B120-E3 Schottky diode. The figure also showcases the connections between the lidar and the W5500-io network module, including the relevant wiring and electrical components.
Agriengineering 06 00001 g007
Figure 8. The Wiznet W5500-io network module schematic. Showcasing the SPI connections to the Pi Pico microcontroller and the H1102NL transformer. The H1102NL transformer enhances the signal output, ensuring stable and consistent communication.
Figure 8. The Wiznet W5500-io network module schematic. Showcasing the SPI connections to the Pi Pico microcontroller and the H1102NL transformer. The H1102NL transformer enhances the signal output, ensuring stable and consistent communication.
Agriengineering 06 00001 g008
Figure 9. The schematic design displays the interconnection of the lidar unit with the PCB through the use of the JST SM06B-GHS-TB connector. The schematic includes the implementation of the lidar’s required 660 μF capacitors. Optionally included is the PWM resistor circuit, should user prefer PWM over the I2C interface.
Figure 9. The schematic design displays the interconnection of the lidar unit with the PCB through the use of the JST SM06B-GHS-TB connector. The schematic includes the implementation of the lidar’s required 660 μF capacitors. Optionally included is the PWM resistor circuit, should user prefer PWM over the I2C interface.
Agriengineering 06 00001 g009
Figure 10. Schematic illustration of the industrial-grade M12 connectors. The circuit features two M12 connectors, one 5-pin female and one 4-pin male. The 5-pin M12 connector offers the necessary 5 V power supply and options for I2C communication and analog signals. The 4-pin M12 connector is equipped with outputs from the Pulse-Electronics H1102NL transformer and connects to the control room computer.
Figure 10. Schematic illustration of the industrial-grade M12 connectors. The circuit features two M12 connectors, one 5-pin female and one 4-pin male. The 5-pin M12 connector offers the necessary 5 V power supply and options for I2C communication and analog signals. The 4-pin M12 connector is equipped with outputs from the Pulse-Electronics H1102NL transformer and connects to the control room computer.
Agriengineering 06 00001 g010
Figure 11. Voltage-regulation circuit for the HID system, illustrating the use of the MIC5205-3.3YM5 linear voltage regulator, decoupling capacitors, TVS diode, and bypass capacitor for improved low-noise performance. The circuit also features output capacitors connected in series to prevent oscillation and provide stable 3.3 V power to the Wiznet W5500-io module and I2C pull-up resistors.
Figure 11. Voltage-regulation circuit for the HID system, illustrating the use of the MIC5205-3.3YM5 linear voltage regulator, decoupling capacitors, TVS diode, and bypass capacitor for improved low-noise performance. The circuit also features output capacitors connected in series to prevent oscillation and provide stable 3.3 V power to the Wiznet W5500-io module and I2C pull-up resistors.
Agriengineering 06 00001 g011
Figure 12. Circuit schematic for lidar indication LED, showcasing the connection of each LED to the monitor pin of the lidar unit and the usage of a BSS127IXTSA1 MOSFET transistor for current sourcing. The LED provides visual system diagnostics to the operator, indicating proper operation of the lidar units.
Figure 12. Circuit schematic for lidar indication LED, showcasing the connection of each LED to the monitor pin of the lidar unit and the usage of a BSS127IXTSA1 MOSFET transistor for current sourcing. The LED provides visual system diagnostics to the operator, indicating proper operation of the lidar units.
Agriengineering 06 00001 g012
Figure 13. Illustration of the custom lidar source-code procedure with I2C Communication for Distance and return-signal-strength, RSSI, measurements (source-code included in the supplementary materials along with this publication).
Figure 13. Illustration of the custom lidar source-code procedure with I2C Communication for Distance and return-signal-strength, RSSI, measurements (source-code included in the supplementary materials along with this publication).
Agriengineering 06 00001 g013
Figure 14. Comprehensive list of SQL helper functions for database communication.
Figure 14. Comprehensive list of SQL helper functions for database communication.
Agriengineering 06 00001 g014
Figure 15. This flowchart visually depicts the step-by-step process of establishing communication between the Pico and Wiznet W5500 ethernet module utilizing the SPI bus protocol.
Figure 15. This flowchart visually depicts the step-by-step process of establishing communication between the Pico and Wiznet W5500 ethernet module utilizing the SPI bus protocol.
Agriengineering 06 00001 g015
Table 1. List of components and their functions in the schematic, as depicted in Figure 6.
Table 1. List of components and their functions in the schematic, as depicted in Figure 6.
QtyValuePartsPart #VendorDescription
22 kΩR 1-2RMCF0805FT2K00Stackpole Electronics (Raleigh, NC, USA)Resistor (0805 SMD)
410 μFC 1-4CL31A106MAHNNNESamsung Electro-Mechanics (Suwon-si, Republic of Korea)Capacitor (1206 SMD)
1 D1B130AF-13Diodes Incorporated (Piano, TX, USA)Schottky Diode (SMAF SMD)
1 U1SCO915Raspberry PiPi-Pico Module
Table 2. List of components and their functions in the schematic, as depicted in Figure 8.
Table 2. List of components and their functions in the schematic, as depicted in Figure 8.
QtyValuePartsPart #VendorDescription
1 U2W5500ioWiznetEthernet Module
1 T1H1102NLPulse ElectronicsSignal Transformer
275 ΩR 3-4RMCF0805JT75R0Stackpole ElectronicsResistor (0805 SMD)
10.001 mFC5C0805C102K4RAC7800KEMET (Fort Lauderdale, FL, USA)Capacitor (0805 SMD)
Table 3. List of components and their functions in the schematic, as depicted in Figure 9.
Table 3. List of components and their functions in the schematic, as depicted in Figure 9.
QtyValuePartsPart #VendorDescription
4 J 3-6SM06B-GHS-TB(LF)(SN)JST Sales America (Waukegan, IL, USA)6 Position JST Connector
4 R 5-8RMCF0805FT2K00Stackpole ElectronicsResistor (0805 SMD)
12220 mFC 6-17EDK227M016A9HAAKEMETCapacitor (0805 SMD)
Table 4. List of components and their functions in the schematic, as depicted in Figure 10.
Table 4. List of components and their functions in the schematic, as depicted in Figure 10.
QtyValuePartsPart #VendorDescription
1 J1T4140012051-000TE Connectivity (Schaffhausen, Switzerland)5 Position Male Connector
1 J9T4143512041-000TE Connectivity6 Position Female Connector
Table 5. List of components and their functions in the schematic, as depicted in Figure 11.
Table 5. List of components and their functions in the schematic, as depicted in Figure 11.
QtyValuePartsPart #VendorDescription
510 mFC 18-21; 23-24CL31A106MAHNNNESamsung Electro-MechanicsCapacitor (1206 SMD)
11000 pFC22C0805C102K4RAC7800KEMETCapacitor (0805 SMD)
2 D2TVS8501V5MUT5GOnSemi (Pheonix, AZ, USA)TVS Diode
5 U3MIC5205-3.3YM5-TRMicrochip Technology (Chandler, AZ, USA)LDO Regulator
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Pelletier, M.G.; Wanjura, J.D.; Wakefield, J.R.; Holt, G.A.; Kothari, N. Cotton Gin Stand Machine-Vision Inspection and Removal System for Plastic Contamination: Hand Intrusion Sensor Design. AgriEngineering 2024, 6, 1-19. https://doi.org/10.3390/agriengineering6010001

AMA Style

Pelletier MG, Wanjura JD, Wakefield JR, Holt GA, Kothari N. Cotton Gin Stand Machine-Vision Inspection and Removal System for Plastic Contamination: Hand Intrusion Sensor Design. AgriEngineering. 2024; 6(1):1-19. https://doi.org/10.3390/agriengineering6010001

Chicago/Turabian Style

Pelletier, Mathew G., John D. Wanjura, Jon R. Wakefield, Greg A. Holt, and Neha Kothari. 2024. "Cotton Gin Stand Machine-Vision Inspection and Removal System for Plastic Contamination: Hand Intrusion Sensor Design" AgriEngineering 6, no. 1: 1-19. https://doi.org/10.3390/agriengineering6010001

Article Metrics

Back to TopTop