Software apps and online services
Agriculture has played an outstanding role in the climate change phenomenon as a victim and as a contributor. Traditional agriculture was constructed under the basis of indiscriminate usage of hydric resources over vast extensions of land. This fact has made that half of the world’s habitable land is used for food production, which is unsustainable in the medium and long term. Therefore, the new methodologies of horticulture, based-on high-end technology, are urgently required to transform the way in which the world is fed. In this project, we present the results of a hydroponic agriculture Proof-of-Concept (PoC), which was developed using Quicklogic's QuickFeather in conjuntion with SensiML to highlight the enormous benefits that the growth of crops without soil brings to the climate change. We find that by providing nutrients to the plants through mineral aqueous solvents, we can effectively reduce the water consumption up to 90% in comparison to open-land counterpart, while reducing the energy consumption in almost 80%.2. Introduction
According to the European Union (EU) in its agricultural policy report The CAP and climate change | European Commission (europa.eu) and to the Food and Agriculture Organization of the Nations Union (FAO), traditional agriculture is a driving force of greenhouse gas emissions through extensive utilization of land, raising livestock and the intensive usage of fossil fuels. This latter has become essential to manufacture fertilizers and pesticides, generate electricity to power heavy farming machinery, transportation and grain drying among others. Consequently, the amount of carbon dioxide (CO2), methane (CH4) and nitrous oxide (N2O), which are mainly responsible of the global warming, due to agricultural activities has been out of control with a constant increasing food demands of world’s population. Therefore, it is urgently required to take action in the way that humankind is fed through new agricultural methodologies which are sustainable, while requiring much less energy. Although oil companies around the globe are promoting biofuels as an alternative to mitigate the impact that fossil energy sources have in the generation of greenhouse gases, the reality is that the introduction of those fuels are far from being massive. In order to diminish its dependency on combustibles, agriculture has to be local to avoid gas emission due to transportation; has to employ less land to control plagues without pesticides and fertilizers; has to require less water consumption to evade soil erosion; and has to be vegan. One of those promising methodologies, which complies with all those aforementioned requirements, is the horticulture based on hydroponics.
Hydroponics is a soilless method for growing crops, in which the roots are constantly irrigated with an aqueous nutrient solution. In this context, the plants grow faster because the illumination exposure, amount of nutrients, oxygen and CO2, and plagues can be massively controlled in comparison to its traditional cultivation in soil counterpart. Since this method entails no soil, it has been adopted in big cities to produce certain plant specimens such as potatoes, tomatoes and lettuce, contributing to the reduction of greenhouse gases derived from transportation. Related to water consumption, it is provided to the crops throughout an irrigation system composed by a pump. Irrigation is a key factor for the growing of crops because the absorption of nutrients depends on the amount of oxygen dissolved in the water. Therefore, in a hydroponic system the aqueous solution must be provided when a certain level of depletion has occurred in the root zone, which serves as a reservoir. This way, the usage of technology becomes evident in order to automatically provide plants what they need when they need it.
In this article, we present the design and implementation of a Cyber-physical System (CPS) using the QuickLogic’s QuickFeather version 1.2 in conjunction with the machine learning SensiML framework. The QuickFeather board is used to process the data captured from a temperature sensor, while the machine learning framework trains a model, which provide accurate information about the time when the crops has to be irrigated and the amount of nutrients required in real-time. Our system mimics a hydroponic plantation and we evaluate our solution in terms of water and energy consumption in order to validate that this type of food production system can effectively replace traditional agriculture.
Our CPS PoC is depicted in the following image. As shown, it consists mainly of moisture and temperature sensors, and an air stone for oxxygen control. This setup represents a Deep Water Culture system, where the roots of the crop are placed in a net pot filled with substrate. The roots are directly exposed to the aqueous nutrient solution, and the pump injects air bubbles to maintain the crops well oxygenated. Therefore, this hydroponics configuration fosters the rapid growing of the plants, while keeping the construction cheap and simple. The main advantage of this system is its resilience in case of pump’s breakdowns, where the plants can still survive for long periods of time because it employs a considerable amount of solvent. In our experiments, we changed the aqueous solution every two weeks in order to avoid insect proliferation or bacterial dissemination.
It is noteworthy that the diffused oxygen allows the plant roots to absorb maximum amounts of nutrients resulting in accelerated crop growth. This is the reason why hydroponics has a positive impact in climate change because efficient nutrient absorption effectively reduces the amount of fertilizer required, while shrinking the time to market in aliment production.
In this project, we track the growth of the crops through moisture, pH and temperature sensors. To our considerations, those represent the metrics which can provide accurate information about the functioning of
In order to follow different variables, we will insert moisture and temperature sensors. The captured data can be analyzed using machine learning models which will predict water management. Concretely, we are interested in investigating how temperature impacts the ecosystem dynamics through phenomena such as evaporation, acidity and soil moisture. Consequently, deep learning algorithms can be implemented on the QuickFeather board to predict the optimal irrigation based on evaporation and transpiration of the vegetables.2.1 Setup2.1.1 Crops growth
We developed our project on a hydroponic system growing kit with six hole plant size. We have selected this kit because it is made of solid and durable high-quality plastic, which will be resilient for the growth of any sort of plant family. More information can be found in external retailers like this one.
The hydroponic culture is composed by two stages:
- Initial plant germination: Seeds are fragile and they do require a lot of care before being used in a hydroponic system. The seeds need a humid environment, without an exposure to the nutrients of the hydroponic system. This is the reason which justifies why initial plant germination is done outside of a hydroponic system. Depending on the plant type, this process can take between 1 or 2 weeks. Most tutorials available on the internet recommend using rock wool to improve this growing phase. We put a plastic cover in order to keep humidity high.
- Plant growth in the hydroponic system: Once the plants have small roots, they can be placed inside the plastic sponge to continue the growing cycle, as depicted on the figure below.
In order to calculate the size of the air pump, it is important to consider the size of the nutrient reservoir. Normally, the rule states that the air pump must have a voltage equal to the number of gallons of nutrient solution available. In our case, for this tiny PoC, we can basically use any air pump because the water of the growing kit can be oxygenated without any concrete problem.2.2 Hardware development
The QuickFeather is the basis platform from which this project has been developed. In comparison to other boards, it stands out for being supported by open source hardware development kits and software tools. On the market, the are other microcontrollers, which offer different and similar hardware modules such as arduino Uno WiFi or the Arduino MKR VIDOR 4000, but not of them count the the vast support that the QuickFeather has, making it really attractive to new developers. One of the main features of the QuickFeather is its built-in eFPGA, which is programmable through a framework called SymbiFlow to exploit vectorization to compute highly parallelizable programs. The MCU can be flashed via Zephyr and FreeRTOS.
The reader can have access to the documentation available here. However, there is still no pin-out diagram available, so I propose the following one:
As it is depicted, there are 8 GPIO available in total and two I2C interfaces. An Analog to Digital Converter (ADC) can be used to connect multiple sensors as it's recommended in the documentation of the QuickLogic Open Reconfigurable Computing (QORC) Quickfeather Software Development Kit (SDK).
The components apart from the QuickFeather 1.2 used for the development this project are listed as follows:
- 2000 mAh LiPo Battery
- DS18B20 temperature sensor: Is a waterproof sensor that can be used inside the plastic recipient. It can measure temperature in the range from - 55 C to +125 C.
- Soil moisture sensor: The sensor shows relative value from 0-100, which can be calibrated using the procedure from references like this one.
- pH sensor: Show a pH values in the scale from 0 to 14.
2.2.1Data collection mode
In order to train a machine learning model, enough data using the QuickFeather must be captured. There are two ways to read data from the Quickfeather: through another device like the esp32 to transfer data via WiFi or using the serial connection.
We connect the USB-serial connection to a Raspberry 3B ito have a low power device for data collection. The following scheme, depicts how the connection has been made with different electronic components.
2.2.2Model inference state
We pretend to demonstrate that the usage of a lithium battery is enough to power the QuickFeather to train machine learning models on-the-fly, making the device completely autonomous. This has been an objective we set to validate our PoC because we wanted to show that technology is the key to scale up food production in hydroponic agriculture.
As depicted in the figure below, the actuators are attached directly to the pins of the QuickFeather and its activation and sleep mode depends directly on the trained machine learning prediction model. In the next section, it will be vastly explained how SensiML has been used for the deployment of our autonomous and intelligent CPS.
We have tested our system massively and we have drawn the following metrics to evaluate our solution in comparison to traditional agriculture. Since we have used lithium batteries, we calculate the total power consumed as the product between the capacity of the battery and the time of its usage. We dispose of a 2000mAH battery which is under use. By assuming a endless usage of our power source, we have reached that the energy consumption of our solution is better than traditional farming around 80%, when compared to the energy consumed to generate one tone of food in Europe according to this report. https://edepot.wur.nl/278550
In terms of water consumption, we outperform the traditional farming up to 90% in terms of irrigation per area. We filled our growing kit with four liters of water and we changed it for two weeks in the same area. By scaling up this value and comparing to the numbers of the World Bank, https://www.worldbank.org/en/topic/water-in-agriculture#3, we concluded that hydroponic can reduce the water consumption up to 90% per km2.2.3 Software development
SensiML also provides an open source utility for data acquisition called SensiML Open Gateway. We made a contribution to this software by using it via a remote server, that for our case of study was a Raspberry Pi as it can be shown in the hardware development section. The Raspberry Pi receives data from the Quickfeather using UART serial connection and it saves it in the memory SD card. This data is then transferred to a local machine or the cloud to be analyzed.
One advantage of SensiML is the versatility of its tools:
- The Data Capture Lab is employed to capture, label, train and export a machine learning model. This is especially interesting for end users that don’t want to deal with machine learning directly.
- Another option is to use the AutoML Python library in a Jupyter notebook, which allows more flexibility during machine learning training. This method is oriented for data scientists who want to have more control of the interface.
We capture data from temperature and the pH sensors. The hydroponic device is indoors then the water temperature doesn’t not change considerably during the day. However, pH values have a bigger influence since the plants are continuously growing. The following graph shows the evolution of these two variables.
The ideal range of these two values is between: 15 to 26°C for the temperature and 5.8 to 6.4 for pH. We also noticed that pH is influenced by the state of the air pump, so it increases when the pump is running and decreases (becomes more acidic), when the pump is not turning. We decided that this might be a good use case, where a machine learning model should detect when to turn on the pump.
In order to train a machine learning model, we label the data as “ON”, when the pH is low and there is a need to turn on the air pump. In the following graph, you can see the green line on 1 when the pump should be turned on.
In Data Science (DS), this use case corresponds to a binary classification problem. We define a pipeline using SensiML SDK where the data is sliced in windows, feature extraction is made and then it’s fed to a machine learning model where the output determine if the air pump should be turned ON. There is also flexibility when choosing the kind of model that can be used (more information and examples can be found at the SensiML tutorials ), for our case, we used a neural network with 6 sequential layers. This model has a good performance with an accuracy of 76% and recall (sensitivity) of 86% on the validation data as you can see in the following graph.
This model can be exported and downloaded directly from the notebook using a jupyter widget. This is very convenient for a data scientist, since everything is running on python.
The output of the model can be used in different ways:
* Light the on board LED on the Quickfeather when there is a need to turn ON the air pump.
* Use a relay to turn on and off the air pump
* Use a mechanical component to add more nutrients to the water.
We chose the first option for sake of simplicity, so whenever the model had the light on, we turned on the pump manually. The model is able to predict when there is a need to change the pump performance.
In this project, we have developed a CBS to demonstrate that agriculture based on hydroponics is a really attractive solution to combat the emission of greenhouse gases generated during the development of agricultural activities. Our main motivation was to provide a real PoC to prove that the world can effectively adapt new types of environmental friendly agriculture, which do not rely on fossil fuels nor in livestock production.
We have used the SensiML software to regulate the functioning of an air pump based on a trained machine learning model. We demonstrated that all the important variables for the growth of crops can be controlled based on the level of oxygenation of water. Therefore, we proved that hydroponic agriculture based on high-end technology is a reality, which can be adopted across the globe due to its reduced price tag and its trivial maintenance.
We do consider that with this project, we accomplished to show that agriculture can be local, consuming lower hydric resources and fertilizers. The production of crops took place in a tiny growing kit and it is expected that it can be stacked to scale up the aliment production. On the other hand, hydroponic reduces the amount of water and fertilizers required for agriculture up to 90% because the humidity of the plants can be maintained only by an aqueous solutions in the roots.
Nevertheless, it is noteworthy that a Deep Water Culture system is really sensitive to changes in the acidity (pH) and electric conductivity and a strict tracking of those variables are indispensable for the growth of crops. We pretend to extend this project by having larger growing kits in which we can evaluate how through a network of QuickFeather, food at a massive scale can be produced.