Embedded Optical Soil Moisture Measurement System Using Multi-Color-Space Feature Fusion with Soil-Specific Runtime Calibration

Embedded Optical Soil Moisture Measurement System Using Multi-Color-Space Feature Fusion with Soil-Specific Runtime Calibration

Mostafa Satea Haider F. Mahmood* Kussay A. Subhi Nihad Abdulkudhur Jasim

Technical College/Al-Mussaib, Al-Furat Al-Awsat Technical University, Babylon 51006, Iraq

Corresponding Author Email: 
haider.fawzi@atu.edu.iq
Page: 
19-28
|
DOI: 
https://doi.org/10.18280/i2m.250103
Received: 
8 December 2025
|
Revised: 
28 January 2026
|
Accepted: 
5 February 2026
|
Available online: 
28 February 2026
| Citation

© 2026 The authors. This article is published by IIETA and is licensed under the CC BY 4.0 license (http://creativecommons.org/licenses/by/4.0/).

OPEN ACCESS

Abstract: 

In this paper, an embedded real-time soil moisture estimator with feature fusion in multiple color spaces and a low-cost red–green–blue (RGB) sensor is presented. The system utilizes a TCS34725 RGB sensor and an ESP32 to estimate soil reflectance under controlled lighting conditions. In order to improve robustness to environmental changes, the normalized RGB values are converted to hue–saturation–value (HSV) and CIE 1976 L*a*b* (CIELAB) color spaces, and the soil moisture index (SMI) is estimated using feature fusion. The soil moisture values are estimated using a soil-specific polynomial regression calibration model, which is computationally efficient. The system can be used for precision agriculture and environmental monitoring applications. The system can measure soil moisture levels accurately, thus enabling optimized irrigation and crop yield. The system can achieve a Mean Absolute Error (MAE) of 1.18%, a Root Mean Square Error (RMSE) of 1.42%, and an R² of 0.92 using gravimetric measurements, with a response time of less than 1 s. The system was tested using five types of soils: sandy loam, clay, silt loam, potting mix, and agricultural topsoil, over a range of 0–100% gravimetric moisture content under laboratory and field conditions. The results indicate that soil moisture estimation using the fusion of multiple color spaces is comparable to, and in some cases better than, conventional capacitive and optical soil moisture estimation methods.

Keywords: 

embedded measurement system, soil moisture measurement, optical sensor, sensor fusion, color space analysis, calibration, instrumentation, precision agriculture

1. Introduction

Soil moisture content is a vital parameter used in many engineering and environmental applications. In recent times, the demand for efficient and automated monitoring systems has created the need for developing techniques for soil moisture estimation [1, 2]. However, the cost, scalability, and environmental dependence of many soil moisture estimation techniques limit their application in automated systems [3]. In recent times, many studies have been conducted to develop techniques for soil moisture estimation using optical methods. These techniques are found to be more accurate [4, 5]; however, they are not suitable for embedded systems due to their computational requirements.

Soil moisture estimation techniques are broadly classified into two categories: direct and indirect methods. Direct methods, such as gravimetric analysis, are found to be more accurate [6, 7]. However, they are not suitable for real-time systems. In indirect methods, soil moisture estimation is performed using capacitive and resistive sensors [8, 9]. These methods are found to be more suitable for embedded systems; however, they are more dependent on soil composition, temperature, and long-term calibration. Therefore, many researchers are seeking new methods to estimate soil moisture.

To overcome these limitations, recent studies have explored multi-color space analysis to improve feature discrimination and robustness under varying illumination conditions [10-13]. This approach involves transforming red–green–blue (RGB) values into hue–saturation–value (HSV) and CIE 1976 L*a*b* (CIELAB) values, thus enabling improved separation of chromatic and luminance components [14, 15].

Despite the application of this technique, most of the recent research studies are based on computationally intensive processing techniques and are not specifically designed for embedded systems [12].

In this regard, the need for a computationally efficient and robust feature estimation technique is essential in the estimation of soil moisture levels in diverse soil and environmental conditions [16]. The improvement of the robustness of the optical sensing technique is a significant challenge in the estimation of soil moisture levels in a computationally efficient and low-complexity manner.

The aim and objectives of this research study are to propose a feature fusion-based embedded system for the estimation of soil moisture levels in real-time using a low-cost RGB sensor device. The proposed system is based on the application of the RGB, HSV, and CIELAB color values in the estimation of the soil moisture index (SMI), thus improving the robustness of the soil moisture estimation technique in diverse soil and environmental conditions. Unlike conventional RGB-based approaches, the proposed method utilizes multi-color-space feature fusion in a computationally efficient manner to enhance estimation stability without increasing system complexity.

The overall objective of this study and its main contributions are summarized as follows:

  1. An embedded system is developed for soil moisture estimation using multi-color-space feature fusion and low-cost RGB-based sensing techniques.
  2. The system enables the generation of a physically interpretable SMI using runtime calibration along with temperature compensation.
  3. The system performance is experimentally validated across multiple soil types and moisture levels under both laboratory and field conditions.

The remainder of this paper is organized as follows: Section 2 presents the system architecture and methodology, Section 3 presents the results and discussion, and Section 4 concludes the study.

2. Materials and Methods

2.1 Hardware components and setup

This soil moisture detection system was designed on the basis of a TCS34725 RGB color sensor (Adafruit Industries, USA) to be used as the main sensing element. It combines RGB and clear light sensors in one device, 3.3 V logic level technology, and programmable gain and integration time. The existing system architecture includes the following:

  1. IR blocking filter with a TCS34725 RGB color sensor
  2. An ESP32-WROOM 32D microcontroller (Espressif Systems, China)
  3. White light emitting diode (LED) array (6 LEDs, 6500 K color temperature) for stable illumination
  • Printed circuit board that is custom-made to hold components
  • Environmental protection 3D housing (PLA material)
  • Environment monitoring: Temperature and humidity sensor (DHT22)

The sensor assembly was housed in a matte gray device 25 mm above the soil, while the LED array was centered and arranged in a circular formation to provide uniform illumination. We used a 3.7 V, 2000 mAh LiPo battery with an onboard charging circuit to supply power to the whole system.

All hardware components were commercially available on off-the-shelf modules.

2.2 Soil sample preparation and characterization

Five types of representative soil have been selected to evaluate the performance and suitability of the proposed system for measuring the soil moisture levels. The types of soil selected for the experiment are:

  1. Sandy loam (sand 63%, silt 28%, clay 9%)
  2. Clay soil (18% sand, 35% silt, and 47% clay)
  3. Silt loam (20% sand, 65% silt, 15% clay)
  4. Commercial potting mix
  5. Agricultural topsoil

All the soils were air-dried before the experiment and then oven-dried at 105 ℃ for 24 hours to determine the dry mass corresponding to a moisture content of 0%. Distilled water was added in increments to each type of soil to create test samples with predetermined moisture levels corresponding to 0%, 20%, 40%, 60%, 80%, and 100% gravimetric moisture content. After the addition of water, the soil was mixed and sealed to create uniform moisture levels.

All moisture levels in this study are expressed as gravimetric water content (%), calculated as the ratio of water mass to dry soil mass. The predefined levels (0 – 100%) refer to controlled gravimetric preparation and do not represent field capacity.

Gravimetric soil moisture content was used as the target variable and determined using the conventional oven-drying method at 105 ℃ for 24 hours. This was done according to conventional soil analysis. For each soil type and moisture content level, 50 repeated measurements were conducted. This gave a total of 1,500 samples [17].

To avoid data leakage or overfitting of the results, the data for calibration was strictly kept separate from the data for evaluation. For each soil type, a set of moisture content levels was set aside for the sole purpose of calibrating the coefficients for the soil type. The rest of the data was set aside for separate validation. This ensures that the results obtained here reflect the generalization capability of the approach rather than the results of data calibration.

Soil samples were prepared under controlled conditions before carrying out the tests. All tests were conducted under the same preparation, illumination, and sensing protocol. This ensures the results obtained here reflect the reproducibility of the approach.

2.3 Color space analysis and intelligent feature fusion

The developed color space analysis can be represented as a structured multi-stage processing pipeline for embedded real-time estimation of soil moisture levels. The processing pipeline starts with the measurement of raw RGB values from the TCS34725 color sensor at controlled LED lighting conditions. To reduce the impact of illumination and sensor sensitivity on RGB values, the measured RGB values are corrected by clear channel and total brightness values.

After that, a set of HSV and CIELAB color spaces, which represent the RGB values, is employed to enhance the discriminability of features. The HSV color space helps separate colors and brightness variations, and CIELAB is used for better adjustment of lightness and perception consistency at varying lighting conditions, which is useful for analyzing surfaces at varying illumination conditions [18, 19].

Finally, a set of physically meaningful and computationally efficient features is extracted from these representations. These features include a normalized red channel intensity (Rn) from RGB values, a saturation parameter (S) from HSV values, and a lightness parameter (L*) from CIELAB values. These parameters have a high correlation with soil moisture levels and are less sensitive to illumination conditions.

For integrating these features, a feature-level fusion approach with a soil-dependent calibration scheme is employed. To ensure consistency between variables from different color spaces, all features (Rn, S, L*) are normalized to the range [0–1] before fusion.

The fusion results in an SMI, expressed as a weighted combination of the extracted features with temperature compensation, as follows:

$S M I=w_1 \cdot R_n+w_2 \cdot S+w_3 \cdot\left(\frac{L^*}{100}\right)-\gamma\left(T-T_0\right)$         (1)

The temperature coefficient γ is defined per degree Celsius and applied after normalization of the feature variables. The weighting coefficients (w₁, w₂, w₃) are determined during calibration and constrained to ensure balanced contribution of each feature. This formulation ensures that no single feature dominates due to scale differences, where Rn is the normalized red band intensity, S is the HSV saturation component, and L* is the CIELAB lightness parameter. The variable T denotes ambient temperature sensed by the embedded sensor, whereas T0 is a reference calibration temperature, w₁, w₂, w₃, and γ are calibration coefficients, which are soil-type dependent and computed during the calibration step.

These calibration coefficients are stored in the non-volatile memory of the embedded system. During runtime, these coefficients are set according to the identified soil type. Thus, this approach is adaptive to different soil types without adding any complexity to the proposed scheme.

Figure 1 shows the entire processing method, which includes RGB normalization, color-space transformation, feature extraction, and soil-specific calibration.

Figure 1. Flowchart of the proposed intelligent multi-color-space fusion system

The complete processing workflow, including normalization, color-space transformation, feature extraction, soil-specific calibration, and SMI computation, is formally summarized in Algorithm 1.

Algorithm 1. Soil moisture estimation using multi-color-space feature fusion

Inputs: soil_id — soil type identifier (selected by user or stored profile)

        N = 100 — number of raw samples per estimation cycle

        Δt = 10 ms — sampling interval

        W = 10 — rolling average window length

        k = 2 — outlier rejection threshold (±)

        T0 — reference temperature for calibration

 

Sensors: TCS34725 — provides raw R, G, B, and clear (C) channels

          DHT22 — provides ambient temperature T

Outputs: — estimated soil moisture (%), continuous value

          SMI — soil moisture index (dimensionless or scaled)

 

Procedure:

1: Initialize system; activate LED illumination; allow stabilization (t ≥ 300 ms)

2: (w1, w2, w3, γ, a, b) ← LoadCoefficients(soil_id)

      ▷ w1, w2, w3, γ: feature fusion and temperature-compensation coefficients

      ▷ a, b (or polynomial coefficients): calibration mapping SMI → moisture

3: T ← ReadTemperature(DHT22)

4: for i = 1 to N do

5: (R, G, B, C) ← ReadColor(TCS34725)

6: if C = 0 then continue    

▷ Avoid division by zero

▷ Normalize RGB components using the clear channel C

7: Rη[i] ← R / C

8: Gη[i] ← G / C

9: Bη[i] ← B / C

10: wait Δt

11: end for

▷ Outlier removal applied to Rη; optionally applied to Gη and Bη

12: μ ← Mean(Rη);   σ ← Std(Rη)

13: Rη,f ← FilterByThreshold(Rη, μ, μ + )

▷ Rolling average smoothing

14: Rη,s ← RollingMean(Rη,f, W)

▷ Color space transformation using the last smoothed normalized values Rη,slast, Gη,slast, Bη,slast

15: (H, S, V) ← RGB_to_HSV(Rη,slast, Gη,slast, Bη,slast)

16: (L*, a*, b*) ← RGB_to_CIELAB(Rη,slast, Gη,slast, Bη,slast)

▷ Compute Soil Moisture Index with temperature compensation

17: SMI ← w1 · Rη,slast + w2 · S + w3 · L*γ · (TT0)

▷ Map SMI to moisture via soil-specific calibration (e.g., polynomial regression)

18: ← CalibMap(SMI; soil_id)

      e.g., = p2 · SMI2 + p1 · SMI + p0

▷ Clamp to physical range

19: ← Clamp(, 0, 100)

20: Return (, SMI)

End Algorithm

Algorithm 1 summarizes the complete embedded processing sequence, including RGB normalization, multi-color-space transformation, feature extraction, SMI computation, and calibration-based mapping to moisture content. The algorithm is designed to operate in real time with low computational complexity, making it suitable for embedded and automated monitoring systems.

The soil-specific fusion coefficients used in the computation of the SMI are summarized in Table 1.

Table 1. Soil-specific fusion coefficients used for soil moisture index (SMI) computation

Soil Type

w₁ (Rₙ)

w₂ (S)

w₃ (L*)

γ (Temp. coeff.)

Sandy loam

0.42

0.28

0.30

0.015

Clay soil

0.35

0.25

0.40

0.020

Silt loam

0.38

0.30

0.32

0.017

Potting mix

0.45

0.22

0.33

0.012

Agricultural topsoil

0.40

0.27

0.33

0.018

2.4 Calibration procedure

The calibration process was designed with the objective of identifying specific fusion and mapping numbers for accurate soil moisture estimation using the new multi-color-space fusion method. Calibration was carried out for each type of soil, considering differences in texture, surface reflectance, and soil reaction to moisture.

To carry out the calibration process for different types of soils, experiments were conducted for each type of soil using pre-defined gravimetric moisture levels prepared as per the details given in Section 2.2. A portion of the defined moisture levels was reserved for the validation process to avoid any data leakage or overlap between the calibration and validation sets. The experiments were conducted under controlled illumination using the integrated LED array and under controlled environmental conditions.

During the calibration process, the normalized RGB values were obtained for the soil samples and then converted to HSV and CIELAB color spaces using the processing steps as per Algorithm 1. The normalized red intensity (Rn), HSV saturation (S), CIELAB lightness (L*), and ambient temperature (T) were obtained for the calibration process using the embedded temperature sensor.

The SMI calculation was carried out using the weighted fusion model defined in Section 2.3. The soil-specific coefficients w₁, w₂, w₃, and γ used in the weighted fusion model were determined empirically using a least-squares optimization method by minimizing the estimation errors of the calculated SMI and the reference value of gravimetric soil moisture content.

After obtaining the SMI value, a soil-specific calibration mapping function was derived to convert the SMI value into a gravimetric soil moisture content value. In this work, a second-order polynomial regression model was used to establish a mapping function relating SMI and soil moisture content. The mapping function can be written as follows:

$M=p_2 \cdot S M I^2+p_1 \cdot S M I+p_0$        (2)

where, M represents the calculated soil moisture content value.

All coefficients used in the weighted fusion model, w₁, w₂, w₃, and γ, were stored in the non-volatile memory of the ESP32 microcontroller. During runtime operation of the proposed system, a specific set of coefficients used in the proposed system can be retrieved based on the selected soil profile.

The proposed calibration method ensures consistency in mapping functions between the proposed calibration method and the embedded system implementation of Algorithm 1. This consistency allows for reproducible and efficient soil moisture estimation using a specific soil type.

2.5 Data collection and processing

The following protocol was followed for data acquisition and processing:

  1. Console power on and basic self-calibration (30 seconds)
  2. Background light measurement
  3. Activation of the LED illumination source
  4. Acquisition of 100 color samples at 10 ms intervals
  5. Statistical outlier removal
  6. Computation of a rolling average over the most recent 10 samples
  7. Color-space transformation and calculation of the soil moisture index

2.6 Experimental validation procedure

The proposed experimental validation procedure aims to provide an objective evaluation of the accuracy, robustness, and real-time characteristics of the proposed embedded soil moisture estimation system while maintaining the integrity of the data used in the calibration and validation processes. In this regard, the validation experiments have been conducted in the laboratory and real-world environments.

In addition, gravimetric soil moisture measurements were considered as the primary reference for evaluation, while a commercially available Time Domain Reflectometry (TDR)-based soil moisture meter (TDR 150, Spectrum Technologies, USA) was used as a secondary reference device for comparative analysis.

2.6.1 Laboratory validation

During the laboratory validation process, experiments have been conducted under controlled environmental conditions with a temperature range of 22 ± 2 ℃ and relative humidity of 45 ± 5%. For the validation process, the samples of the soil with certain levels of moisture have been placed under the sensing module of the proposed system while maintaining a fixed distance from the surface of the soil and under controlled lighting conditions using an LED light source.

During the validation process, the data samples have been strictly separated from the data samples used in the calibration process to avoid data leakage. In this regard, the coefficients of the proposed system have been determined for each type of soil using a predefined set of moisture levels during the calibration process, while the remaining set of moisture levels has been reserved exclusively for validation.

For each validation process of the proposed system, the data samples have been recorded 50 times while maintaining the same conditions of the soil to improve statistical reliability. In this regard, the accuracy of the proposed system has been compared with the gravimetric method of measuring the soil moisture levels. In addition, measurements obtained from the TDR-based device were recorded following the manufacturer’s recommended procedure and used for comparative evaluation.

2.6.2 Field validation

The field validation aimed to validate the system under realistic conditions with varying illumination and temperature. The experiments were carried out under different conditions, such as direct sunlight, shaded conditions, and night conditions with only LED illumination.

In the field validation, the soil types and moisture levels used were similar to those used in the laboratory validation. The calibration coefficients were not changed in the field validation in order to evaluate the generalization capability of the proposed system. The soil sensors were kept at a fixed height above the soil surface, as in the laboratory validation.

In order to validate the long-term stability of the system, the soil sensors were evaluated continuously for a period of 30 days. During the evaluation period, periodic measurements were recorded under varying conditions. Measurements from the TDR-based device were also recorded under the same conditions for comparison purposes. If any drift in the estimation accuracy of the sensors was observed, the results were recorded.

2.6.3 Validation metrics and protocol consistency

In the validation experiments carried out in the laboratory and in the field, similar conditions were maintained with regard to sensor configuration, illumination conditions, sampling period, and data processing conditions to ensure consistency.

The results were validated using different metrics such as error in estimation, correlation with reference measurements, and response time. In addition, statistical indicators such as standard error and confidence intervals were considered where applicable to support the reliability of the obtained results.

2.7 Statistical analysis and performance evaluation

The statistical assessment was carried out in a manner such that the accuracy and reliability of the proposed soil moisture estimation scheme could be determined. The following analyses were conducted:

  1. Calculations of error and precision measures, such as Mean Absolute Error (MAE) and Root Mean Square Error (RMSE), in comparison to gravimetric measurements
  2. Calculations of correlation coefficients for parameters obtained from color and their correlation with moisture content
  3. Developing a calibration model via multiple regression analysis to map the SMI to gravimetric moisture content
  4. Comparative analysis for different soil types
  5. Calculations for standard error and 95% confidence interval for the prediction of moisture content based on repeated measurements

2.8 System architecture and software implementation

The soil moisture estimation system can be implemented using a three-way intelligent system architecture that supports real-time processing and adaptive decision-making for efficient implementation in an embedded system. The system architecture defines the functions of sensing, processing, and application.

Sensor Interface Layer: This layer deals directly with communication between the sensing hardware components. This layer receives the raw data in the form of RGB and luminance readings from the TCS34725 sensor in controlled LED illumination settings. This layer also deals with the control and synchronization of the LEDs and receives environmental data such as temperature and humidity readings from the DHT22 sensor.

Processing Layer: The processing layer is the central component of the intelligent system. It involves RGB normalization, multi-color space transformation (RGB to HSV & LAB), and feature extraction on saturation, lightness, and correlated color temperature. Adaptive soil-specific calibration is performed using pre-computed coefficients stored in non-volatile memory. Next comes the intelligent feature-level fusion approach that combines the soil-specific features of varied color spaces using weighted decision logic to obtain a reliable SMI in real-time.

Application Layer: The application layer deals with user interaction, visualization, and system management. The application layer enables real-time display of estimated soil moisture values, provides data logging capabilities for historical review, and enables traceability of calibration procedures. The application layer makes it easy for the sensing system to be integrated into higher-level systems for monitoring or decision-making.

The system software is implemented through the use of the Arduino IDE in combination with the ESP IDF library. This is in addition to the development of C++ class libraries. The system software is designed in a layered system. This is to ensure low computational complexity.

2.9 Error analysis 

The accuracy of the systems was also evaluated as follows:

  1. Comparison of our results with gravimetric measurements
  2. Exploring the factors that influence the environment
  3. Evaluation of temporal stability
  4. Commercial moisture sensor cross-validation

The uncertainty in the measurement was calculated as follows:

  1. Sensor resolution and noise level
  2. Temperature effects
  3. Ambient light interference · Ambient light noise
  4. Heterogeneity of the soil surface
3. Results and Discussion

3.1 Overall system estimation performance

The proposed embedded system's overall estimation performance was evaluated using a controlled lab environment following the steps outlined in Section 2.6. The quantitative evaluation parameters are presented in Table 2, where only regression-based errors are used instead of classification-based errors.

As shown in Table 2, the proposed system's overall estimation performance was found to have an MAE of 1.18%, a RMSE of 1.42%, and a standard error of ±1.2%. The average response time of 0.8 seconds shows that the proposed system's estimation performance is good enough to be used in embedded systems.

The proposed system's estimation performance using a new multi-color space fusion framework shows less estimation error in lab tests compared to traditional methods that only use a single-color space in RGB-based soil moisture estimation systems. This shows that using a combination of different useful features, as explained in Algorithm 1, rather than a single optical parameter, improves system estimation performance.

Table 2. Overall estimation performance under laboratory conditions

Metric

Value

Standard Deviation

Confidence Interval 95%

n

MAE (%)

1.18

0.32

1.12 – 1.24

1500

RMSE (%)

1.42

0.41

1.34 – 1.50

1500

0.92

N/A

N/A

1500

SE (%)

1.20

N/A

N/A

1500

Response Time (s)

0.80

0.10

0.78 – 0.82

300

Note: MAE = Mean Absolute Error, RMSE = Root Mean Square Error, SE = Standard Error

3.2 Color-space feature contribution analysis

In order to understand how color space features are useful in soil moisture estimation systems, a correlation analysis was performed on the extracted color space features with the reference value of gravimetric moisture content. The correlation analysis results are presented in Table 3; a visual representation of correlation strengths is shown in Figure 2.

As can be observed from Table 3, the normalized value for the red color channel exhibits a high correlation with the moisture content in the soil (r = 0.89), which was expected based on previous studies on optical sensing for soil [20]. The highest correlation was observed with the CIELAB lightness value, The highest correlation was observed for the CIELAB lightness value, which exhibited a strong correlation (r = 0.91) with gravimetric soil moisture content.

Table 3. Correlation analysis between color-space features and soil moisture

Feature

Color Space

Correlation (r)

p-value

Effective Moisture Range

Red channel (Rₙ)

RGB

0.89

< 0.001

20 – 80%

Green channel

RGB

0.85

< 0.001

30 – 90%

Blue channel

RGB

0.82

< 0.001

10 – 70%

Saturation (S)

HSV

0.88

< 0.001

0 – 100%

Value (V)

HSV

0.84

< 0.001

15 – 85%

Lightness (L*)

CIELAB

0.91

< 0.001

5 – 95%

Figure 2. Comparison of correlation coefficients between soil moisture and different color space parameters

This indicates the rationale for the multi-color space feature fusion approach, where no single-color space parameter was found to dominate the others for the complete range of moisture content in the soil. Previous studies have shown similar observations for the limitations of analyzing features within a single domain for color [21]. The features obtained from the RGB, HSV, and LAB color spaces are collectively representative of the changes in the moisture level within the soil over time.

3.3 Environmental robustness analysis

To assess the robustness of the proposed system with respect to varied environmental conditions, experiments were performed at controlled laboratory and outdoor conditions. Quantitative results are provided in Table 4, while the changes in estimation error at varied illumination conditions are demonstrated in Figure 3.

Table 4. Estimation performance under different environmental conditions

Environment

MAE (%)

RMSE (%)

Response Time (s)

Temperature (℃)

Illumination

Indoor (controlled)

1.0

1.3

0.8

22

500 lux

Direct sunlight

1.5

1.9

0.9

28

> 10000 lux

Overcast

1.2

1.5

0.7

20

2000 lux

Night (LED only)

1.3

1.6

0.8

18

< 10 lux

High humidity

1.7

2.1

1.1

25

1000 lux

Note: MAE = Mean Absolute Error, RMSE = Root Mean Square Error, LED = Light Emitting Diode

Figure 3. Estimation error of the proposed system under different environmental conditions

As can be observed in Table 4, the lowest estimation error is achieved under a lab-controlled environment, and a moderate increase in MAE is observed when direct sunlight is applied. The estimation errors achieved by the proposed approach are still at acceptable levels despite the significant changes in lighting conditions. This was expected based on previous observations for optical sensing for soil, which indicated a reduction in performance for high levels of irradiance [22].

The normalization approach and the temperature-compensated SMI approach presented in Algorithm 1 are responsible for the acceptable performance for all environments. The approach based on the fusion of features from the RGB, HSV, and LAB color spaces was found to reduce the effects of variations in the environment, which improves its reliability during operation compared to methods based on the raw features from the RGB color space [13].

3.4 Soil-type-specific performance analysis

The performance of the system with different types of soil is evaluated to determine the effectiveness of runtime calibration based on different types of soil. Table 5 shows the estimation error and response time with different types of soil, whereas Figure 4 shows the consistency of the proposed system with different types of soil.

As shown in Table 5, potting mix and sandy loam types of soil have the lowest estimation error. This is due to their homogeneous texture and optical characteristics. Clay-type soil has a higher estimation error and response time due to its heterogeneous texture and higher water retention capacity [23], which is identified as a challenge with optical sensing technologies [24]. Nevertheless, the proposed system has an estimation error of less than 2% with all types of soil, indicating that the proposed calibration factors are effective in compensating for the difference due to texture-related optical characteristics.

Figure 4. Estimation performance of the proposed system across different soil types

Table 5. Soil-type-specific estimation performance

Soil Type

MAE (%)

RMSE (%)

Response Time (s)

Calibration Offset

Potting mix

1.0

1.3

0.7

+1.5%

Sandy loam

1.1

1.4

0.8

+1.8%

Agricultural topsoil

1.3

1.6

0.9

+2.0%

Clay soil

1.6

2.0

1.2

+2.3%

Silt loam

1.5

1.9

1.0

+3.1 %

Note: MAE = Mean Absolute Error, RMSE = Root Mean Square Error

3.5 Comparative evaluation with conventional methods

Table 6 shows a comparative evaluation of the proposed system with conventional methods of measuring soil moisture. The proposed system is more effective with a lower estimation error and faster response time compared to conventional capacitive and resistive sensors, whereas it is more cost-effective compared to other conventional sensors. Although the gravimetric method is more effective compared to other conventional sensors, it is not effective with respect to real-time monitoring.

Table 6. Indicative comparison with conventional soil moisture measurement methods

Method

MAE (%)

Response Time

Cost per Unit

Maintenance

Calibration Interval

Proposed system

1.18

< 1 s

~$35

Quarterly

30 days

Capacitive sensor

~2.5

~2 s

~$65

Monthly

7 days

Resistive sensor

~3.5

~5 s

~$25

Monthly

14 days

Gravimetric (reference)

< 1.0

> 24 h

$200+

N/A

Per test

Note: MAE = Mean Absolute Error

In addition, a direct experimental comparison was performed with a commercially available TDR-based soil moisture sensor under identical conditions. The results of this comparison are presented in Table 7.

Table 7. Statistical comparison between the proposed system and the TDR-based sensor

Metric

Soil Type

Proposed System

TDR Sensor

t-value

p-value

MAE (%)

Sandy loam

1.10

2.20

3.12

0.006

MAE (%)

Clay soil

1.60

2.85

2.88

0.009

RMSE (%)

Sandy loam

1.40

2.65

3.25

0.004

RMSE (%)

Clay soil

2.00

3.10

2.71

0.012

Note: MAE = Mean Absolute Error, RMSE = Root Mean Square Error, TDR = Time Domain Reflectometry

It should be noted that the comparison presented in Table 6 is indicative rather than absolute due to differences in experimental conditions and sensor settings. In contrast, the comparison presented in Table 7 is based on controlled experimental conditions, providing a more direct and statistically supported evaluation. The aforementioned cost-performance trade-offs have also been noted in recent comparative studies on low-cost soil moisture sensing technologies [23].

3.6 Estimation performance across moisture ranges

Estimation error was also evaluated at various levels of moisture content to see how this system performs when it is in a dry state, somewhat wet, and almost fully wet. The results obtained in this experiment are summarized in Table 8, while Figure 5 shows a graphical representation of these results.

Figure 5. Performance comparison between the proposed system and conventional soil moisture measurement methods

From Table 8, it is noted that the minimum estimation error is obtained when the soil is in a dry state, with a moisture content ranging from 0% to 20%. The estimation error gradually increases as the moisture content is increased to near saturation levels. This is because, at high levels of moisture content, the contrast in reflectance is less pronounced. This phenomenon is in accordance with previously noted limitations in surface-based optical soil moisture sensing technologies [24].

However, with the proposed method that utilizes a combination of various color spaces, a high estimation accuracy is obtained even at high levels of moisture content, compared to many other optical sensing technologies, as noted in other studies.

Table 8. Estimation error across soil moisture ranges

Moisture Range

MAE (%)

RMSE (%)

Standard Error

0 – 20% (Dry)

1.0

1.3

±1.2%

21 – 40%

1.1

1.5

±1.5%

41 – 60%

1.2

1.6

±1.8%

61 – 80%

1.4

1.9

±2.1%

81 – 100%

(Near saturation)

1.7

2.3

±2.4%

Note: MAE = Mean Absolute Error, RMSE = Root Mean Square Error

3.7 Resource utilization and operating modes

The proposed system’s Central Processing Unit (CPU) efficiency and power consumption were evaluated in various operating modes. The results obtained in this experiment are summarized in Table 9.

Table 9. Resource utilization under different operating modes

Operating Mode

CPU Usage

RAM Usage

Battery Life

Readings per Hour

Continuous

15%

24 KB

~48 h

3600

Periodic

(5 min)

8%

18 KB

~120 h

12

On-demand

12%

22 KB

~168 h

Variable

Low-power

5%

12 KB

~240 h

 

Note: CPU = Central Processing Unit, RAM = Random Access Memory

From Table 9, it is noted that in periodic measurement mode, a good balance is obtained between battery life and measurement frequency. CPU and memory utilization remain low in all cases, validating that the proposed processing scheme in Algorithm 1 is appropriate for resource-constrained platforms.

Embedded platforms similar to the proposed approach have been reported in recent studies, which indicate shorter battery lives even for similar operating conditions [25], thereby confirming the energy efficiency of the proposed approach.

3.8 Ablation study and model comparison

An ablation study was conducted to evaluate and compare the effectiveness of the proposed multi-color-space feature fusion estimation approach. For this purpose, estimation performance was compared for each color space feature and its fusion. The experiments were conducted under identical conditions and calibration, as described in Section 2.

Four configurations were considered:

(1) RGB-based estimation using the normalized red channel (Rn) only

(2) HSV-based estimation using saturation (S) only

(3) CIELAB-based estimation using lightness (L*) only

(4) The proposed multi-color-space fusion approach combining Rn, S, and L*

The performance comparison is summarized in Table 10.

From the obtained results, it is observed that the proposed estimation approach based on multi-color-space feature fusion outperforms significantly in terms of estimation accuracy in comparison to single-color-space-based methodologies. It is observed that although individual features in different color spaces are correlated to a certain extent with soil moisture levels, their individual use increases estimation error.

Table 10. Ablation study results for soil moisture estimation

Model Configuration

Features Used

MAE (%)

RMSE (%)

RGB only

Rn

2.31

2.85

0.81

HSV only

S

2.05

2.60

0.84

LAB only

L*

1.92

2.40

0.86

Proposed fusion

Rn + S + L*

1.18

1.42

0.92

Note: MAE = Mean Absolute Error, RMSE = Root Mean Square Error

On the other hand, the combination of multiple features provides a more representative characterization of soil reflectance, thereby improving estimation accuracy and stability. From the obtained results, it is observed that the proposed approach effectively addresses the limitations associated with a single color space.

4. Conclusions

This paper proposes a real-time system for measuring soil moisture using a cost-effective RGB sensor, which utilizes various color features. The proposed method models the estimation of soil moisture as a continuous regression problem, which is based on gravimetric measurements. The proposed method uses a weighted SMI that takes various color features, including normalized RGB, HSV, and CIELAB, as well as temperature values. The proposed method is implemented as a lightweight embedded system, which is capable of real-time processing.

The proposed method utilizes various color features, and its performance is analyzed for each color space, which shows that no single optical parameter is dominant for estimating soil moisture over the entire moisture range. The proposed method utilizes various color features, and their performance is analyzed, which shows the importance of the proposed method’s feature fusion approach.

The proposed method is tested and validated using various experiments, and its performance is analyzed, which shows its ability to accurately estimate soil moisture for various soils, moisture levels, and environmental conditions. The proposed method has a small estimation error, and its mean error is always within acceptable limits for monitoring soils using embedded systems.

A comparative evaluation with conventional gravimetric techniques shows that this system offers a promising trade-off in terms of estimation accuracy, response time, cost, and maintenance. Although gravimetric techniques offer a benchmark in terms of precision, this embedded solution is a viable option in real-time and high-scale applications where low cost and energy efficiency are essential considerations.

It is noted that this system shows poor performance when the soil is nearly saturated, and this shows the limitations of this solution. As a future extension, this method can be improved by using various light-sensing techniques, compensation for surface differences, and further data calibration to increase its reliability in highly wet conditions.

Overall, this proposed solution using a combination of various color spaces shows promising potential as a low-cost, accurate, and energy-efficient approach for automated applications in resource-constrained environments.

Nomenclature

B

Battery capacity, mAh

C

Clear channel intensity from RGB sensor (dimensionless)

K

Calibration constant (soil-specific), dimensionless

L*

CIELAB lightness component, dimensionless

M

Soil moisture content (gravimetric basis), %

N

Number of samples used for averaging, dimensionless

R

Red channel intensity (normalized), dimensionless

G

Green channel intensity (normalized), dimensionless

Bc

Blue channel intensity (normalized), dimensionless

Rn

Normalized red channel intensity, dimensionless

S

Saturation component in HSV color space, dimensionless

T

Soil surface temperature, ℃

tr

System response time, s

V

Value (brightness) component in HSV color space, dimensionless

Greek symbols

α

Weighting coefficient for normalized red channel, dimensionless

β

Weighting coefficient for HSV saturation, dimensionless

γ

Weighting coefficient for LAB lightness, dimensionless

θ

Temperature compensation factor, dimensionless

μ

Mean estimation error, %

σ

Standard deviation of estimation error, %

Subscripts

cal

Calibration data

est

Estimated value

ref

Reference (gravimetric measurement)

s

Soil-specific parameter

avg

Averaged value

  References

[1] Kılıç, Z. (2020). The importance of water and conscious use of water. International Journal of Hydrology, 4(5): 239-241. https://doi.org/10.15406/ijh.2020.04.00250

[2] Rajanna, G.A., Dass, A., Suman, A., Babu, S., Venkatesh, P., Singh, V.K., Upadhyay, P.K., Sudhishri, S. (2022). Co-implementation of tillage, irrigation, and fertilizers in soybean: Impact on crop productivity, soil moisture, and soil microbial dynamics. Field Crops Research, 288: 108672. https://doi.org/10.1016/j.fcr.2022.108672

[3] Yaseen, Z.M. (2021). An insight into machine learning models era in simulating soil, water bodies and adsorption heavy metals: Review, challenges and solutions. Chemosphere, 277: 130126. https://doi.org/10.1016/j.chemosphere.2021.130126

[4] Zhang, R., Song, C.X., Zhang, Z.C., Xie, J.B., Chen, T.Y., Xu, T. (2025). Machine learning for soil moisture analysis: A survey and emerging perspectives. International Journal of Data Science and Analytics, 21: 66. https://doi.org/10.1007/s41060-025-00977-8

[5] Yang, X.F., Chen, J.Y., Lu, X.H., Liu, H., Liu, Y.F., Bai, X.Q., Qian, L., Zhang, Z.T. (2025). Advances in UAV remote sensing for monitoring crop water and nutrient status: Modeling methods, influencing factors, and challenges. Plants, 14(16): 2544. https://doi.org/10.3390/plants14162544

[6] Placidi, P., Morbidelli, R., Fortunati, D., Papini, N., Gobbi, F., Scorzoni, A. (2021). Monitoring soil and ambient parameters in the IoT precision agriculture scenario: An original modeling approach dedicated to low-cost soil water content sensors. Sensors, 21(15): 5110. https://doi.org/10.3390/s21155110

[7] Zhang, Z.Y., Chen, Y.Y., Wu, K.X., Hong, Y.S., Shi, T.Z., Mouazen, A.M. (2024). On the parsimony, interpretability and predictive capability of a physically based model in the optical domain for estimating soil moisture content. Geoderma, 449: 116996. https://doi.org/10.1016/j.geoderma.2024.116996

[8] Yin, H., Cao, Y., Marelli, B., Zeng, X., Mason, A.J., Cao, C. (2021). Soil sensors and plant wearables for smart and precision agriculture. Advanced Materials, 33(20): 2007764. https://doi.org/10.1002/adma.202007764

[9] Mane, S., Das, N., Singh, G., Cosh, M., Dong, Y. (2024). Advancements in dielectric soil moisture sensor calibration: A comprehensive review of methods and techniques. Computers and Electronics in Agriculture, 218: 108686. https://doi.org/10.1016/j.compag.2024.108686

[10] Dhillon, R., Moncur, Q. (2023). Small-scale farming: A review of challenges and potential opportunities offered by technological advancements. Sustainability, 15(21): 15478. https://doi.org/10.3390/su152115478

[11] Mallareddy, M., Thirumalaikumar, R., Balasubramanian, P., Naseeruddin, R., et al. (2023). Maximizing water use efficiency in rice farming: A comprehensive review of innovative irrigation management technologie. Water, 15(10): 1802. https://doi.org/10.3390/w15101802

[12] Abdullah, H.M., Mohana, N.T., Khan B.M., Ahmed, S.M., et al. (2023). Present and future scopes and challenges of plant pest and disease (P&D) monitoring: Remote sensing, image processing, and artificial intelligence perspectives. Remote Sensing Applications: Society and Environment, 32: 100996. https://doi.org/10.1016/j.rsase.2023.100996

[13] Sirisathitkul, Y., Sirisathitkul, C. (2025). Decoding soil color: Origins, influences, and methods of analysis. AgriEngineering, 7(3): 58. https://doi.org/10.3390/agriengineering7030058

[14] Aytaç, E. (2023). Object detection and regression-based visible spectrophotometric analysis: A demonstration using methylene blue solution. ADCAIJ: Advances in Distributed Computing and Artificial Intelligence Journal, 12(1): e29120. https://doi.org/10.14201/adcaij.29120

[15] Nawandar, N.K., Satpute, V. (2019). IoT based intelligent irrigation support system for smart farming applications. ADCAIJ: Advances in Distributed Computing and Artificial Intelligence Journal, 8(2): 75-85. https://doi.org/10.14201/adcaij2019827585

[16] Du, Y.Y., Kang, F.J., Huang, Z.K., Wang, L.Y., Zhang, Y., Li, D.C., Zheng, G.H., Zeng, R. (2025). A comparative study of four color measurement methods for soil color identification and related properties prediction. Computers and Electronics in Agriculture, 230: 109801. https://doi.org/10.1016/j.compag.2024.109801 

[17] Al-Jburi, A.H.H., Mahmood, H.F., Subhi, K.A. (2024). Effects of ploughing techniques on soil hydraulic conductivity and infiltration rate. IOP Conference Series: Earth and Environmental Science, 1371(9): 092005. https://doi.org/10.1088/1755-1315/1371/9/092005

[18] Liu, G.S., Tian, S.K., Mo, Y.K., Chen, R.Y., Zhao, Q.S. (2022). On the acquisition of high-quality digital images and extraction of effective color information for soil water content testing. Sensors, 22(9): 3130. https://doi.org/10.3390/s22093130

[19] Hossain, M.R.H., Kabir, M.A. (2023). Machine learning techniques for estimating soil moisture from smartphone captured images. Agriculture, 13(3): 574. https://doi.org/10.3390/agriculture13030574

[20] Sifnaios, S., Arvanitakis, G., Konstantinidis, F.K., Tsimiklis, G., Amditis, A., Frangos, P. (2024). A deep learning approach for pixel-level material classification via hyperspectral imaging. arXiv preprint arXiv:2409.13498. https://doi.org/10.48550/arXiv.2409.13498

[21] Tariq, A., Mumtaz, F. (2023). Modeling spatio-temporal assessment of land use land cover of Lahore and its impact on land surface temperature using multispectral remote sensing data. Environmental Science and Pollution Research, 30(9): 23908-23924. https://doi.org/10.1007/s11356-022-23928-3

[22] de Carvalho Oliveira, G., Machado, C.C.S., Inácio, D.K., da Silveira Petruci, J.F., Silva, S.G. (2022). RGB color sensor for colorimetric determinations: Evaluation and quantitative analysis of colored liquid samples. Talanta, 241: 123244. https://doi.org/10.1016/j.talanta.2022.123244

[23] Ebstu, E.T., Hatiye, S.D., Goshime, D.W., Dingemanse, J.D., et al. (2026). Development and testing of a low-cost soil moisture sensor for real-time irrigation scheduling. Irrigation and Drainage, 75(1): 173-187. https://doi.org/10.1002/ird.70026 

[24] Lu, Y., Young, S., Wang, H., Wijewardane, N. (2022). Robust plant segmentation of color images based on image contrast optimization. Computers and Electronics in Agriculture, 193: 106711. https://doi.org/10.1016/j.compag.2022.106711

[25] Kushwaha, Y.K., Panigrahi, R.K., Pandey, A. (2024). Performance analysis of capacitive soil moisture and temperature sensors and their applications at farmers’ fields. Environmental Monitoring and Assessment, 196(9): 793. https://doi.org/10.1007/s10661-024-12946-y