Development of a low cost open-source ultrasonic device for plant height measurements

Plant height is commonly used to characterize crops in various domains such as plant breeding or precision farming. Despite signiﬁcant advances in sensing technologies, plant height is still very often measured manually in many research applications where high-throughput alternatives are not always suitable. Here, we have developed a low cost, open-source ultrasonic device for semi-automated plant height measurements in small- to medium-scale applications. The main innovation compared to previous developments is the combination of a low-cost ultrasonic sensor and a plastic backscatter plate to improve plant tip detection. We compared the device to the manual method under controlled laboratory conditions and in a ﬁeld experiment with 26 sorghum ( Sorghum bicolor ) inbred lines. The accuracy of the device was close to 1 cm in controlled conditions and 2 cm in the ﬁeld, and the bias was close to 0 in both cases. In the ﬁeld, measurements were 42% faster when compared with the classical ruler, and sensor-based values were strongly correlated with ruler-based values (R 2 = 0.9965). Overall, the device allows signiﬁcant time savings while maintaining very high accuracy compared to the manual method. Its low cost ( ∼ 75 € ) and compact design make it suitable for a wide range of applications, either for crop species, natural species, or model organisms. We encourage such implementations by providing all code and materials in free and open access.


Introduction
Plant height is widely used to characterize crop species. Strong correlations between plant height and biomass yield have indeed been reported for most forage and bioenergy species [ 1 , 2 ]. Plant height is also often correlated with grain yield in cereals such as barley, oat, or wheat [3] . Hence, plant height measurements can be used to predict productivity and adjust crop management [4] . In plant breeding, plant height is a classical selection criterion. Besides its physiological consequences on biomass and grain yield, it is one of the main traits involved in lodging resistance [5] .
Traditionally, plant height is measured manually with a graduated ruler [6] . However, such measurements are labour intensive, timeconsuming, and low throughput. In addition, they are prone to human error due to fatigue and distraction during ruler adjustment and reading. Notably, users can skew their eye view at high and low height values preferred over technological alternatives in a lot of research applications [ 6 , 19 ]. Medium-throughput systems combining the advantages of the ruler and the speed and accuracy of sensing technologies could thus be promising in this context. Of all the existing technologies for plant height phenotyping, ultrasonic sensing appears particularly relevant for such development given its ease of use and low cost.
Several studies have already used ultrasonic sensors to measure plant height in the field [20][21][22][23][24][25][26][27] . Most of these developments were implemented on mobile platforms, which often combine multiple sensors and sample data at very high frequency [25][26][27][28] . However, there are some limitations to using such platforms in small-to medium-scale experiments. First, they are usually quite expensive to develop. Second, they require specific field layouts with sufficient spacing between rows and wide lanes for manoeuvring. Finally, they are more efficient on long and dense plots because they perform continuous vegetation scans. While continuous scanning is interesting to avoid sampling bias, it also captures unwanted data originating from sound reflection on the soil, on lower plant organs, or on weed species [20][21][22] . When plots are long enough, the proportion of unwanted data is relatively small and simple statistical methods can be applied to remove them [ 21 , 22 ]. In addition, this proportion can be reduced by using highly performant, and thus more expensive, ultrasonic sensors which perform better at detecting plant tips. In small scale experiments with smaller plots and limited budget, however, such solutions are more difficult to implement.
In this study, we aimed at developing an ultrasonic sensor to speed up plant height measurement in a context of small-to medium-scale research applications. Our main requirements were to stay within a low budget, to use simple, low-tech, and open-source technologies, and to design a compact device that can be hand-transported and operated by a single user. The principal innovation compared to previous developments is that we combined a low-cost ultrasonic sensor and a plastic backscatter plate to improve plant tip detection. We also aimed at validating the data obtained from our device both in standardized laboratory conditions and in real acquisition conditions, and to estimate the time saving compared to the standard manual method.

Hardware component
Details of the electronic circuit are given in Fig. 1 and a schematic overview of the device is provided in Fig. 2 . Plant height measurement is performed with an ultrasonic sensor HC-SR04 (Picaxe, USA) which operates at a 5V level ( Figs. 1 & 2 a). The sensor comprises two modules: a transmitter which sends sound at 40 KHz frequency, and a receiver. HC-SR04 has an operating range of 2 cm to 400 cm, an accuracy of up to 3 mm, and a measuring angle of 30°according to its manufacturer. The ultrasonic sensor is fixed on an aluminum stick of 3 × 3 × 200 cm and directed downwards so that the signal is emitted towards the top of the canopy ( Fig. 2 c). When the sensor is positioned in the highest part of the stick, our device is thus able to measure plants up to 190 cm tall (the sensor is located 10 cm below its attachment point). An LCD shield (D1 Robot, DFR Robots, France) is positioned on the stick in front of the operator. It displays information such as measurement identifier and plant height value. The shield also allows the measurement to be triggered via push buttons ( Figs. 1 & 2 b). The collected data are stored in a miniSD card (SanDisk, USA) via an SD card reader (Catalex, USA) ( Figs. 1 & 2 b). The SD card contains a .csv file with a list of measurement identifiers, e.g., plot numbers. All electronic components are connected to a programmable microcontroller board ( Figs. 1 & 2 b). The selected board is an Arduino UNO (Arduino SRL, Strambino, Italy). It is based on an 8-bit microcontroller (ATMEGA328; Atmel Corp, San Jose, CA, USA) with 32 Kb flash memory.
The whole device has a power consumption of approximately 250 mA. It can be power supplied with a classical or rechargeable 9V battery, or by an external battery with higher capacity. A typical 9V battery with 500 mAh capacity will last two hours, whereas a 2500 mAh powerbank (e.g., portable phone charger) will last ten hours. External batteries can be directly connected to the Arduino board through USB connection ( Fig. 1 ).
All electronic components are encapsulated in two protective plastic shells made by 3D printing: one for the ultrasonic sensor ( Figs. 2 a and 3 ), and one for the other electronic components ( Figs. 2 b and 3 ). We also 3D-printed buttons to extend the native buttons of the shield outside the plastic shell and improve measurement ergonomics ( Fig. 3 a).
We are here interested in measuring plant height as defined by Heady (1957): the perpendicular distance from the soil at the basis of the plant to the highest point reached with all plant parts in their natural position [29] . It is known that ultrasonic sound waves can be reflected by lower leaf levels within the canopy, and even by the soil [ 21 , 22 ]. Such reflections can generate spurious signals leading to erroneous plant height values. This problem is classically handled by using expensive ultrasonic sensors with high accuracies, and by integrating a lot of measurement points over plot rows which are later statistically processed to remove outliers [ 21 , 22 ]. We here propose an alternative low-tech solution which is the use of a plastic backscatter plate to reflect the ultrasonic signal only at the tip of the plants. The plate measures 20 × 20 cm and is situated below the ultrasonic sensor ( Figs. 2 c, d and 3 d-g). It is made of transparent plastic and it slides on the main stick so that the user can see through it and place it at the highest point of the canopy. The plate is thick enough (2 mm) to remain parallel to the ground, and is simply screwed on its holder which is a metal tube with larger section than the   stick, so that it can slide without difficulties ( Fig. 3 d-f). The whole setup (plate and tube) holds on the stick by mechanical pressure of a rubber pad (here we used a bicycle brake pad) applied by a spring ( Fig. 3 d-f). The user can release the pressure of the spring to move the system up or down using a handle directly connected to the spring. As soon as the handle is released, the rubber pad touches the stick again which maintains the plate in its current position. Depending on the species, on the development stage, and on the local configuration of the canopy, the highest part reached by the plate can be any plant organ such as a leaf, a stem, or a spike. Given the size of the plate, the fact that it only moves in the vertical direction (i.e., the section of the stick and plate holder are squared, so rotations are not possible), and given the measuring angle of the sensor, the plate is always within the detection range of the sensor after adjustment.
The total weight of the sensor is approximately 1500 g, which is largely manageable for several hours of measurements in the field (note that the stick is supported by the ground most of the time). We tried to find the better balance between cost, weight, and resistance, but users interested in reducing the weight further can use lighter materials for some parts of the device. Overall, the material cost of the device is 74 € ( Table 1 ), the most expensive components being the Arduino board and the aluminum stick (around 20 € each). We do not present the costs associated with conception, programming, and building here because it is difficult to evaluate. Indeed, multiple persons contributed and worked intermittently on the project. Yet, we aimed at reducing development costs for future users by providing all code, materials, and tutorials under open-access [30] .

Software component
The microcontroller is managed with a computer program written in C/C ++ language. The code was written with the open-source Arduino Integrated Development Environment (IDE) and then uploaded on the Arduino UNO chipset. The program can be divided into several parts. When first turned on, the device checks the battery power and the presence of the SD card. An error message is displayed in case of a problem on one of these two critical points. A calibration measurement is then performed at a known sensor-plate distance to compute the speed of sound in the current experimental conditions (see next section). For the subsequent measurements the operator slides the plastic plate on top of the canopy and pushes the 'down' button to trigger the measurement. The ultrasonic sensor sends a sound wave and the program computes plant height based on the travel time of the sound wave and the speed of sound. The plant height value is displayed and saved in a second .csv file on the SD card. The program then displays the ID of the next measurement (or next plot) where all operations are repeated. In case of an error, the operator can choose to redo any measurement, the initial value is then erased and replaced by the new value in the .csv file. Every 30 minutes, the operator is asked to perform a new calibration measurement. Most parameters in the program can be changed by the user to adapt the device to its own use (see tutorial).

Operating principle
Ultrasonic sensors generate pulses of sound that bounce off the first object it comes into contact with, and then detects the returning echo. If the speed of the sound is known, the distance between the sensor and the object can be computed based on the time delay between the emission and the reception of the pulse.
To use the device, the operator first creates a .csv file listing all plot identifiers in the chronological order of measurement and saves it on the SD card. All measurement identifiers must have the same number of characters, and this number must be passed as a parameter to the Arduino program (see tutorial). Then, the operator places the sensor on the stick at the desired height depending on size of the plants that will be measured (highest positions for taller plants). The operator needs to record the height of the sensor on the stick and save it in the Arduino code (see tutorial), as this value (X on Fig. 2 c) will be used to compute plant height (see below). Once in the field, the operator turns the device on and performs a calibration measurement. With the plate positioned at the lower end of the stick, the operator triggers calibration by pushing the "down button ". This calibration is required because the speed of the sound if affected by air properties such as humidity and temperature. This first measurement aims at computing the speed of the sound in the current experimental conditions. It is computed as the ratio between the know sensor-plate distance (X) and the travel time of the sound wave between the sensor and the plate. The speed of the sound is recorded and re-used for all subsequent measurements. After calibration, the operator goes to the first plot, chooses a random position within the canopy, and puts the aluminum stick perpendicular to the ground. Note that verticality is assessed visually, as classically done with the ruler. The operator then slides the plastic plate down until it reaches the highest point of the canopy and triggers the measurement by pushing the "down " button ( Fig. 2 d). The distance between the sensor and the plate (Y on Fig. 2 c) is computed based on the travel time of the sound wave and the speed of sound, and then subtracted from the height of the sensor (X) to obtain the plant height value (H = X-Y, Fig. 2 c). The value is displayed on the screen and saved on the SD card. The screen then displays the identifier of the next plot, where all operations are repeated. To account for microclimatic variation between different parts of the field and for potential weather variation during long period of measurements, a warning message requesting a new calibration is displayed on the LCD screen every 30 minutes. Once this new calibration measurement is done as described previously, the operator can continue the measurements from where he stopped when the calibration message appeared. Of course, the user can change the time interval between calibration measurements by adjusting the value of this parameter in the Arduino code.

Laboratory tests
The device was first tested in standardized laboratory conditions (no wind, 19°C, 45% air humidity). The sensor was positioned 175 cm above the soil on the aluminum stick and 20 positions were randomly selected every 25 cm for the plastic plate, i.e., 20 positions between 0 and 25 cm, 20 positions between 25 and 50 cm, …, 140 positions in total. For each position, we measured the height of the plastic plate with a measuring tape and with the sensor. We then computed the differences between manual measurements and sensor measurements for each position. We analyzed the distribution and means of these differences for each interval of 25 cm to assess the accuracy and bias ( b ) of the sensor at different measuring ranges. We therefore explored a 175 cm displacement depth, which should largely cover the variation in plant heights typically encountered during a measurement session, i.e., if the sensor has been correctly positioned on the stick according to the species and growth stage, the user should not need to move the plate that far from the sensor.

Field tests
We tested our device in a set of 26 sorghum inbred lines grown in the field at Montpellier, France (GEVES, Lavalette research station). The 26 lines were grown for evaluation as part of the French national testing program for varietal inscription. The 26 lines were replicated in multiple blocks, but we only measured one block as we were only interested in the relative differences between the two measurement methods, not in the relative differences between inbred lines. Each line was grown in a 4-row plot. Rows were 2.5 m long, with a spacing of 35 cm between rows. Plots were arranged in a two horizontal rows of 16 and 10 plots, respectively, with 40 cm between plots and 1.5 m between the two rows. The test was performed on 24 September 2020, without wind, with an air humidity of 56%, and an air temperature of 24.6°C. All inbred lines were at the grain filling stage. In each plot, the operator selected three plants randomly and measured their heights with the ultrasonic device. After measuring the 26 plots, the exact same protocol was repeated with the ruler, measuring the same three plants. Measurements were not repeated at the plant level, i.e., each of the three plants was only measured once with both methods. When using the ruler, plant height values were reported to a paper sheet. Fig. 4. Distribution of the differences between sensorbased measurements and ruler-based measurements. Mean differences, corresponding to the bias of the sensor ( b ) are reported.
We compared measurement duration for both methods. We considered two steps: data acquisition, corresponding to the time spent in the field doing the measurements, and data transcription corresponding to the time spent typing the data manually into a spreadsheet. For the ruler, the data acquisition step consisted in positioning the ruler near to a plant, reading the height value on the ruler, and reporting that value to a paper sheet. For the ultrasonic device, the acquisition step consisted in positioning the sensor in the plot, sliding the plate down until it reaches the highest point of the canopy, and triggering the measurement by pushing the shield button. The duration of the transcription step was only measured for ruler-based measurement because this step is unnecessary with the ultrasonic device, i.e., measurements are automatically saved on the SD card following acquisition. For the ruler, transcription consisted in typing the data manually into a spreadsheet and checking for potential transcription errors.
We assess the accuracy of the sensor by measuring the correlation between ruler-based and sensor-based values. We finally computed the bias of the sensor ( b ) as the average difference between ruler-based and sensor-based values.

Results
In laboratory conditions, the differences between sensor measurements and manual measurements ranged from -1.1 cm and 0.7 cm and were evenly distributed around 0 ( Fig. 4 ). Accuracies were comparable over the measurement range. The bias of the sensor was close to 0 when the plate was situated 50 cm to 175 cm away from the sensor, i.e., for height values comprised between 0 cm and 125 cm, and it was closer to -3 mm when the plate was closer to the sensor, i.e., for height values comprised between 125 cm and 175 cm.
In the field, sensor-based values were strongly correlated with rulerbased values (y = 0.9981x + 0.2704, R 2 = 0.9965, Fig. 5 a). This correlation was even stronger when considering inbred line means (y = 1.0017x -0.0782, R 2 = 0.9986, Fig. 5 c). Sorghum height values ranged from 77 to 125 cm ( Fig. 5 a). Differences between sensor-based and ruler-based measurements ranged from -1.5 cm to + 1.7 cm when considering raw data, and from -0.5 cm to 0.8 cm when considering data averaged per inbred line ( Fig. 5 b and d). The mean difference between sensor and ruler values was equal to 0.0859 cm.
The device allowed to save a bit more than 6 seconds per measurement, which represents 42.1% time saved compared to the manual method ( Table 2 ). This gain was obtained both through higher speed during measurement, the sensor being 28.8% faster than the ruler, and through transcription, which took 2.7 seconds per measurement point with the ruler, whereas this step is no longer needed with the sensor since the data is directly saved in a numeric file on the SD card.

Table 2
Comparison of measurement time between the ultrasonic sensor and the ruler. All durations were standardized by the number of measurement points (here n = 26 × 3 = 78 points) and are therefore expressed as average duration per measurement point.

Discussion
A low-cost and open-source ultrasonic device was developed to speed up plant height measurements in the field. Our study shows that the device is very accurate, both in controlled laboratory conditions and in real acquisition conditions. Differences between sensor values and manual values were larger in the field than in the lab, which is very likely attributable to soil irregularities such as clods or up-lifts near the crown which can change the level of the 0 value between measurements. Still, even in the field, these differences were lower than 2 cm, and the correlation with manual measurements was very high (R 2 > 0.99). Comparatively, previous studies on ultrasonic methods for plant height phenotyping reported R 2 comprised between 0.75 and 0.98, and accuracies comprised between 2 and 9 cm, depending on the sensor and on the crop development stage [ 21 , 22 , 25 , 27 , 28 ]. These studies were mainly conducted on cotton, a favorable species for plant tip detection by ultrasonic sensor due to broad and flat leaves on the upper parts of the canopy. Also, these studies relied on expensive commercial sensor (200 to 500 $) and extensive data cleaning (10 to 25 % of the data removed) to increase accuracy. Our study shows that the use of a backscatter plate is an interesting low-tech alternative for increasing the accuracy of ultrasonic plant height measurements.
The device is particularly suited for small-to medium-scale research applications where high-throughput mobile platforms are not always adapted to the experimental requirements. In such set ups, the device has multiple advantages over the classical ruler. First, measurements are much faster. For example, in a typical experiment with 300 plots and 2 measurements per plot, the device would allow to gain more than 1 hour of work compared to the manual method (1 h 24 min vs 2 h 25 min). Our results suggest that the difference in measurement duration between the two methods originate from both higher speed during data acquisition (i.e., reading the plant height value in the field) and higher speed during data transcription (saving the value on a digital file). Second, the device can be easily manipulated by a single operator, whereas  5. (a, c) Linear relationships between sensor-based and ruler-based plant height measurements using raw data (a) or data averaged per inbred line (c). The dotted line represents a perfect fit; (b, d) Distribution of differences between sensorbased measurements and ruler-based measurements using raw data (b) or data averaged per inbred line (d). The mean difference, corresponding to the bias of the sensor ( b ) is reported. the ruler often requires two operators, i.e., one doing the measurement, the other one reporting the value on a paper sheet or on a computer. In addition, the risks of human errors are significantly reduced because manual transcription is no longer needed with the device. Finally, the main problem with discrete sampling as classically performed with the ruler is that it can lead to a misrepresentation of the plot because the user tends to select plants which are easy to measure, which are often the tallest plants. Such sampling bias is significantly reduced with the device because the user does not have to read the value himself, and because more measurements per plot can be performed in a similar time to better characterize the within-plot variability.
The technology implemented in this tool represents a straightforward upgrade of the standard method, which means that it can easily be handled by any operator capable of using a graduated ruler. Moreover, the direct access to the source code allows high versatility since users can change any parameter to adapt the tool to their own use. Notably, the current version allows to measure plants between 0 and 190 cm, which is adapted for most cereals, legumes, and forage crops. It is however possible to adapt the device to taller crops such as maize or sorghum, which can be much taller than reported here. The user would then need to use a taller stick and to move the sensor and the plate up the stick. Of course, he will then have to change the reference height value in the Arduino program, i.e., the height of the sensor above the ground (we explain how to do that in the tutorial).
The device can be used in a lot of research applications which currently rely on plant height measurement performed at the individual plant level. This includes research works aiming at quantifying the impact of agronomic practices on crop development [ 31 , 32 ], physiological studies focusing on resources partitioning between plant organs [ 15 , 17 ], or genetic approaches investigating the determinism of plant height [ 16 , 18 , 33 ]. The compactness of the device could also allow applications in natural environments. For example, plant height is one of the key traits targeted by plant ecologists to understand the functioning of plant communities in the wild [ 34 , 35 ]. For any of these potential applications, the time saved compared to the manual method could be used to multiply measurements over time and space in order to better characterize plant growth dynamics.
The range of applications could be extended by working on the potential limitations that could arise when using the device in different conditions than reported in this study. Notably, some tasks which are done visually in the current version could be challenging with taller plants like maize or other varieties of sorghum. For example, plant tip detection would require to visually examine the position of the backscatter plate at 2.5 or 3 m above the soil. In such configuration, automatic tip detection would be a valuable upgrade to maintain high accuracy at high heights. A solution could be to generate a small electric current within the backscatter plate and to stop the backscatter plate as it moves down when the electric signal is reduced or cancelled by contact with the canopy. Measuring taller plants also raises the issue of the verticality of the device. While it is easy to visually assess verticality with reasonable accuracy at eye level, it is much more difficult for taller setups. Simple upgrades such as the addition of a spirit level on the main stick could help to better estimate verticality in such setups.
To further investigate the robustness of the sensor, it could be useful to explore wider ranges of plant heights and different types of plant architectures. Moreover, complementary experiments could allow to assess how measurements are affected by climatic variables such as temperature, humidity, and wind. Such environmental variability could be accounted for either by using physical modelling estimations or by integrating climatic probes directly into the device. Measurements could also be automatically georeferenced, for example by connecting the device to a GPS system or GNSS receiver. We did not implement these technologies in the first version of this device because we thought it was not a priority to address our main objectives (low-cost, ease of use). However, we encourage such developments by providing all code and material under the GNU GPLv3 license [30] .

Author Contributions
G.M. and C.L. conceptualized the device. G.M. and C.L. developed the hardware and software components with the help of S.M. and C.G. A.D., B.T. and G.B. supervised the project. G.M. set up the field test and analysed the data. All authors wrote the original draft and contributed to the reviewing and editing process.

Declaration of Competing Interest
The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.