# GreenLab, an IoT-Based Small-Scale Smart Greenhouse
## 3 GreenLab Project
### Implementation  
#### 3.3.1 Hardware  
Following the schematics and the requirements from the previous sections, we have implemented a prototype of the greenhouse with the following dimensions 40 \(\times\) 30 \(\times\) 22 cm, to which we have added all the components from the schematics in Figure 3, reaching  
Figure 12: Heating flow chart.  
Figure 13: Graphical User Interface of the mobile application.  
a total cost under USD 200. The main hardware components used by this solution are as follows:  
* An Arduino MEGA 2560 R3 development board with an ATmega2560 microcontroller;
* An Ethernet module (Shield Ethernet W5100);
* A power module consisting of a solar panel OF 156 \(\times\) 39 MM, with 12 solar cells and a maximum power of 34 W and an HB130802 battery charger linked to an Ultracell 12 V battery;
* A Solar Charge Controller that is linked to the Arduino Board, to the Ultracell Battery, and the solar panel;
* A HL-588 8-channel 12 V optical isolated relay module connected directly to the board;
* An ultrasonic distance sensor (HC-SR04);
* A capacitive soil moisture sensor (DFROBOT Capacitive Soil Moisture Sensor;
* A gas sensor (MQ-135);
* A light sensor (YQZBML_Mod-lights);
* An air temperature and humidity sensor (DHT11);
* A submersible water pump;
* An auto heater (Auto Heater Fan, 12 V/150 W );
* Two fans (DL08025 SE 12M);
* LED matrices.  
Each component, its cost, and its functionality are described in Tables 2-5. Pictures of the obtained prototype can be seen in Figures 14 and 15.  
Figure 14: GreenLab—prototype.  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Crt.** & **Model Name** & **Specifications** & **Cost (USD)** & **Main Functionalities** \\ \hline \multirow{3}{*}{1} & HC-SR04 ultrasonic distance & Range: 2 cm–400 cm; Resolution: 3 mm & 02.10 & Used to measure the distance from the water container’s cap to a floating object for determining the water level in the container \\ \hline \multirow{3}{*}{2} & DEROOT capacitive soil moisture & Number of pins: 3 (AUOT—analog out, VCC, GND) & 01.03 & Used to measure the soil moisture and send it to the analog output pin \\ \hline \multirow{3}{*}{3} & MQ-135 gas sensor module & Dual signal output (analog output, and high/low digital output) & 2.54 & Used to measure concentrations of different gas types such as ammonia, benzene, hydrogen and smoke \\ \hline \multirow{3}{*}{4} & DHT11 digital temperature and humidity sensor module & Humidity measurement range: 20–95\% RH; Temperature measurement range: 0–60 degrees C; & Used to measure the temperature and humidity values inside the greenhouse \\ \hline \multirow{3}{*}{5} & SN-LIGHT-MOD light sensor module & Photosensitive resistor and on-board potentiometer to adjust light brightness threshold & 0.76 & Used to detect environmental light intensity \\ \hline \hline \end{tabular}
\end{table}
Table 4: Sensors.  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Crt.** & **Model Name** & **Specifications** & **Cost (USD)** & **Main Functionalities** \\ \hline \multirow{3}{*}{1} & HL-588 8-channel 12 V optical & 8-Channel Relay Module with & 5.66 & Used to control the actuators \\  & isolated relay module & Opto-coupler & & & \\ \hline \multirow{3}{*}{2} & Entry and Exit fans & 2-wire connector 12 V, 0.28 A & 12.88 & Used to cool the air in the greenhouse \\ \cline{2-5}  & LED matrices & 6 Matrices; Number of LEDs per & 6.33 & Used as a light source in the greenhouse \\ \hline \multirow{3}{*}{4} & Submersible pump & Flow rate: 1.2–1.6 L  min & 1.85 & Used to extract water from the water container and pump it through an attached tube \\ \hline \multirow{3}{*}{5} & Auto heater & Power: 150 W & 12.33 & Used to heat the air in the greenhouse. \\ \hline \hline \end{tabular}
\end{table}
Table 5: Actuators.