Introducción
The trend towards the legalization of cannabis for medical use began several years ago. In the United States (California), legalization was reached by popular vote in 1996 (Leung et al., 2022). In Canada, it was ruled in 2000 that the prohibition of medical cannabis violated human rights. In Australia, in 2016, doctors were authorized to prescribe medical cannabis products to patients with conditions including chronic pain, anxiety, cancer-related symptoms, epilepsy, and other neurological disorders (Elkins et al., 2019; Honahlee, 2020).
In this scenario, research on medicinal components based on cannabidiol (CBD) has increased exponentially. Today, the properties of CBD are being investigated for the treatment of patients with childhood epilepsy (Bai et al., 2021), Parkinson, schizophrenia, diabetes, multiple sclerosis, and anxiety (Gunn et al., 2019). In order to respond to the needs of the market, the medical cannabis agribusiness has grown, rapidly leveraged by the laws that promote these activities (Chandra et al., 2017).
Cannabis cultivation has focused on two main methods (Chandra et al., 2017): 1) cultivation in greenhouses under controlled conditions and 2) outdoor cultivation. In the first case, more importance is placed on ambient temperature, irradiation (light), humidity, day length, planting densities, and harvest times, as well as on the growth medium ingredients. In outdoor cultivation, the variety or type of crop is selected depending on the climate of the region and the local soil. Then, the site is prepared, and pest control methods are selected.
Internet of Things (IoT) is one of the technologies that has been widely used in agribusiness for the timely detection of crop status, so that appropriate measures can be taken (Gupta et al., 2022; Alonso et al., 2020). Several proposals have explored the use of technologies for automating the control of these crops. These solutions are mostly black box, do not allow customization, and can be very expensive.
This article describes the development of a low-cost prototype for the automation of medical cannabis production in greenhouses supported by IoT. The prototype allows for real-time control of growth temperature, light, humidity, day length of the crop, and harvest time. The main contributions are: 1) the design and implementation of a hardware architecture using low-cost components and 2) a mobile application that allows farmers to monitor and control the greenhouse variables in real time from any location.
The rest of this article is organized as follows: the next section presents some related works; later, the development framework for the hardware components and the mobile application is presented; then, details are given on the evaluation of the system by experts; and, finally, the concluding remarks of this study are presented, as well as proposals for future work.
Related Work
Although the use of cannabis in medicinal treatments began thousands of years ago (O’Brien, 2019; Bai et al., 2021; Malík et al., 2021), the rise of this agribusiness is relatively young (Perkins et al., 2021), and it has been supported by technologies for crop control (outdoor cultivation and greenhouses). Some of the most relevant works in this area are presented below.
Small (2018) describes dwarf germplasm to achieve a giant variety of cannabis. This variety offers a short-stature ("semi-dwarf") crop that, by improving ideotypes, improves harvesting efficiency and surface production. Similarly, hemp fiber cultivation (Cannabis sativa L.) is a high-yielding, sustainable industrial crop in which cannabis can be grown from seed and/or for dual purposes in a wide range of geographic and climate conditions (Salentijn et al., 2015). Currently, the main producers of cannabis are China, Europe, Canada, and Australia.
In Europe, most cannabis plants have been cultivated for industrial purposes. Therefore, cannabis cultivation technology has been widely studied. Indoor or greenhouse farming has become much more sophisticated and has proven to be the most effective method for producing medicinal cannabis. Growing medicinal cannabis in a greenhouse, unlike growing it outdoors, has the advantages of heat and sunlight (Wadsworth et al., 2022). The most important aspect of cannabis farming is light. Plants need a lot of light during each growth phase (at least 12 hours a day). A greenhouse with a transparent roof is the perfect solution to take advantage of the natural light and temperature. However, the use of natural sunlight is not enough; it is necessary to have additional lighting in order to provide the plants with enough light and heat. Other advantages of growing cannabis in a greenhouse include the fact that there is a permanent control of natural and artificial light, ventilation, irrigation, and humidity (Chanchí et al., 2020). Plants are protected from bad weather conditions, and there is greater control of pests, weeds, and diseases. Moreover, it is possible to grow crops all year round, obtaining products out of season, and in regions with restrictive conditions. Finally, greenhouses increase the comfort and safety of crops, and they allow achieving a high-quality production.
Most of the existing works do not focus on the automation of greenhouses, which is why this article describes the development of a low-cost prototype for the automation of greenhouse medicinal cannabis production supported by IoT. This is complemented by a mobile application that allows real-time monitoring, giving the greenhouse owner (farmer) the possibility to control the greenhouse from anywhere.
Proposal
Each of the components of the proposed prototype is described below:
Hardware: The proposed architecture is based on the related work, and the requirements are established in accordance with technical visits to the farmers (Figure 1).
The hardware architecture integrates sensors to monitor temperature (DTH22 in Figure 1), humidity (S Hum. in Figure 1), and pH, as well as control mechanisms for the bulb that provides light to the crop, the ventilation that allows keeping an optimal air distribution in order to avoid vertical temperature differences, and the valve for the irrigation system. These control mechanisms are activated through connections with the relay. In addition, an analog-digital converter (ADS 1115) was implemented, which provides access to analog pins for sensor connections, and an RTC module was integrated to manage actions that require monitoring at specific times.
The operation of the prototype is described in Figure 2. The greenhouse has a video camera that allows monitoring the behavior of some components in real time. In addition, the mobile app allows integrating and visualizing the system data.
The mobile app allows controlling the greenhouse, as well as defining when the plantation begins, and it shows information about the variables retrieved from the sensors in real time and displays the status of the greenhouse through cameras. The prototype includes different mechanisms such as a lightbulb, ventilation, a water pump for the drip system, and a camera. Furthermore, diverse sensors are included which measure temperature (DTH22), humidity (YL100), and pH (0-14), which provide data on the climate and conditions inside the greenhouse.
The data received from the sensors are received by the Wi-Fi module. Then, this information is sent to the web server (PHP) via Wi-Fi and stored in a database. This information is later visualized in the mobile app. The actuators installed in the greenhouse receive orders from the mobile app, and the server responds via the HTTP protocol to the requests made by the user. Then, the conditions of the on/off variables of the greenhouse’s control system are evaluated. The server (PHP) sends the orders to the WIFI-ESP8266 module, and this activates/deactivates the controls (ventilation, irrigation system, lightbulb). The humidity, temperature, and pH sensors also communicate with the aforementioned module to provide information on the crop.
The WIFI-ESP8266 module is also responsible for automating the process based on the data obtained from the different sensors. This module evaluates and makes decisions based on the conditions listed in Table 1 in order to respond to the control mechanisms (actuators) installed inside the greenhouse, with the purpose of adjusting the conditions to the needs of the crop.
Mobile app: Figure 3 shows the interfaces of the app. The user can log in and control all the variables of the crop. The app allows visualizing the information from the database regarding the variables inside the greenhouse. The database also stores the start date and time of each change, which allows monitoring the processes and evaluating improvements.
Results
The evaluation of the prototype was carried out in two stages: 1) validating the data obtained from the greenhouse and 2) evaluating user satisfaction via a survey applied to 60 people (agroforestry engineers and agronomists).
Data validation
The data obtained from the sensors was evaluated for eight weeks (S1-S8). During this period, the operation and the data captured by the sensors were observed. From these data, the per-week average was calculated, validated by the parameters shown in Table 1. In Figure 4, it can be seen that the temperature is stable as time goes by, starting at 22 and ending at 28 °C, which is the temperature necessary for the standard growth of the crop. This confirms that the prototype was able to control this important variable in the crop. On the other hand, when the temperature increases, it is observed that the humidity decreases, starting at 80.1 and ending at 40% at the end of S8. This confirms that the sensors receive the information and act based on their initial calibration. Regarding the pH, it remained between 6.0 and 6.5 on average for each week, a slightly acidic level, which is an ideal value for a good development of the cannabis crop.
Validation with Users
To assess user satisfaction, a survey was carried out with a series of questions, which are presented below (P1-P6):
P1. Based on the importance of medical cannabis worldwide, do you consider feasible the development of a prototype for cannabis crop control?
P2. Do you think that the greenhouse control mobile app is useful?
P3. Do you know any automated greenhouses in the sector?
P4. Do you think that the use of the mobile app is easy or difficult?
P5. What are the most used functionalities in the greenhouse?
P6. Do you think that the automation of medical cannabis farming will improve the quality of production?
The survey was applied to 60 people, including agroforestry engineers and agronomists specialized in cannabis cultivation. The results of this survey are presented in Table 2.
Regarding P1, only 3% of people do believe that the use of the prototype is feasible, unlike 87% of the sample. Regarding P2, 73% find the app useful, and only 4% do not. It was also possible to identify that most of the users did not know any automated greenhouses (P3). Regarding the usability of the app (P4), the results indicate that most of the users (90%) found the app easy to use, while a very small percentage of users (around 10%) said otherwise. P5 shows that the most important functionality in a greenhouse is climate control (40%), followed by water (26.7%), and light and ventilation (23.3 and 10%, respectively). 73% of the respondents (P6) expressed that the app can improve the quality of the crop.
Conclusions
Medicinal cultivation of cannabis offers great benefits for both producers and users. However, this market poses great challenges for the industry, as it is necessary to innovate in order to remain competitive. Greenhouse cultivation offers great advantages, but it needs to be supported by technologies to reach its full potential. Most of the existing solutions are black box and do not allow for customization, which is why this article describes the hardware and software architecture of a platform that allows automated greenhouse control for cannabis crops. The evaluation of the data obtained and the perception of the users demonstrates the great potential of the tool for the growth of the sector.