Outdoor remote soil detection and analysis device and method
By integrating the Raspberry Pi processor, Lora module and seven-in-one sensor into the soil sensor, combined with decision tree fitting technology, the problem of inaccurate measurement of soil inorganic salt content and short transmission distance is solved, and soil nitrogen, phosphorus and potassium are realized. Accurate detection and long-distance transmission of content are suitable for large-scale soil monitoring.
Patent Information
- Application Number
- CN202410567211.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-09
- Publication Date
- 2024-09-10
AI Technical Summary
Existing soil sensors cannot accurately measure the inorganic salt content of soil, and their transmission distance is short and their power runs out quickly, which limits their application in large areas or remote areas.
An outdoor remote soil detection and analysis device is designed, using a Raspberry Pi processor and Lora module, combined with a seven-in-one sensor and a solar charging module, to achieve soil nitrogen, phosphorus and potassium content through data preprocessing and decision tree fitting technology. Accurate detection and data transmission through long-distance low-power radio frequency technology.
It achieves accurate detection of soil nitrogen, phosphorus and potassium content, solves the problems of short transmission distance and power consumption, and is suitable for soil monitoring in large areas and remote areas.
Smart Images

Figure CN118624865A
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of soil detection and testing, and in particular relates to an outdoor remote soil detection and analysis device and method. Background Art
[0002] In the field of modern precision agriculture, monitoring soil health is crucial to ensure good crop growth. Various soil sensors already exist on the market. These devices can monitor key parameters such as soil moisture, temperature, and pH value. However, the inorganic salt content of the soil measured by the soil sensors on the market is very inaccurate. Currently, such sensors can only accurately measure the conductivity, humidity, temperature and other values of the soil. In addition, current devices rely on wired connections or short-range wireless technology, which limits their application in large areas or remote areas.
[0003] The cost of using X-rays to measure soil is high, and existing soil sensors cannot accurately measure the specific inorganic salt content of the soil. In addition, the current equipment has a short transmission distance and cannot solve the problem of rapid power consumption. Summary of the invention
[0004] In view of this, the present invention provides an outdoor remote soil detection and analysis device, including a processor, an information collector, a remote server, a power module and a charging module, wherein:
[0005] The processor receives the data and signals transmitted by the information collector, processes and analyzes them, and then uploads them to the remote server; the power module is charged by the charging module to supply power to the information collector;
[0006] The processor includes a Raspberry Pi and a second Lora module connected to each other; the information collector includes a sensor group, a relay and a first Lora module that are all connected to each other; and the first Lora module communicates with the second Lora module.
[0007] Preferably, the first Lora module receives a control signal sent by the second Lora module, and the control signal is generated by the Raspberry Pi and sent to the second Lora module.
[0008] Preferably, the first Lora module controls the switch of the relay according to the control signal sent by the second Lora module.
[0009] Preferably, the first Lora module only responds to a preset modbus wake-up instruction and turns on the relay.
[0010] Preferably, the sensor group includes a seven-in-one sensor for detecting the temperature, humidity and conductivity of the soil.
[0011] Preferably, the charging module comprises a solar panel.
[0012] Preferably, the charging module further includes a boost plate.
[0013] Based on the above purpose, the present invention also provides an outdoor remote soil detection and analysis method using the above device, comprising the following steps:
[0014] S10, collecting nitrogen, phosphorus and potassium content, conductivity, temperature and humidity of at least 2000 sets of experimental data, and performing data preprocessing on these experimental data as data sets, wherein the preprocessing uses minimum-maximum normalization;
[0015] S20, fitting the contents of inorganic salts of nitrogen, phosphorus and potassium through the numerical values of conductivity, temperature and humidity after pretreatment;
[0016] Wherein, S20 includes the following steps:
[0017] S21, decision tree construction: each decision tree randomly selects samples from the conductivity, temperature and humidity data sets for training;
[0018] S22, node splitting: At each decision tree node, the algorithm selects the best splitting method to distinguish different levels of nitrogen, phosphorus, and potassium content;
[0019] S23, leaf node prediction: at each leaf node, the average value of the nitrogen, phosphorus and potassium contents of the training samples of the node is calculated as the prediction of the nitrogen, phosphorus and potassium contents of the leaf node.
[0020] Preferably, the S22 specifically includes:
[0021] For each split point, the purity of the two child nodes after the split is calculated, expressed as the mean square error,
[0022]
[0023]
[0024] Among them, MSE left (θ) is the mean square error of the left child node; MSE right (θ) is the mean square error of the right child node; D left (θ) is the set of data points in the left subset after the split threshold θ is given; D right (θ) is the set of data points in the right subset after the split threshold θ is given; y i is the actual target value of the i-th data point; is the average value of the target values of all data points in the left child node; is the average value of the target values of all data points of the right child node;
[0025] Choose such that MSE left(θ)+MSE right (θ) The smallest split point θ is taken as the optimal split point;
[0026] Then perform feature selection: For each node, the algorithm selects the best splitting feature from all or a random subset of features. The selection method includes calculating the splitting index of each feature, that is, the mean square error, and selecting the feature that optimizes the splitting index, that is, the maximum mean square error.
[0027] Preferably, the S23 obtains the prediction result according to the following formula:
[0028]
[0029] Among them, y pred is the prediction result of the target variable; N is the number of decision units; y i , tree is the prediction result of the target variable by the i-th decision unit.
[0030] Compared with the prior art, the present invention has at least the following beneficial effects: it enables the nitrogen, phosphorus and potassium contents to be fitted more accurately. It can be deployed anywhere in the farmland in an integrated manner, which can solve the problems of long-distance transmission difficulties and insufficient power supply. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to make the purpose, technical solution and beneficial effects of the present invention clearer, the present invention provides the following drawings for illustration:
[0032] Figure 1 This is a structural block diagram of an outdoor remote soil detection and analysis device according to an embodiment of the present invention;
[0033] Figure 2 This is a specific structural block diagram of an outdoor remote soil detection and analysis device according to an embodiment of the present invention;
[0034] Figure 3 Schematic diagram of the structure of an outdoor remote soil detection and analysis device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0035] The preferred embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0036] See the device embodiment Figure 1 , Figure 2 , including a processor 10, an information collector 20, a remote server 30, a power module 40 and a charging module 50, wherein:
[0037] The processor 10 receives the data and signals transmitted by the information collector 20, processes and analyzes them, and then uploads them to the remote server 30; the power module 40 is charged by the charging module 50 to supply power to the information collector 20;
[0038] The processor 10 includes a connected Raspberry Pi 11 and a second Lora module 12; the information collector 20 includes a sensor group 21, a relay 22 and a first Lora module 23 that are all connected to each other; the first Lora module 23 communicates with the second Lora module 12, and the second Lora module 12 also receives the detection return value of the first Lora module 23.
[0039] The first Lora module 23 receives a control signal sent by the second Lora module 12 , where the control signal is generated by the Raspberry Pi 11 and sent to the second Lora module 12 .
[0040] The first Lora module 23 controls the switch of the relay 22 according to the control signal sent by the second Lora module 12 .
[0041] The first Lora module 23 only responds to the preset modbus wake-up command and turns on the relay 22 to work.
[0042] See also Figure 2 The sensor group 21 includes a seven-in-one sensor 211, which detects the temperature, humidity and conductivity of the soil.
[0043] The charging module 50 includes a solar panel 51 and a boosting panel 41 , and the power module 40 is located on the right side of the boosting panel 41 .
[0044] See also Figure 3 , is a schematic diagram of the device structure of the present invention. The top layer is a solar panel 51, which is designed with an inclined surface to drain rainwater. The power module 40 is inside the sphere, which is high and dry from the ground; the circuit part 60 is inside the cylindrical warehouse, including the relay 22 and the first Lora module 23. The segmented assembly is convenient for later maintenance, and the components are arranged on different surfaces for easy installation. It also includes a support cover 61, which supports the entire device when in use to make it upright. The bottom is the installation position of the sensor group 21, and the lower part is thickened to isolate the ground water vapor.
[0045] The processor 10 can control multiple information collectors 20 to detect at the same time. Long-range low-power radio frequency technology is used for communication. The seven-in-one sensor 211 can detect soil moisture, temperature and conductivity values. The processor 10 includes a Raspberry Pi 11 main control board and a second Lora transceiver. When in use, the processor 10 sends a signal to the first Lora module 23. After receiving the signal, the first Lora module 23 responds and transmits the return value to the processor 10. The processor 10 analyzes the data and calculates the KNP value of the soil.
[0046] In order to achieve continuous use and remote wake-up, the present invention adopts photovoltaic self-generation technology and corresponding energy-saving measures, including the use of long-distance low-power communication technology. The entire information collector 20 enters a low-power mode, and the power is cut off by the relay 22 to shut down the information collector 20 and change the communication mode. During this period, the information collector 20 only responds to specific modbus wake-up commands, reducing the analysis and processing of various signals and reducing overall power consumption.
[0047] The present invention integrates the sensor group 21 and the relay 22 in one place by using port multiplexing technology, and controls them separately through the modbus communication protocol, effectively increasing the integration of the information collector 20. The integration of information transmission and control of the power supply of the sensor group 21 by using one port improves the efficiency and reliability of the system, making it more suitable for outdoor remote soil monitoring applications.
[0048] Traditional technology uses conductivity to directly calculate the nitrogen, phosphorus and potassium content according to a fixed ratio, and the error is large. The present invention first obtains the required soil sample in the tea garden, then adds substances containing nitrogen, phosphorus and potassium to the soil, and then adds water to the soil. After drying the soil, the accurate nitrogen, phosphorus and potassium content values of the soil under different water contents and different quantitative fertilizers are tested and included in the data analysis system, and then the soil sensor group 21 is used to measure the temperature, conductivity, water content and pH to determine the overall consumption of crops for nutrients. Then, the machine learning method is used to fit the corresponding nitrogen, phosphorus and potassium contents under different temperatures, humidity and conductivity through these data. Through the predicted trend of soil nutrient changes, the time for fertilization again can be predicted more accurately.
[0049] The present invention also provides an outdoor remote soil detection and analysis method using the above device, comprising the following steps:
[0050] S10, collect nitrogen, phosphorus and potassium content, conductivity, temperature and humidity of at least 2000 sets of experimental data, and use these experimental data as data sets for data preprocessing, and the preprocessing uses minimum-maximum normalization; specifically, the following formula is used, which is the normalization of data preprocessing to ensure that different features can be compared at the same scale during model training:
[0051]
[0052] Among them, x is the original value, x min is the minimum value of the feature, x max is the maximum value of the feature, x norm is the normalized value, and this feature refers to nitrogen, phosphorus and potassium content, conductivity, temperature and humidity;
[0053] S20, fitting the contents of inorganic salts of nitrogen, phosphorus and potassium through the numerical values of conductivity, temperature and humidity after pretreatment;
[0054] Wherein, S20 includes the following steps:
[0055] S21, decision tree construction: each decision tree randomly selects samples from the conductivity, temperature and humidity data sets for training;
[0056] S22, node splitting: At each decision tree node, the algorithm selects the best splitting method to distinguish different levels of nitrogen, phosphorus, and potassium content;
[0057] S23, leaf node prediction: at each leaf node, the average value of the nitrogen, phosphorus and potassium contents of the training samples of the node is calculated as the prediction of the nitrogen, phosphorus and potassium contents of the leaf node.
[0058] S22 specifically includes:
[0059] For each split point, the purity of the two child nodes after the split is calculated, expressed as the mean square error MSE, which is the calculation formula for calculating the mean square error, which is used to measure the average square difference between the model's predicted value and the actual value. In model training, it is assumed that all input data are standardized, so when calculating MSE, it is sufficient to only refer to the target value and the estimated value. The predicted value is obtained after training the model using the standardized data.
[0060]
[0061]
[0062] Among them, MSE left (θ) is the mean square error of the left child node; MSE right (θ) is the mean square error of the right child node; D left (θ) is the set of data points in the left subset after the split threshold θ is given; D right (θ) is the set of data points in the right subset after the split threshold θ is given; y i is the actual target value of the i-th data point; is the average value of the target values of all data points in the left child node; is the average value of the target values of all data points of the right child node;
[0063] Choose such that MSE left (θ)+MSE right (θ) The smallest split point θ is taken as the optimal split point;
[0064] Then perform feature selection: For each node, the algorithm selects the best splitting feature from all or a random subset of features. The selection method includes calculating the splitting index of each feature, that is, the mean square error, and selecting the feature that optimizes the splitting index, that is, the maximum mean square error.
[0065] S23 obtains the prediction result according to the following formula:
[0066]
[0067] Among them, y pred is the prediction result of the target variable; N is the number of decision units; y i , tree is the prediction result of the target variable by the i-th decision unit.
[0068] y pred The prediction result is calculated based on the three input features of conductivity, temperature and humidity. The target variable (nitrogen, phosphorus and potassium content) means that the prediction result is about the nitrogen, phosphorus and potassium content.
[0069] The average of these predicted values becomes the final prediction of the nitrogen, phosphorus and potassium content, generating a unique weight file under the data set. The model is generated using the random forest algorithm based on the data. The weight file is the parameter file of the model. Subsequent calls only require loading the weights, and there is no need to retrain each time. The file stores the parameter information of the model.
[0070] The above are only preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. An outdoor remote soil detection and analysis device, It is characterized in that It includes a processor, an information collector, a remote server, a power module and a charging module, among which: The processor receives the data and signals transmitted by the information collector, processes and analyzes them, and then uploads them to the remote server; the power module is charged by the charging module to supply power to the information collector; The processor includes a Raspberry Pi and a second Lora module connected to each other; the information collector includes a sensor group, a relay and a first Lora module that are all connected to each other; and the first Lora module communicates with the second Lora module.
2. The device according to claim 1, It is characterized in that The first Lora module receives a control signal sent by the second Lora module, where the control signal is generated by the Raspberry Pi and sent to the second Lora module.
3. The device according to claim 1, It is characterized in that The first Lora module controls the switch of the relay according to the control signal sent by the second Lora module.
4. The device according to claim 1, It is characterized in that The first Lora module only responds to the preset modbus wake-up command and turns on the relay.
5. The device according to claim 1, It is characterized in that The sensor group includes a seven-in-one sensor for detecting the temperature, humidity and conductivity of the soil.
6. The device according to claim 1, It is characterized in that The charging module includes a solar panel.
7. The device according to claim 1, It is characterized in that The charging module also includes a boost board.
8. An outdoor remote soil detection and analysis method using the device according to any one of claims 1 to 7, It is characterized in that The following steps are involved: S10, collecting nitrogen, phosphorus and potassium content, conductivity, temperature and humidity of at least 2000 sets of experimental data, and performing data preprocessing on these experimental data as data sets, wherein the preprocessing uses minimum-maximum normalization; S20, fitting the contents of inorganic salts of nitrogen, phosphorus and potassium through the numerical values of conductivity, temperature and humidity after pretreatment; Wherein, S20 includes the following steps: S21, decision tree construction: each decision tree randomly selects samples from the conductivity, temperature and humidity data sets for training; S22, node splitting: At each decision tree node, the algorithm selects the best splitting method to distinguish different levels of nitrogen, phosphorus, and potassium content; S23, leaf node prediction: at each leaf node, the average value of the nitrogen, phosphorus and potassium contents of the training samples of the node is calculated as the prediction of the nitrogen, phosphorus and potassium contents of the leaf node.
9. The method according to claim 8, It is characterized in that The S22 specifically includes: For each split point, the purity of the two child nodes after the split is calculated, expressed as the mean square error, Among them, MSE left (θ) is the mean square error of the left child node; MSE right (θ) is the mean square error of the right child node; D left (θ) is the set of data points in the left subset after the split threshold θ is given; D right (θ) is the set of data points in the right subset after the split threshold θ is given; y i is the actual target value of the i-th data point; is the average value of the target values of all data points in the left child node; is the average value of the target values of all data points of the right child node; Choose such that MSE left (θ)+MSE right (θ) The smallest split point θ is taken as the optimal split point; Then perform feature selection: For each node, the algorithm selects the best splitting feature from all or a random subset of features. The selection method includes calculating the splitting index of each feature, that is, the mean square error, and selecting the feature that optimizes the splitting index, that is, the maximum mean square error.
10. The method according to claim 8, It is characterized in that The S23 specifically obtains the prediction result according to the following formula: Among them, y pred is the prediction result of the target variable; N is the number of decision units; y i , tree is the prediction result of the target variable by the i-th decision unit.
