IoT and Arduino Based Design of a Solar, Automated and Smart Greenhouse for Vegetable

. Seasonal farming practiced in Cameroon is a major limitation to our gross domestic product. In this context, introduction of a standalone solar, automated and smart greenhouse system to improve agricultural yield in quality and quantity could provide a solution for all year round crop production while minimizing the total power demand for industrial, mechanical, chemical and commercial uses. This system comes to solve the problem of too much reliance on seasonal climatic conditions by increasing our total crops produced and reducing the amount of farmland exploited as well as environment preservation. Regulated automatically, proposed solution incorporates several modules including: a solar power system and all the physicochemical parameters (room temperature, room humidity, light intensity, amount of CO2, pH, soil humidity, amount of nitrogen, phosphorous and potassium) necessary for good production of vegetables in quantities and qualities regardless of the weather. The electronic modules were designed and realized based on Arduino and Internet of Things (IoT). Using a Wi-Fi module and a Geogebra software, an android application was developed for monitoring, displaying, and analyzing those parameters. This enables the control of all aforementioned components of the greenhouse system from any device capable of using Wi-Fi regardless, of the distance of the operator. A mathematical correlation were established between the voltage and various physicochemical parameters. With a daily consumption of 653Wh, the overall system has an efficiency of 65% with a peak power of 400W.


Introduction
The development of agriculture is one of the most powerful levers for ending extreme poverty in underdeveloped or developing countries.According to the report of the United Nations Food and Agriculture, in order to feed the growing population of humanity, the world will have to produce a surplus of 70% of the production to feed 2.3 billion more people by 2050 [1].Agriculture is a key factor of economic growth representing till 2014, one third of the world's Gross Domestic Product (GDP).Compared to other sectors, its growth has more effective effects on increasing the incomes of the poorest populations.According to a study published in 2016 [2], 65% of the workers depends on agriculture for a living.Agricultural production is highly dependent on water, yet it is increasingly exposed to water-related risks.It is also the most water-consuming sector and the biggest polluter of this resource.Improving water management as well as the use of fertilizers in agriculture is therefore essential for the sustainability of a productive agri-food sector [3].
In Cameroon, most of the population depends on agriculture, of which 95% of farmers are family-type and only 5% of large producers have modern means.Moreover, Cameroonian agriculture encounters many constraints related to climatic hazards, less rainfall, uncontrolled use of chemical fertilizers, adaptability crops, etc. whereas, there are many operations in the field that require great precision in the processes in order * Corresponding author: nouadjep.serge@ubuea.cmto optimize the yield, the crop quality, and to limit the cost of production and water consumption.To meet these requirements and to improve agricultural yield, in quality and quantity, automation systems should be put in place.It is in this perspective that the design of a standalone solar, automated and smart greenhouse system would be useful for water optimization in offseason crops and also for optimal management of fertilizers.As time and quantity control are two basic elements of automating irrigation systems [2][3][4][5][6][7], the aim of our work focuses on the design and installation of a smart and self-powered system (equipped with automated subsystems for irrigation, fertilizer, cooling, heat, light, soil pH and CO2) adapted to off-season cultivation of tomatoes (Sloanum lycopersicum) as case study.Tomato is full of many medical properties, it is rich in antioxidants: the tomato owes its red colour to lycopene which protects cells from root attacks and to beta carotene which is a major antioxidant playing a role in the prevention of many cancers and cardiovascular diseases.Tomato is excellent for dissolving bad fats and eliminating them more easily.It is also rich in vitamin C (from 10 to 30mg per 100 g).Tomato contributes to a better assimilation of iron and calcium and finally it help reducing hypertension, thanks to its richness in potassium.Many techniques have been developed regarding the design on greenhouses [8], but inclusion of the smart aspect in the control of process parameters as well as making use of pH probe remains scanty in the literature [9,10].

Tomato
From its scientific name Sloanum lycopersicum, tomato is a fruit vegetable of the Solanaceae family made up of the following characteristics: • Leaves: odd-pinnate, alternate leaves.The leaflets are lobed.They bear glandular hairs; • Flowers: yellow in color, they are arranged in branched cymes; • Fruits: these are large berries, more or less rounded, generally red, sometimes yellow, orange.
There are two types of tomato varieties: Varieties with an indeterminate habit, which require pruning (pinching suckers) to limit growth and cause new flowering and which often require staking; The varieties with a determinate habit whose development is of the bushy type which do not require pruning or cuttings.it is obviously simpler, in field cultivation, to use varieties with a fixed habit [11][12][13].The plant cycle is as follows: Emergence (1 week), Transplanting (2 weeks), Planting (1.5 Months), 1st flower (up to 3 months), Fruit set and harvest (up to 5 months), End of harvest (up to 7 months).

Edaphoclimatic requirements
Temperature: The optimal temperature for development varies between 20 and 30°C during the day and 17°C at night, 14 to 18°C at ground level; Humidity rate: The optimal value is between 60% and 80%; Floor: Loose, deep, light, well-drained soil with a pH between 5.5 and 7. Water requirement: Some farmers make use of 1 liter of water per day per tomato plant regardless of weather conditions.But According to several tests carried out at the center of research for the use of salt water in irrigation in the soil physics laboratory, the minimum needs of the tomato are around 3 to 4 mm/day (i.e. 3 to 4l/m 2 /day), and peak requirements are around 8 mm/day (i.e.8l/m 2 /day) [14].

Computer and electronic equipment
The equipment use in carrying out this work includes the followings: Arduino: This is a C programming environment specially designed by ARDUINO development, for programming circuit boards [15].The Mega 2560 is a microcontroller board based on the ATmega2560.It has 54 digital input/output pins (of which 15 can be used as PWM outputs), 16 analogue inputs, 4UARTs (hardware serial ports), a 16 MHz crystal oscillator, a USB connection, a power jack, an ICSP header, and a reset button.The Arduino kit also contain test plate, connection wires, and relay module.
PROTEUS software: Proteus is a software package allowing electronic CAD, published by the company Labcenter Electronics.It is composed of two software: ISIS, allowing the creation of diagrams and electrical simulation, and ARES, intended for the creation of printed circuits.As other components, we have: sensors for temperature, humidity, light and pH.A submerged pump of 12 Volt DC brushless motor with a current less than 4A, out of water diameter of 4 mm with the flow rate of 1 bar.NF 12V plastic solenoid valves, plastic pipes, some accessories and fittings.
To have a continuous data analysis and control of the greenhouse, the system is equipped with a WI-FI module.

Methods
The approach adopted (Figure 1) to design the greenhouse system for tomato cultivation is as follows.

Design of various subsystems
Figure 2 represent the functioning diagram of the overall system.This figure highliths exactly the relationship between various blocks, sensors, actuators and microcontroller.

Telecommunication system (WI-FI)
As the system is equipped with a WI-FI, HTML is use to gives the structure of the activities in the application.It helps define the User Interface-UI components.CSS is there for the styling, coloring, design and animations.Java Script is use to implement the application's logic.The Angular JS is simply a library over JavaScript (JS) that abstracts certain functionalities and makes the implementation of the application's logic easier and more modulable.It allows dynamic data binding, live template reloading and structures the code by using the model-view controller (MVC) design pattern.Angular JS produces Java script code which is then transformed by the Cordova framework into android code that will produce the various activities with their various views.The Ionic Framework sits on top of all these libraries and various languages and provides its own reusable components that can be modified and reused as per the business logic of the mobile application.Figure 3 shows the relationship between these components.

Design of the automatic functionning
Considering some aspects and techniques of the analysis technique group, the most important are: Identification, Simulation and Formal Verification [15][16][17][18].This approach is based on Simulation Techniques and modeled as being discrete.As a guarantee that the developed controller will always react accordingly to the expected behavior.It is necessary to model the controller and the greenhouse system as being discrete.In this study, total controller behaviour structure (GEMMA) is implemented for the overall control system modeling [17], while the SFC (Sequential Function Chart) is use for the controller specification formalism [19,20] and Arduino software for the simulation tasks of the controller specification.With this set of formalisms and tools we demonstrate that all is guarantee for the automation system, to behave in the desired behavior, when the emergency stop command is activated.

Fertilizer control system
We used a pH probe to measure the soil's pH instantaneously.A calibration process was carried out using multimeter to determine the relationship between the voltage and the pH.Once having the relationship between the pH and the reading analogue voltage, we determined the relationship between the pH and the various fertilizers (Nitrogen, Phosphorous, and Potassium).This was done using a result of an experiment on the soil doped by the lime [21,23] and using Geogebra Setup the different equations giving the relation between the pH and each fertilizer was obtained.Having all the relationship mentioned above we connect the pH probe to the Arduino as an analogue value, sample the signal and then program it according to the equations obtained through Geogebra Setup.According to the instructions compiled in the written program, the microcontroller will either start or stop the motor pump through a relay in order to supply the fertilizer in form of drip irrigation accordingly to the need of the plants.This motor pump has the same characteristic with the one used for irrigation and cooling systems.

Power system sizing
Rural region are most of the time, non-connected to the grid (Energy provider).So to have a standalone greenhouse, we have to look for a renewable energy to supply the system.We use the solar energy in our case.
Load profile : The load profile is the process by which we determine the voltage, current, power, energy characteristic and operating time per day of our loads.The load profile for our system is given in table 1.
PV (Photovoltaic) module sizing: Since our system is a PV standalone with batteries, the losses due to internal structure of the solar panel such as heat of the PN Junctions and losses due to environmental conditions are found between the ranges of 25% to 45% [27,28].For our system we are going to consider 35% of losses, this means an efficiency of = 65%.Real consumption with losses: Energy produced by one solar panel of 50W, 12V and 2.80A ‫ܧ‬ = ‫ܫ‬ * ‫ܪܵܲ‬ (2) (3) where Ir is the average solar radiation of 4KWh/m 2 /day and G = 1000W/m 2 : is the solar power The number of solar panel in series: it is determined according to the voltage need by our load.The Number Batteries sizing : To know the number of batteries our system required, we have to know the efficiency of one battery, the depth of discharge of that battery [29].We also need to know the numbers of days our environment can stay without sun while our system is functioning.
The capacity of the battery is given by: Where : Nday is the number autonomy day.Here, we are taking 5 days is the battery efficiency which is 90% is the depth of discharge which is 70% as per the manufacturer [30].
ܸ ௧ is the battery voltage.
The number of battery is given by ܰ ௧ = () ್ೌ (6) Charge controller: MPPT (Maximum Power Point Tracker) is used to regulate the output voltage of the solar panel since the light intensity is varying then the voltage also varies.Its choice depends on three parameters: input voltage, current and power.

Analysis of the need
The application of the 5W+1H tool effectively shows us that the farmer is confronted with certain problems (Long watering time with high water consumption, Destroyed plants, drop in production, watering task is painful, waste of fertilizers) which require setting up an automatic system to regulate consumption and optimize harvest time.Moreover, from the implementation of the horned beast diagram, it appears to be essential to set up a system which must allow the automatic watering and feeding (with fertilizer) of the plants (tomatoes) at a controlled quantity and at the indicated time.This system is intended to be more accessible and more ecological.

pH probe calibration for fertiliser control
From the implementations on the Geogebra setup, the relationship between the voltage given by the probe and the sensor were achieved as illustrated on figure 4.
The relationship (graphs and equations) between the pH and various fertilizer; nitrogen, phosphorous, potassium were also obtained as shown on figures 5, 6 and 7 respectively.As the previous graphs can demonstrate, we have now a way to control and monitor the fertilizer required by the plant at any time.The rest of the circuit was mounted, connected and test was carried out.

Automation of the greenhouse
The general functionning of the system was model using the GEMMA and it is shown on figure .With the GEMMA above, we see that the overall functioning modes are taken into consideration (automatic, manual and even semi-manual mode) and that almost all events that could modify the normal functioning was mentioned.This result also gives us the link between each mode and helps us to prevent some unwanted situation like when the acting cylinder (actuator) does not work and stay blocked independent of the humidity level.It allows us to come out with all the starting and stopping states of the greenhouse and how to protect it.
Once completed the program codes compilation and implementing the technology above, an android application was developed and installed on some android phones and tablets.The display interface (figure 1) obtained displays instantaneously, the value of each required parameter.

Power supply
The results observed for the power supply system are summarized by table 2. These are the minimum parameters that our charge regulator has to support.It observed that the number of batteries required is high, because of its capacity (9Ah).So in order to have less number of batteries, we just have to buy or make use of a battery with high capacity.For example, if it was a 120Ah, we will just need 3 batteries.We can also play on the power of a solar panel to increase the power produced while reducing the number of solar panels.

Conclusion
It was a question here of designing an automatic irrigation/feeding system in order to overcome the problems encountered often by farmers of off-season crops such as: overconsumption of water and fertilizers, long watering time, poor watering distribution and reduced harvest.We have therefore proposed an automatic drip system adopted for tomato cultivation which will allow the improvement of productivity conditions, particularly for those who live in rural areas due to better management of their fields and their yields.The use of the functional analysis method allowed us thereafter through the technological solutions to make the choice of the tools and the programming language in order to carry out the dimensioning.The outcome is a fully automated, smart and self-powered solar greenhouse with a peek power of 400W.This system is equipped with a WI-FI module, an android application, enabling the control of all the greenhouse system from any device capable of using Wi-Fi: android phone, tablet, laptop regardless of the distance of the operator.Also, results depict that our system has several advantageous characteristics, such as: ease of network management and control motors and valves.In addition to the five sensors adapted in most proposed designed systems (soil moisture, humidity, temperature, CO2, and light) measuring changes in environment inside the greenhouse, the achieved system makes use of a single pH sensor to manage the fertilizers as per established mathematical relation between the pH and these parameters.

Fig. 3 .
Fig.3.Telecommunication system between hardware and Software

Table 1 .
Load profile of the greenhouse.

Table 2 .
Power supply characteristics