Crimson Publishers Publish With Us Reprints e-Books Video articles

Full Text

COJ Electronics & Communications

IoT-Based Dynamic Control System for Precision Agriculture

Nezha Kharraz1* and István Szabó2

1Doctoral School of Mechanical Engineering, Hungarian University of Agriculture and Life Sciences, Hungary

2Institute of Mechanical Engineering, Hungarian University of Agriculture and Life Sciences, Hungary

*Corresponding author:Nezha Kharraz, Doctoral School of Mechanical Engineering, Hungarian University of Agriculture and Life Sciences, Hungary

Submission: April 15, 2025;Published: April 25, 2025

DOI: 10.31031/COJEC.2025.03.000560

ISSN 2640-9739
Volume3 Issue2

Abstract

In this paper, we present the development and evaluation of a smart indoor farming prototype designed for precision agriculture. The system integrates multiple environmental sensors, including temperature, humidity, light and CO₂ sensors, with real-time monitoring and control via Raspberry Pi and Microsoft Azure IoT Hub. A four-dimensional logistic growth model was implemented to simulate and predict plant growth dynamics across biomass, plant height, leaf area and chlorophyll content. Experimental trials were conducted using adaptive lighting and nutrient control strategies across three treatment groups. Results show a clear enhancement in photosynthetic efficiency, as indicated by a progressive increase in SPAD values from 31.2 to 35.4 over eight weeks. The system effectively responded to environmental changes, demonstrating the feasibility and performance of IoT-based smart agriculture platforms. This work contributes a scalable and sustainable framework for integrating hardware, data analytics and AIdriven growth optimization in controlled agricultural environments.

Keywords:Indoor Farming; IoT-Based agriculture; Smart greenhouse; Light intensity control; Azure IoT hub; Raspberry Pi

Introduction to DigiCon

Global demand for food is rapidly increasing, while arable land and traditional farming methods face challenges such as climate variability, resource scarcity and environmental degradation. Indoor farming, powered by modern electronics and Internet of Things (IoT) technologies, offers a promising alternative by enabling precise control over growth conditions, resource use and crop yield [1,2].

This paper introduces a low-cost, sensor-driven smart indoor farming prototype aimed at optimizing plant growth through real-time monitoring and feedback. The system integrates key environmental parameters light intensity, humidity, temperature and CO₂ levels using a network of sensors connected to a Raspberry Pi. Data are transmitted and managed via Microsoft Azure IoT Hub, enabling remote visualization, data logging and adaptive control. To understand and predict plant development, we apply a four-dimensional logistic growth model that simultaneously evaluates height, biomass, chlorophyll content and leaf area. This modeling approach is particularly valuable in indoor farming environments where dynamic resource adjustments are critical for efficiency and sustainability [3].

We also explore how photosynthetic efficiency and growth rate are influenced by variations in lighting and nutrient supply, evaluating three treatment configurations to test the adaptability and precision of the system. Our findings confirm the system’s capacity to simulate biological responses accurately, reduce resource consumption and improve plant productivity. This work lays the foundation for advanced, scalable smart farming applications where electronics, cloud platforms, and biology converge [4,5].

Materials and Methods

Materials

Led system: Light bulbs: The LED system used in this prototype consists of four high-efficiency LED bulbs designed to provide the artificial light necessary for indoor plant growth. These bulbs are arranged to ensure uniform light distribution across the entire cultivation area. The light spectrum emitted is optimized to support photosynthesis, with a focus on the blue and red wavelengths, which are most beneficial for plant development (Figure 1). The system is connected to a relay-controlled circuit managed by a Raspberry Pi, allowing it to be switched on or off based on real-time data. This enables the system to dynamically adapt light exposure according to sensor feedback and programmed thresholds, ensuring that plants receive sufficient but not excessive light, thereby enhancing energy efficiency and supporting optimal growth conditions. Each bulb can be individually controlled, making the system flexible for experimentation with different light intensities or durations, which is essential for simulating environmental conditions in precision agriculture or research settings.

Figure 1:Lighting configuration for optimal plant growth.


Raspberry Pi 3B: The Raspberry Pi 3 Model B serves as the central processing unit for the indoor farming prototype. It is a compact, cost-effective and energy-efficient single-board computer equipped with a 1.2GHz 64-bit quad-core ARM Cortex-A53 processor, 1GB of RAM, Wi-Fi and Bluetooth connectivity. This board provides the computational power and interfacing capabilities required to manage sensor input, process data and communicate with cloud services (Figure 2). In this setup, the Raspberry Pi performs several essential functions:

Figure 2:Raspberry Pi 3B.


A. Sensor Integration: Collects real-time environmental data (e.g., temperature, humidity, light intensity) via I²C and GPIO interfaces.
B. Data Processing and Decision-Making: Implements logic to analyze the sensor values and trigger responses.
C. Communication with Azure IoT Hub: Sends sensor data to the cloud and receives control commands using the MQTT protocol over Wi-Fi.
D. Actuator Control: Interfaces with the LED lighting system and other actuators through relay shields, enabling automated environmental control based on feedback loops.

Light Sensor: The Ultrasonic transmitter shown in Figure 3 transmits an ultrasonic wave, this wave travels in air and when it gets objected by any material it gets reflected back toward the sensor this reflected wave is observed by the Ultrasonic receiver module as shown in the picture below. The KY-018 Photoresistor Module, shown in Figure 3, is a low-cost, analog light detection module used for measuring ambient light intensity. It consists of a photoresistor (LDR-Light Dependent Resistor) and a 10kΩ adjustable potentiometer for sensitivity tuning. The module is compact, easy to interface and well-suited for real-time monitoring applications in controlled environments like indoor farming systems.

Figure 3:Light sensor: KY-018 photoresistor module.


Main Features:

a) Photoresistor (LDR): Varies its resistance based on light levels; low resistance under high light intensity and high resistance in darkness.
b) Digital Output (DO): Provides a digital signal when the light level crosses a predefined threshold.
c) Analog Output (AO): Allows continuous measurement of light intensity.
d) Adjustable Sensitivity: The onboard potentiometer lets users fine-tune the detection threshold.

Pins and Connections:

A. VCC: Connects to a 3.3V or 5V power supply.
B. GND: Ground connection.
C. DO (Digital Output): Outputs HIGH or LOW based on threshold.
D. AO (Analog Output): Outputs analog voltage proportional to light level.

In our case study, the KY-018 module is connected to the Raspberry Pi through the Analog-To-Digital Converter (ADC), as the Raspberry Pi lacks a built-in analog interface. The analog data is used to monitor and adjust LED lighting intensity dynamically via the control system, contributing to energy-efficient and responsive smart agriculture practices.

Characteristics of electronic components: Table 1 defines the characteristics of the electronic components. A breadboard is used to facilitate the connections between the Raspberry Pi and the Adafruit humidity-temperature sensor. The Ground (GND) pin of the Raspberry Pi is connected to the sensor’s GND pin. The Serial Clock (SCK) pin of the sensor is connected to the third pin of the Raspberry Pi, serving as the data input. The Voltage Input (VIN) pin is connected to the 3V3 pin on the Raspberry Pi to power the sensor with a low energy draw and a maximum current of about 50mA. The Serial Data Input (SDI) pin of the sensor is linked to the second pin of the Raspberry Pi, facilitating data transmission from the processor to the sensor.

Table 1:Electronic components’ characteristics.


Figure 4:Azure IoT hub.


Azure IoT hub: Azure IoT Hub as shown in Figure 4 is a managed cloud platform provided by Microsoft as part of its Azure services. Azure IoT Hub allows for bidirectional communication between IoT applications and the devices they manage [1]. It is integral for real-time data processing, device-to-cloud and cloud-todevice communication, secure messaging and device management [2]. This platform supports various protocols, including MQTT, HTTPS and AMQP, making it versatile for different IoT scenarios. In our study, Azure IoT Hub was used to securely collect, store and analyze telemetry data from sensors connected to the Raspberry Pi, facilitating sophisticated data management and analysis capabilities crucial for precision agriculture [3].

Azure apps: Azure Function Apps, as illustrated in Figure 5, are serverless compute services that enable the execution of eventdriven code without managing infrastructure. In the context of our indoor farming prototype, Azure Function Apps are used to automate decision-making based on real-time sensor data collected from the environment. These functions are triggered when data is sent from IoT devices as Raspberry Pi in our case, and they evaluate the incoming telemetry; such as light intensity, temperature and humidity. If thresholds are exceeded (e.g., light intensity below optimal levels), the function app automatically issues control commands to actuators such as the LED lighting system via the Azure IoT Hub. This mechanism allows for real-time feedback control, enabling the farm to autonomously adapt to environmental changes and optimize growth conditions. The Azure Function script is lightweight, scalable and integrates seamlessly with other Azure services, making it ideal for dynamic IoT applications in precision agriculture [4].

Figure 5:Azure function apps.


Automated light control feedback loop: Figure 6 shows the complete control loop used in the prototype to regulate light intensity in real time. The system collects sensor data via a light sensor, processes the data through Azure IoT Hub and Azure Functions (Apps) and sends corresponding commands to the Raspberry Pi, which then activates a 4-bulb LED system [5,6]. This forms a closed-loop feedback system that continuously monitors and adjusts light exposure based on defined threshold values.

Figure 6:IoT-driven lighting system for indoor farming.


a) The light sensor measures illumination intensity.
b) Data is sent to Azure IoT Hub for cloud-based processing.
c) An Azure Function (coded in Python) checks if the intensity is within the optimal range.
d) Based on logic, commands are sent to the Raspberry Pi to turn on or off specific bulbs.
e) The LED system responds accordingly, ensuring stable light conditions for plant growth.

This component plays a critical role in achieving energy-efficient and responsive environmental control in the indoor farming setup.

Methods

Data management via azure IoT hub: In addition to using Azure IoT Hub for cloud-based data processing, an MQTT-based communication system was implemented to streamline message exchange between the sensor (TSL2591 Light Sensor), Raspberry Pi (acting as both MQTT broker and client) and actuators. This architecture ensures real-time response and light-based command execution. Figure 7 illustrates the MQTT-based communication flow:

Figure 7:MQTT-based architecture for sensor data publishing and actuator command execution in indoor farming.


A. The light sensor (TSL2591) publishes real-time light intensity data to the Raspberry Pi.
B. The Raspberry Pi MQTT Broker then forwards this data to Azure IoT Hub via Wi-Fi, using the Light topic.

Azure IoT Hub can send back control commands which are subscribed to by local actuators, ensuring closed-loop control.

Result

CO₂ and photosynthetic efficiency

The line graph in Figure 8 illustrates the SPAD values (chlorophyll content) over 8 weeks for Treatments A, B and C. All treatments show a steady increase in photosynthetic efficiency. By week 8, Treatment C reaches the highest SPAD value (35.2), confirming that increased CO₂ concentration improves chlorophyll synthesis and photosynthetic capacity [7].

Figure 8:Effect of CO2 on photosynthetic efficiency (SPAD over time) for treatment groups A, B and C.


The boxplot in Figure 9 shows chlorophyll distribution across time. Median SPAD values increase progressively and variability becomes more prominent after week 5. This indicates both enhanced and variable plant responses [8,9].

Figure 9:Boxplot showing chlorophyll content distribution over 8 weeks.


Valuation of lighting configurations

The radar chart in Figure 10 compares canopy Light Use Efficiency (LUEP) and Lamp Energy Efficiency (LUEL) across four light configurations. Configuration C shows superior performance in both metrics, suggesting it as the most balanced and efficient setup for resource-efficient indoor farming [10].

Figure 10:Radar chart comparing Lamp Use Efficiency (LUEL) and canopy Use Efficiency (LUEP) across four lighting configurations.


Model residuals and predictive accuracy

Residual analysis in Figure 11 confirms model reliability in early weeks (residuals near zero), with slight underestimation in later stages. The pattern of residuals indicates a small but consistent deviation, suggesting that model recalibration might improve accuracy in long-term growth predictions.

Figure 11:Residuals plot for model accuracy over time: observed vs. predicted chlorophyll content.


Sensitivity to environmental parameters

The heatmap in Figure 12 depicts how moisture and light intensity influence yield classification. A clear threshold appears around 8500 lumens: above this level, yield is consistently classified as high, regardless of moisture. This shows light is a dominant driver of yield in this setup.

Figure 12:Yield classification heatmap based on light intensity and moisture content.


Discussion

The analysis demonstrates how controlled environmental parameters directly influence plant productivity. Chlorophyll content increases from approximately 31.2 SPAD units in week 1 to 35.4 SPAD units by week 8, with Treatment C consistently exhibiting slightly higher values, suggesting improved photosynthetic efficiency under its CO₂ conditions. Median chlorophyll levels rise weekly, starting at 30.0 in week 1 and peaking at 36.0 in week 8, with an interquartile range that narrows after week 5, indicating more stable responses among the plants as the system stabilizes. Config C shows the highest Canopy Efficiency (LUEP ≈ 0.9) and Lamp Efficiency (LUEL ≈ 0.55), while Config A has the lowest, suggesting that light placement and distribution dramatically influence energy conversion rates. Residuals between predicted and observed chlorophyll values start at +0.1 in week 1 and decrease to –0.3 by week 8, reflecting a drift in prediction accuracy over time, likely due to non-linear physiological responses not captured by the base model. Figure 5 reveals a clear threshold in light intensity around 8500 lumens; above which, yield classification switches from low (0) to high (1), especially under moisture levels between 30% and 60%, confirming a synergistic relationship between light and humidity in optimizing plant growth [11,12]. Together, these results validate the effectiveness of a sensor-driven feedback system, affirming that precise modulation of CO₂, light intensity, and moisture can drive measurable gains in plant physiological responses and yield classification in indoor farming environments [13].

Conclusion

This study confirms the effectiveness of a smart indoor farming system integrating sensors, IoT communication and adaptive control to optimize plant growth. Experimental results demonstrate a consistent improvement in chlorophyll content, rising from approximately 31.2 to 35.4 SPAD units over 8 weeks, reflecting enhanced photosynthetic efficiency under controlled CO₂ exposure. The residual analysis highlighted model precision, with deviations gradually increasing; emphasizing the need for continuous model updates. Light and moisture sensitivity maps revealed a clear threshold around 8500 lumens and 40-60% humidity, beyond which yield classification significantly improved. Furthermore, configuration analysis showed that Config C achieved the highest canopy and lamp efficiency. Altogether, these findings validate the proposed multi-dimensional growth modeling and feedback system as a robust framework for precision agriculture, enabling dynamic environmental control to maximize efficiency and sustainability.

References

  1. Lecun Y, Bottou L, Bengio Y, Haffner P (1998) Gradient-based learning applied to document recognition. Proceedings of the IEEE 86(11): 2278-2324.
  2. Sharma V, Tripathi A, Mittal H (2022) Technological revolutions in smart farming: Current trends, challenges & future directions. Computers and Electronics in Agriculture 201: 107217.
  3. Shahab H, Iqbal M, Sohaib A, Khan F, Waqas M (2024) IoT-based agriculture management techniques for sustainable farming: A comprehensive review. Computers and Electronics in Agriculture 220: 108851.
  4. Wolfert S, Ge L, Verdouw C, Bogaardt MJ (2017) Big data in smart farming-a review. Agricultural Systems 153: 69-80.
  5. Thilakarathne NN, Yassin H, Bakar MS, Abas PE (2021) Internet of things in smart agriculture: Challenges, opportunities and future directions. Proceedings of the IEEE Conference on Sustainable Development and Environmental Engineering (CSDE) pp. 1-9.
  6. Tolentino LK, Fernandez EO, Jorda RL, Amora SN, Bartolata DK, et al. (2019) Development of an IoT-based aquaponics monitoring and correction system with temperature-controlled greenhouse. International SoC Design Conference (ISOCC) pp. 261-262.
  7. Navarro E, Costa N, Pereira A (2020) A systematic review of IoT solutions for smart farming. Sensors 20(15): 4231.
  8. Demestichas K, Peppes N, Alexakis T (2020) Survey on security threats in agricultural IoT and smart farming. Sensors 20(22): 6458.
  9. Elksasy MS (2023) Understanding the Internet of Things (IoT): Concepts, applications and standards: An overview. Delta University Scientific Journal 6(1): 205-210.
  10. Jung A, Szabó D, Varga Z, Lausch A, Vohland M, et al. (2024) Sipos daily light integral maps for agriculture lighting design in Spain. Smart Agricultural Technology 9: 100681.
  11. Soussi A, Zero E, Sacile R, Trinchero D, Fossa M (2024) Smart sensors and smart data for precision agriculture: A review. Sensors 24 (8): 2647.
  12. Kozai T, Niu G, Takagaki M (2015) Plant factory: An indoor vertical farming system for efficient quality food production. (2nd edn), Academic Press, Cambridge, England, pp. 477-487.
  13. Bugbee BG, Salisbury FB (1988) Exploring the limits of crop productivity. I. photosynthetic efficiency of wheat in high irradiance environments. Plant Physiol 88(3): 869-878.

© 2025 Nezha Kharraz. This is an open access article distributed under the terms of the Creative Commons Attribution License , which permits unrestricted use, distribution, and build upon your work non-commercially.