Introduction

Agriculture plays a vital role in enhancing several nations’ economic growth and food security worldwide. In India, onion (Allium Cepa) is one of the most widely cultivated and consumed vegetable and cash crops with indispensable commercial, medicinal, and culinary importance1. India ranks second after China among the leading producers of onions in the world, producing around 16.12 tons per hectare, up to around 19.40 million tons. Approximately 2415.75 thousand tons of onions are exported from India, substantially boosting India’s economy. A significant revenue of approximately Rs.3,10,650.09 lakhs is generated by onion export from India which greatly boasts of the importance of onion cultivation2. Onion is a relatively low-investment business that reaps better returns to the farmers with minimal cultivation skills. It can also be stored for extended periods, adding to its attractive characteristics of being a cash crop3.

Apart from the major contribution to the economy of many nations, the culinary uses of onions are also indispensable throughout the year in many countries, as the health benefits of onion are retained in any cooked and raw forms4. Onion is termed the “Nature’s Ninja” by the National Onion Association (NOA) for its multiple medicinal uses, taste, nutrition, and sustainability5. Apart from its culinary uses, the onion is a storehouse of many healing capabilities. Medicinal plants usually contain medicinal properties either in their shoots or in their roots, but onion is one of the rare medicinal plants with different medicinal properties in its shoots and bulbs. The onion shoot has healing properties like anti-cancer, anti-microbial, anti-inflammatory, antioxidant, anti-hyperlipidemic, anti-diabetic, etc. The onion bulbs help reduce swelling and asthma-related tightness in the lungs blood pressure, and cholesterol. Regular consumption of onions also helps to improve skin tone and hair4,5,6,7.

Figure 1 is a labeled representation of a typical onion plant. Onions can be cultivated either from bulbs or from germinated seeds. The onion shoot develops as a green shoot and a layered bulb. The fibrous roots emerging from the bulb are responsible for the proper intake of water and nutrients from the cultivation medium. On maturity, the shoots develop into green hollow stalks with white clustered flowers on the top which further produce seeds; and the bulbs separate into the formation of daughter bulbs8,9. The Indian Council of Agricultural Research (ICAR) has classified the onions in India into various types as mentioned in Table 110.

Fig. 1
figure 1

Parts of the onion plant.

Table 1 Classification of various types of onions based on various parameters.

Onions are cultivated in three seasons namely kharif, late kharif, and rabi wherein rabi onions contribute to around 60% of the entire production, and the remaining 40% of the production is contributed equally by kharif and late kharif onions. The harvest seasons for rabi, kharif, and late-kharif onions are April–May, October–November, and January–February respectively. Thus, there is an unavailability of fresh onions in the market around June–October, when the stored rabi onions are sold at high rates11,12,13.

A report from the Food Agriculture Organization (FAO) also states that around 330 million tons of medicinal produce will be needed for 77 million hectares14. Therefore, enhancing onion production can cater to multiple issues of sufficing for the growing population in minimal cultivation areas, enhancing the health and living conditions of the habitats, and boosting the economic growth of any nation. The major onion-producing states of India are Maharashtra and Madhya Pradesh contributing to almost 39% and 17% of the total national yield. Nearly 90% of the total onion production in India​ is obtained from these states15,16. The top 10 onion-producing states in India based on the average production of the states in the last five years, i.e., from 2019 to 2024, are as shown in Table 217:

Table 2 Top 10 onion-producing states in India.

Rapid urbanization and emerging Industry 6.0 are creating better employment opportunities and improving urban living standards. This transformation is causing unhealthy lifestyles, pollution, climate uncertainties, soil erosion, deforestation, and land and water scarcity18,19. Infliction due to pests and diseases along with inadequate field monitoring further elevates the issues of hindering traditional agriculture and causing a shift towards soilless cultivation methods20,21. Due to the immense demand for onions, enhancement in onion production through soilless methods is getting crucial importance.

Soilless cultivation methods use water or air medium for cultivation. They are broadly classified into three categories: hydroponics–the cultivation of plants in water, aquaponics–the cultivation of plants in water along with simultaneous fish culture, and aeroponics–the cultivation of plants in air22. Hydroponics is the most common soilless cultivation method due to its simple setup, implementation, and maintenance. It is a cost-effective method and produces enhanced yield all around the year. Hydroponic cultivation yields year-long better yields in around 10% of the cultivatable area using around 90% less water23,24. The essential nutrients and minerals are dissolved in the water medium and supplied to the plant roots through various mechanisms based on which, hydroponics is further classified into five types, namely: Drip Irrigation, Wick System, Nutrient Film Technique (NFT), Deep Water Culture (DWC), and Ebb and Flow methods25.

The hydroponic cultivation methods are well suited for urban farming, but they demand continuous vigilance and human interference. IoT-enabled hydroponic systems provide a solution to this issue by using various sensors and actuators to ensure optimal environmental conditions for the hydroponic plants ensuring food security without depending upon soil, pesticides, water, climate, or labor. The concept of Controlled Environmental Agriculture (CEA) is implemented by providing optimum environmental conditions on the farm and continuously monitoring it to obtain the best quality yield all around the year with minimal damage26. The greater productivity throughout the year, in a comparatively shorter vegetation period, provides a higher Return on Investment (RoI) than conventional soil-farming methods2. The various actuators used in this experiment are a nutrient pump, mist spray, and cooling fan. Figure 2 is a schematic representation of a smart DWC hydroponic setup.

Fig. 2
figure 2

A smart hydroponic setup.

Machine Learning (ML) plays a pivotal role in the visualization of the collected data in the end devices. To make the smart hydroponic system more automatic and efficient, ML is widely used in smart hydroponics for various purposes. Some of the major applications of ML in smart hydroponics are system automation, plant growth monitoring, environment monitoring, water and nutrient usage, pest management, and yield prediction27. The use of ML in a smart hydroponic system can be explained in Fig. 3.

Fig. 3
figure 3

Use of ML in smart hydroponics.

The figure shows the steps involved in the prediction of environment, plant disease, plant yield, and other water and nutrient requirements of the hydroponic plant. the data from the sensors is taken as input by the cloud or any data collection unit. The data is then pre-processed before sending to the ML model. The ML model predicts the parameter which it is defined for, and uses the hardware of the control systems accordingly. Finally, the outcome is presented to the user through an interface. Researchers have also used ML in smart hydroponics for guidance on hydroponic plant recommenders according to climatic conditions27.

Various researchers have compared the actual growth responses of plants in soil and soilless mediums separately28,29,30. Some other researchers have compared the growth responses through agricultural simulators25,31,32,33. However, comparison and validation of experimental and simulator growth responses with the results of a simulator is very limited. This work encompasses the yield comparison of onions in soil and hydroponics and the results are validated using ‘AquaCrop’ simulator. The present investigation was guided by the formulation of the following research questions:

  • R.Q. 1. Why is onion identified as the crop to be cultivated for growth response comparison and what are its agronomic variable requirements?

  • R.Q. 2. Which is the best hydroponic setup for onion cultivation?

  • R.Q. 3. How are the results of the growth responses verified and validated?

  • R.Q. 4. How relatable are the results from the actual experiment with the simulator results?

  • R.Q. 5. Can there be other measures to enhance cost-effectiveness and sustainability in the best cultivation method identified?

The key contributions of this research work can be listed as follows:

  • Plant selection and parameter identification: A suitable herbaceous medicinal plant compatible with soil and hydroponic cultivation is identified for its growth response comparison.

  • Yield comparison using the proposed hydroponic kit: Analysis and comparison of the growth responses of the medicinal plant by cultivating in soil and the specific hydroponic method using the ‘Smart Hydo Kit’.

  • Data collection and analysis: Generation of datasets and analysis in the ThinkSpeak IoT platform.

  • Simulation and validation: Identification of the most appropriate simulator model to simulate the growth responses in soil and hydroponics and validation of the actual results with simulated results.

The results obtained are mentioned in the section following the introduction which is followed by the discussions of the experimental outcomes. The materials required for the experiment and the methodology are discussed after the discussions, which is then followed by the article’s conclusion.

Results

The growth responses of onion plants cultivated in a smart DWC hydroponic system and those cultivated in soil are compared for the identification of the best cultivation method for enhanced production of onion. A sensor-integrated smart, portable, and robust device is used in the DWC setup to reduce human intervention. The growing conditions of onions when cultivated in soil and hydroponic are provided as input to the ‘AquaCrop’ simulator. The obtained growth responses from the actual cultivation method are recorded for comparison and validation from the simulator growth responses.

Actual cultivation results

The growth responses of soil-cultivated and hydroponically cultivated onion plants in a smart DWC setup are tabulated against every considered parameter in Table 3.

Table 3 Comparison of the parametric values of onion cultivated in soil vs DWC hydroponic setup.

From the table, it can be seen that onions start sprouting from bulbs in 15 days when they are cultivated in soil but take at least 3–4 days to sprout when cultivated in water. In the case of bulb formation, the hydroponic bulb starts forming by the 28th day, whereas, the soil-cultivated bulbs take at least a month to form daughter bulbs. Therefore, it can be concluded that the onion develops 5 ± 2 cm longer shoots and 8 ± 2 cm longer roots in a shorter vegetation period when cultivated in a DWC hydroponic setup, compared to soil-cultivated onions. The onion bulbs also grow twice as fast in a DWC setup than when cultivated in soil. Fewer cultivation of crops in the soil is also attributed to the crop spacing and presence of weeds and rodents in the soil which is eliminated in DWC cultivation. Figure 4 demonstrates the graphical plots of the comparative yield analysis of onion shoots in soil and DWC hydroponics.

Fig. 4
figure 4

A comparative plot showing the qualitative and quantitative analysis of the yield of onion shoots.

Therefore, the growth responses of onions when cultivated in soil and DWC hydroponics show a better qualitative and quantitative production of onions in hydroponics. The hydroponic onion shoots and onion bulbs show comparatively better growth results. The vegetation period of hydroponic onions is also shorter thus hydroponic onion production can be done multiple times by the time soil cultivation is done once. An IoT-integrated smart device named ‘Smart Hydro Kit’ is also proposed and implemented in the DWC setup, which is an integration of pH, EC, total dissolved solids (TDS), temperature, and humidity sensors connected by an ESP32 microcontroller. The device connects automatically to a Wi-Fi connection and the sensors collect the real-time data at an interval of 30 s. The collected data is visualized on the dashboard of the ThingSpeak IoT platform and sent to the cloud for analysis. This data can also be used by ML models for classification, prediction, and recommendation. The user can log in to the ThingSpeak platform and monitor the farm remotely. If any sensor data shows a deviation in the parametric value, the corresponding actuators can be used to maintain the parameters in range.

‘Aquacrop’ simulator results

The simulation output results for the growth response of onion when provided with soil cultivation conditions is shown in Fig. 5 (a), whereas Fig. 5 (b) demonstrates the simulator output in the case of DWC hydroponics.

Fig. 5
figure 5

Simulation results from the ‘AquaCrop’ simulator output results for (a) soil cultivation; and (b) DWC hydroponics.

The simulation results show that the ET water productivity, Dry Yield, and Biomass of onions obtained in DWC hydroponics are better than those cultivated in soil. The hydroponic onion has almost 0.373 ton/ha more biomass and 0.097 more dry yield than soil-cultivated onions. Weed infestation is found to be one of the major causes of lesser canopy cover and agricultural damage which can be eliminated by cultivating in a hydroponic setup. The simulation results also show that hydroponic onions are devoid of weeds whereas 25% of the onions cultivated in soil ma y be infested by weeds. The hydroponic onions can have a maximum canopy cover of 85% without weeds, whereas in soil, the onions have a maximum of 91% canopy cover with 25% weeds. The ET water productivity of hydroponic onion is 0.06 kg/m3 more than soil onions, meaning the productivity of hydroponic onion concerning transpiration is better in hydroponics. Table 4 shows the qualitative and quantitative comparison of growth parameters.

Table 4 A qualitative and quantitative analysis of onion yield simulated under soil cultivation and DWC hydroponic cultivation conditions.

Figure 6 plots the simulation outcomes of onions when cultivated in soil and DWC hydroponics at intervals of 10 days. Significant growth can be noticed from the lapse of the first 10 days.

Fig. 6
figure 6

Plot of onion yield comparison obtained from ‘AquaCrop’ simulator.

Therefore, the simulator results show similar results to the actual cultivation results in terms of various qualitative and quantitative parameters, and as a result of RQ. 4, the actual and simulation results are very closely related. This further validates the onion growth response outcomes obtained from the real-time cultivation results and responds to RQ. 3.

Discussions

The study delves into collecting the agronomic parameters and nutritional requirements of onion and comparing the growth responses in real-time. The same input parameters are input to the ‘AquaCrop’ simulator to verify the actual responses. These factors sum up to justify the novelty of this experiment. Furthermore, a novel efficient, robust, multipurpose, portable, smart, automatic, cost-effective, and user-friendly device ‘Smart Hydro Kit’ is proposed, developed, and deployed in this experiment to enhance the sustainability of the entire process. This device is a sensor-integrated kit compatible with checking parametric conditions of water and environment which enhances sustainability with an increased qualitative and quantitative yield, all year round. Complete datasets in CSV format and graphical plots are obtained through the web interface of the ThingSpeak IoT platform.

The onion shoots growing in the soil grow at a comparatively slower rate and have a degraded quality compared to the onion shoots cultivated in the smart DWC hydroponic setup. A comparative illustration is done in Fig. 6, where Figs. 7 (a) to (d) are the growth stages of onion cultivated in the soil and Figs. 7 (e) to (h) are those of hydroponic onion.

Fig. 7
figure 7

Growth stages of onion in soil and DWC hydroponics.

Both onion shoots and roots depict an enhanced growth trend in hydroponics as compared to soil. The faster growth of hydroponic onions is attributed to the dissolved nutrients in the water which ensures a uniform supply of nutrients to the plant roots for its faster growth and better development. Apart from a shorter vegetation period, which helps in producing more quantity of onion shoots and bulbs, the better quality of hydroponic onions is attributed to the absence of weeds and other vegetation in the hydroponic setup. The soil cultivation is greatly affected by weeds which hinder the growth process of the actual vegetation.

The comparative analysis of the onion growth response in real-time as well as the ‘AquaCrop’ simulator depict similar outcomes. Hydroponic cultivation outperforms soil cultivation of onion significantly in terms of shoot length, shoot and bulb formation, biomass, dry yield, weed infestation, and ET water productivity. The use of the proposed ‘Smart Hydro Kit’ in the DWC setup further helps with remote monitoring of the setup and keeping a continuous check on the farming process.

Figure 8(a) illustrates the sample screenshot of the generated dataset and 8 (b) is the sample screenshot of the dashboard of the ThingSpeak web interface in the process of hydroponic onion cultivation. The graphical representations help in knowing the trend of the parametric variations in the farm. In addition, the generated datasets help develop recommendation systems for crops and make informed decisions regarding the cultivation process. The continuously generated sensor data are analyzed by the cloud according to the Eqs. (13) and the users are recommended to take necessary actions to ensure the best production in the farm. Equation 1 depicts the analysis of the DHT11 temperature and humidity sensor where the temperature ranges are specified, and the users are recommended to operate the coolers and exhaust fans.

Fig. 8
figure 8

Sample screenshots of (a): the dataset obtained from the ‘Smart Hydro Kit’; and (b): plots obtained from the ThinkSpeak platform.

$$\text{DHT}11\text{ sensor}=\left\{\begin{array}{c} temperature<29^\circ C switch off exhaust fans and coolers \\ 32^\circ C\le temperature\le 29^\circ C no action \\ temperature>32^\circ C switch on exhaust fans and cooler\end{array}\right\}$$
(1)

Equation 2 depicts the humidity ranges of the farming setup where the mist sprays and sprinklers are recommended to be switched on and off according to the permissible humidity range.

$$\text{DHT}11\text{ sensor}=\left\{\begin{array}{c}humidity<64\% switch on sprays and sprinklers \\ 72\%\le humidity\le 64\% no action \\ humidity>72\% switch off sprays and sprinklers\end{array}\right\}$$
(2)

The pH sensor monitors the pH value of the cultivation medium and recommends adding pH up or pH down solutions to be added to the nutrient mix according to Eq. 3.

$$\text{pH sensor}=\left\{\begin{array}{c}pH<6 add pH up solution \\ 6\le pH\le 6.4 no action \\ pH>6.4 add pH down solution\end{array}\right\}$$
(3)

The TDS sensor recommends the user when to add nutrients or dilute the nutrient mix according to Eq. 4.

$$\text{TDS sensor}=\left\{\begin{array}{c}TDS<600 mg/l add nutrients\\ 600 mg/l\le TDS\le 750 mg/l no action \\ TDS>750 mg/l add water\end{array}\right\}$$
(4)

The EC can be derived from TDS using a constant factor of 0.64 as shown in Eq. 5.

$$\text{EC}\left(\text{mS}/\text{cm}\right)=\frac{\text{TDS } (\text{mg}/\text{l})}{0.64*1000}$$
(5)

Comparison with state of art

The authors have focused on the hydroponic cultivation of red onions where parametric conditions like light, humidity, temperature, and other important factors of plant growth are monitored using sensors and an Arduino microcontroller. The hydroponic onions depicted a better qualitative and quantitative yield compared to soil-cultivated onions34. In the experiment35, the authors investigate the utility of water from natural sources for the hydroponic cultivation of onions in Bangladesh. The experimental results depicted that the yield using groundwater outperformed the yield from river water. The groundwater was found to yield more than half the production of soil-cultivated onion. The study also concludes that the nutrients are essential for the commercial cultivation of hydroponic onions. The authors have focused on the merits of the hydroponic cultivation of onions over traditional soil-based onion cultivation in India36. The ability to yield better quantitative and qualitative hydroponic onions. The authors have also used IoT systems to automatically monitor and control the hydroponic onion yield. The sustainability of the hydroponic onions is further increased by using solar energy to use the device and making the device eco-friendlier. The authors have evaluated the hydroponic cultivation of green onion in different nutrient concentrations, i.e. between 50 and 125%. The study concluded by the results that better qualitative and quantitative yield and earlier harvest time were obtained with a nutrient concentration between 50 to 100%. When the concentration rises above 125%, the growth is hindered. The placement of the plants did not affect the growth of the hydroponic onions37.

The authors have presented an ML-based method for monitoring hydroponic crop growth in greenhouse environments. Through the use of sensors, the ML model optimizes the climatic conditions and nutrient requirements of the plants and ensures the maximum yield. The study resulted in finding coconut coir as the best aggregate to work with the NFT hydroponic setup and correctly predicts crop growth with 93% accuracy38. Four hydroponic systems are evaluated using ML algorithms in39. Onion bulb growth was predicted. Using XGBoost, Linear Regression, Federated Split Learning, and Deep Neural Networks. The authors reviewed the advanced uses of ML in hydroponic cultivation to address various agricultural challenges like resource management and uncertain climatic conditions40. The authors study and explore data-driven methods in hydroponic soybean cultivation under various magnesium, potassium, and nitrogen levels. Key nutrients impacting water intake are identified using various ML techniques and statistical methods, where Random Forest and Support Vector Regression models excel in supporting optimized hydroponic cultivation41.

In this research work, the authors have not only cultivated the onions in soil and the DWC hydroponic system separately but also have proposed and used a smart device that can be implemented in any hydroponic setup to monitor the growth rate and enhance the yield of the hydroponic onions. Furthermore, the authors have validated the real-time outcome with the simulated outcomes from the ‘AquaCrop’ simulator. The results from actual cultivation as well as the simulation results show similar outcomes where hydroponic onion yield outperforms the soil-cultivated onions.

Comparison with existing devices

Several devices are used by various authors for the automation of the cultivation process. These devices are used to automate the cultivation system while making them smart. Some of the commercially available smart agricultural sensors are X-Gee soil sensors, Sensoterra Soil Moisture Sensors, and Tuya sensors. Despite being used in smart cultivation systems, these sensors have several notable drawbacks that need to be addressed. The X-Gee soil sensors use only Android applications and no other OS. It is also used in soil cultivation only42. the Sensoterra soil moisture sensors monitor real-time moisture in the soil. It majorly addresses the irrigation-related issues in soil-based cultivation where the farmers are helped in making informed decisions regarding irrigation. Some of the major drawbacks of these sensors are their cost, and frequent calibration needs while in use43. The Tuya sensors are also readily available in various types which can monitor various agricultural parameters remotely. The major drawbacks of this device are that it is not compatible with other non-Tuya devices, and it has a short battery life. These limit its scalability and multiple usability44.

The proposed ‘SmartHydoKit’ overcomes all the drawbacks of the existing devices. It is a portable, battery-backed, compact device that is compatible with any hydroponic setup. It uses an easy ThingSpeak interface for the convenience of the users to keep a check on the agronomic and environmental ongoing in the hydroponic farm.

Materials and methods

This section encompasses a detailed explanation of all the materials, methodology, and workflow needed to carry out the study. Among the materials needed for this study, the foremost need is to identify the medicinal plant to be cultivated for its growth response comparison. Onion is selected as the subject crop based on several parameters. The description of the soil and water mediums for the cultivation of onion is also mentioned in this section. The proposed device is described in detail with all its features, components, and working methodology. The workflow of the entire study has been explained along with the architecture and the actual picture of the device when implemented in the real-time setup. The pseudo codes of the various sensor components have also been mentioned for a better understanding of the process.

Identification of the medicinal plant

The medicinal plant to be cultivated for its growth response comparison has to be identified according to various parameters like plant type, growing cycle, and nutritional value. Only herbaceous plants are compatible with hydroponic setups. Therefore, an herbaceous medicinal plant with a shorter vegetation period was selected for the experiment. Onion is an annual herbaceous medicinal plant that completes its vegetation cycle within one year. A mix of sand, compost, and garden soil is used as the cultivation medium for soil-cultivated onion whereas nutrient-mixed water is used as the cultivation medium in the smart DWC setup. Therefore, in response to RQ. 1, onion is identified as the crop to be cultivated for growth response comparison, and its agronomic variable requirements in soil and hydroponics are mentioned in Table 59.

Table 5 Parameters and the corresponding values needed for onion cultivation in soil and DWC hydroponics.

A potting mix was prepared with sand, compost, and garden soil for the cultivation of onions in the Punjab region of India. The proper growth of onion is regulated with a moderate temperature of 28–34 °C and an approximate humidity of 64–72%. This condition is available in the month of July–August in Punjab, India. The pH of the soil is to be maintained at around 6 whereas the EC is to be maintained at 3–4.5 dS/m. Onion requires an N-P-K ratio of 2–1-1 in the soil to ensure the best yield. Similar temperature conditions were provided to the onions in the DWC hydroponic setup, where the N-P-K ratio was initially maintained at 10–20-10 and subsequently at 20–05-05. The CO2 and O2 concentrations were also maintained at the specified levels and the EC in the water was maintained at 1–2.2 mS/cm.

The DWC hydroponics is the simplest of all hydroponic setup types. It consists of a nutrient reservoir containing a nutrient-mixed solution. O2, CO2, etc. are maintained in the solution to ensure the optimal supply of all the agronomic variables for the best growth of the plants. The reservoir is covered by a lid which has holes in it. The plants are placed in perforated pots filled with inert substrates and the pots are fitted into the lid such that the roots of the plants are completely submerged in the nutrient mix to ensure optimal uptake of nutrients to the plants. The nutrient mix has to be drained out at regular intervals and replaced with fresh mix and the air pump ensures the aeration of the nutrient solution. Thus, in response to RQ. 2, the DWC hydroponic setup is the most suitable for hydroponic onion cultivation.

Proposed ‘smart hydro kit’

A compact, smart, robust, and mobile kit is proposed and implemented in this study to keep a check on the DWC setup. The device is an integration of pH, EC, TDS, Temperature, and humidity sensors connected to an ESP32 microcontroller. The sensor data is updated every 30 s and analyzed by the cloud which is displayed through a ThingSpeak mobile/ web interface. A labeled diagram of a ‘Smart Hydro Kit’ is illustrated in Fig. 9.

Fig. 9
figure 9

The proposed ‘smart Hydro Kit’.

The device is enabled with a power jack which is used for power supply to the device. A 3-series battery and battery management system (BMS) are also incorporated with the setup which makes the kit mobile and power-independent. This device can be used in any hydroponic setup which makes it a generalized setup and enhances the cost-effectiveness of hydroponic cultivation more sustainably. Therefore, in response to RQ. 5, the ‘Smart Hydro Kit’ is a way to ensure a sustainable and cost-effective manner.

Methodology

The methodology of this study comprises two basic sections: first is the real-time cultivation of onion in soil and water, and the second is the simulation done in the ‘AquaCrop’ simulator. Onion is the identified herbaceous medicinal plant for this study. The onion bulbs are sown in soil and a smart DWC hydroponic setup simultaneously. The ‘Smart Hydro Kit’ is connected to the Wi-Fi and used in the DWC setup which enables the monitoring of the entire system. The sensor data trend is visible on the ThingSpeak dashboard and the corresponding dataset is available to download. The hydroponic farm is monitored remotely with the help of the ThingSpeak app. It was found that the hydroponic onion shoots and daughter bulbs grew better than those in soil. The methodology of the study is demonstrated in detail in Fig. 10.

Fig. 10
figure 10

The methodology of the experiment.

The basic architecture of the entire smart DWC setup is demonstrated in Fig. 11. The ‘Smart Hydro Kit’, the actuator module, and the DWC hydroponic setup are powered by an energy source. The ESP 32 microcontroller is programmed to connect to the pH, EC, and DHT11 sensors and display the readings. The ‘Smart Hydro Kit’ automatically connects to the Wi-Fi automatically and the sensors start collecting the data. The data analysis is done by the cloud and the actuators are switched on and off accordingly.

Fig. 11
figure 11

The architecture of the smart hydroponic setup.

Similar growing conditions were provided to the ‘AquaCrop’ simulator as parametric inputs the outputs in various qualitative and quantitative parameters depicted similar growth responses. Hydroponic onions produced better biomass, dry yield, and ET water productivity, with no weed infestation and greater canopy cover. Figure 12 shows the actual implementation of the ‘Smart Hydro Kit’ in the DWC hydroponic system.

Fig. 12
figure 12

The actual implementation of the ‘Smart Hydro Kit’ in the DWC hydroponic setup.

Pseudo-code of algorithms

The pseudo-codes of the algorithms for the various sensors integrated into the sensor module are explained in this section.

Temperature and Humidity Sensor: DHT11 is used to sense the temperature and humidity of the hydroponic setup. The pseudo-code of the algorithm is described below:

figure a

A total of five fields are stored in the dataset and five different real-time plots appear on the ‘ThingSpeak’ dashboard, where fields 1, 2, 3, 4, and 5 represent pH, EC, TDS, temperature, and humidity respectively. The pseudo codes of fields 1, 3, 4, and 5 are mentioned and field 2 representing EC is dependent upon TDS value and calculated accordingly.

Conclusions and future prospects

Onion is an important cash crop that has economic, medicinal as well as culinary importance. It is a highly demanded crop that must be cultivated efficiently and sustainably throughout the year. DWC hydroponics was found to be the most efficient cultivation method for onions which was further improved by using the ‘Smart Hydro Kit’. The sensors used in this kit collected real-time data and analyzed them through the cloud. Recommendations were provided to the users to act in an informed way to ensure the best yield from the smart DWC hydroponic farm. The parameters for onion cultivation were provided as input to the ‘AquaCrop’ simulator to validate the actual growth responses. The simulator results also affirmed the actual results and showed that the DWC hydroponic onions outperformed the soil-cultivated onions in several parameters.

In the future, a larger-scale CEA-integrated DWC hydroponic setup can be implemented for the cultivation of other herbaceous medicinal plants using the same ‘Smart Hydro Kit’. ML techniques can be used on the dataset generated from the kit to create recommendation models that can be helpful to the farmers to make more informed decisions regarding crop plantation. Hydroponic cultivation ensures better cultivation sustainably, but sustainability can be further enhanced by recycling the drained-out water or using that water in the cultivation of other plants.