Mini Project Greenhouse1.1
Mini Project Greenhouse1.1
CHAPTER 1
INTRODUCTION
To monitor the environment inside the greenhouse different parameters have been
considered such as light, temperature, humidity, soil moisture, etc. using different sensors like
DHT22 temperature and humidity Sensor, LDR, grove-moisture sensor, etc.
• Monitors and controls the nutrient levels in the soil or hydroponic systems.
• May include sensors for measuring pH levels and nutrient concentrations.
• Utilizes advanced technologies such as IoT (Internet of Things) and AI for precise
control and monitoring.
• Incorporates machine learning algorithms for predictive analysis and dynamic control
adjustments.
Advantages:
• Maintains precise control over temperature, humidity, light, and other environmental
factors, creating ideal conditions for plant growth.
3.Resource Efficiency:
• Reduces resource wastage by optimizing water and nutrient usage through intelligent
monitoring and automation.
4.Energy Savings:
• Enables energy-efficient practices, such as using natural light when available and
regulating heating and cooling systems based on real-time conditions.
6.Precision Agriculture:
• Minimizes the environmental impact of agriculture by reducing the need for excessive
water, fertilizers, and pesticides.
• Enhances the quality of crops through precise control of growing conditions, resulting
in better taste, texture, and nutritional value.
• Provides valuable data through sensors and analytics, allowing farmers to make
informed decisions and optimize farming practices.
• Automates routine tasks such as irrigation and climate control, reducing the need for
manual labour and allowing workers to focus on more complex tasks.
Disadvantages:
2.Technical Complexity:
• Complex systems may require specialized knowledge for installation, maintenance, and
troubleshooting, posing a challenge for some farmers.
3.Dependency on Technology:
• Some advanced systems may be more suitable for large-scale commercial operations,
making them less adaptable for smaller farms with limited resources.
5.Maintenance Challenges:
• Regular maintenance is crucial, and technical issues may arise, requiring prompt
attention to prevent disruptions in greenhouse operations.
6.Overreliance on Automation:
• Farmers may face a learning curve when adopting new technologies, requiring training
to effectively use and manage the system.
8.Environmental Concerns:
• Collecting and storing sensitive data about crops and farming practices may raise
concerns about data security and privacy.
1.5 APPLICATIONS
2.Precision Agriculture:
• Greenhouse control systems are integral to precision agriculture, allowing for precise
control of environmental parameters, nutrient delivery, and irrigation, tailored to the
specific needs of different crops.
• Plant researchers and scientists use greenhouse control monitoring systems to create
controlled environments for experiments, studying plant responses to different
conditions and conducting breeding programs.
• In urban environments and vertical farms, where space is limited, greenhouse control
systems enable efficient use of available space and resources to cultivate crops year-
round.
• Greenhouses are often used for the propagation of seedlings and the cultivation of
young plants. Control monitoring systems ensure optimal conditions for germination,
growth, and early development.
6.Floriculture:
• Control monitoring systems enable farmers to extend growing seasons, allowing for
year-round production of crops regardless of external weather conditions.
• Specialty crops, such as exotic fruits, herbs, and medicinal plants, benefit from
controlled environments provided by greenhouse systems, meeting specific growth
requirements.
• Integration with the Internet of Things (IoT) allows for real-time monitoring and
control, enabling smart agriculture practices and facilitating data-driven decision-
making.
13.Organic Farming:
• Greenhouse systems support organic farming practices by minimizing the need for
synthetic pesticides and fertilizers through the precise control of environmental
conditions.
14.Energy-Efficient Farming:
• Monitoring systems help in early detection of diseases and pests, allowing for timely
intervention and reducing the need for chemical treatments.
conditions and adjust various parameters to meet the specific requirements of the cultivated
plants. Here are the key principles of a greenhouse control monitoring system:
1.Sensor Integration:
2.Data Collection:
• Continuous collection of data from the sensors to provide real-time information about
the conditions inside and outside the greenhouse. This data serves as the basis for
decision-making.
3.Control Algorithms:
• Implementation of control algorithms that process the collected data and determine the
necessary adjustments to maintain optimal growing conditions. These algorithms take
into account predefined setpoints and specific crop requirements.
4.Automated Actuation:
• Use of actuators to implement changes based on the decisions made by the control
algorithms. Actuators control various elements within the greenhouse, such as
ventilation systems, heating systems, cooling systems, irrigation systems, and artificial
lighting.
5.Climate Control:
6.Irrigation Management:
• Monitoring and controlling soil moisture levels to ensure proper hydration for plants.
Automated irrigation systems, such as drip irrigation or misting systems, can be
adjusted based on real-time soil moisture data.
7.Lighting Control:
• Management of natural and artificial lighting to provide the appropriate light intensity
and duration for photosynthesis. This involves adjusting shades, curtains, or artificial
lighting systems based on the natural light levels and time of day.
8.Nutrient Management:
• Monitoring and controlling nutrient levels in soil or hydroponic systems. This includes
adjusting nutrient solutions to meet the specific needs of the crops.
• Logging and storing historical data for analysis and decision support. Data analysis
helps in identifying trends, making informed adjustments to the control algorithms, and
optimizing the overall system performance.
11.Alarm Systems:
12.Energy Efficiency:
CHAPTER 2
LITERATURE REVIEW
2.1 INTRODUCTION
This chapter gives a general review on researches in the greenhouse systems that
have been implemented in the attempt to automate greenhouse management processes. It
outlines literature relevant to the project in areas of greenhouse technology, technologies for
greenhouse automation processes and existing greenhouse control and monitoring systems.
As opposed to open land, a greenhouse has many advantages some of which are:
offers longer growing season since greenhouse retains heat hence growing of crops can extend
even in cold seasons, one can farm even in bad weathers since crops are covered, a wide variety
of crops can be grown even exotic plants that are not grown locally, plants are protected from
predators and pest since crops are enclosed, one can grow crops without dangerous pesticide
and greenhouse can be customized to ones needs, keeps inside insects like ladybugs that are
beneficial to crop, and ensures growing of food all year round which allows one to enjoy lower
food bills advantages.
Greenhouse control systems have become more automated in recent times. The
means of automating the greenhouse can be broadly classified into wired and wireless
technologies. There are several existing Wireless Technologies which are in use today.
(BIM-433-F at 433.092 MHz) for data communication to a radius of 400 m. CAN and RS-232
through cables provided an alternative to the RF links because transceivers were affected by
lightning during rainy weather due to power surge. This system set up was expensive to set
up.
THERM200 for mastering soil temperature and VG400 for measuring soil
moisture. The central unit comprised of a personal computer, USB cable and 19200 baud 2.4
GhzXStream RF modem. The central unit collected data, processed data, controlled greenhouse
climate and displayed information to the user. The coordinator unit comprised of C805F020
microcontroller, Xbee module, 19200 baud 2.4 GhzXStream
RF modem, relay interface point and power supply provided by LM2594M power
regulator. The actuator unit comprised of bulbs, CO2 injector, exhaust fan, sprinkler, heater and
a thermal shade.
Fabricated a greenhouse monitoring system using on the Arduino uno board and
computer. The hardware comprised of data acquisition card, Arduino board, personal computer
and sensors. In the greenhouse multiple sensors were used to measure the parameters. They
used DHT11 sensor, soil hygrometer sensor, CO2 sensor and light sensor. Graphical user
interface (GUI) was used via labVIEW. The sensor measured values were transmitted to the
then the buzzer would be turned on to notify the user. A message sending part was a GSM
module which sent the values of greenhouse parameters to a predefined number. The receiver
was a smart phone with an android application that played a predefined audio sound.
From the research works discussed in this section, it is clear that most existing
greenhouse systems lack mobility during the monitoring process. Our designed GSM and
Bluetooth based remote wireless automatic monitoring system provides mobility during the
monitoring process. The control and monitoring are instant and the system is programmable by
the user.
CHAPTER 3
RESEARCH METHODOLOGY
3.1 INTRODUCTION
Figure 3.2 shows a flow diagram of the designed greenhouse prototype. The
designed prototype has the following units: sensing, processing and storing, displaying and
indicating, wireless communication, power supply, and actuation. The system comprises of
microcontroller chip, LCD, GSM, Bluetooth, sensors, relays and actuators. The microcontroller
was interfaced with two sensors to measure different greenhouse parameters such as heat levels,
light luminance, and relative humidity. The analog data obtained from the light sensor was
digitized via onboard ADC. The digital data was fed to the microcontroller which made
decisions and activated the relevant actuators according to the installed program. The LCD
displayed sensor readings and the status of the actuators. The data provided by the sensors was
recorded in EEPROM which sent it to the microcontroller for analysis on request. The
microcontroller communicated with the GSM module by AT Commands, which were used to
send and receive short messages.
Explanation of Blocks:
1.Environmental Sensors:
2.Microcontroller or PLC:
• The microcontroller or Programmable Logic Controller (PLC) processes the data from
environmental sensors and makes decisions based on predefined setpoints and control
algorithms.
3.Actuators:
• Actuators receive control signals from the microcontroller or PLC and perform actions
to regulate the greenhouse environment. Examples include controlling ventilation
systems, adjusting heating or cooling systems, managing irrigation, and controlling
lighting.
• This component records and stores historical data for analysis and trend identification.
It is optional but can be valuable for optimizing the system and identifying patterns
over time.
5.User Interface:
• The user interface can be a web or mobile application that allows users (farmers or
operators) to monitor real-time data, receive alerts, and manually adjust control
parameters if needed.
Sensors are of two categories; analogue sensors and digital sensors. Digital sensors
generate output in steps of 0 and 1, which translates to voltage range of the sensor. Analogue
sensors give continuous values in the range of it voltages. Its output voltage varies depending
on the sensor reading. Digital sensors give output in terms of ‘ON’ corresponding to 5 V or
‘OFF’ corresponding to 0 V. An analogue sensor is used to make measurement of analogue
numerical values where precision is needed, for example speed or temperature. An analogue
sensor is able to produce an infinite number of values. The output of a sensor is interfaced to
the input pin of a microcontroller and data is changed to digital signal.
Some sensors such as digital humidity and temperature sensor (DHT11 sensor)
have onboard ADC so that their output is digital. Those sensors, for example LDR sensor, do
not have an onboard ADC, the analogue data is converted to digital form by the microcontroller
onboard ADC. After the data is digitised, it can be processed by the microcontroller. In this
project, the sensors used to measure greenhouse parameters are the DHT11 sensor and the
LDR sensor.
To measure temperature and humidity in the prototype, this research utilized the
DHT11 sensor. Figure 3.2 shows the diagram of the DHT11 sensor module. The key
specifications the sensor has that attracted its choice for this project include: low operating
voltage of 3 to 5 V at 2.5 mA and 150 µA in standby mode, wide humidity measurement range
of 20% to 90% with an error of ±5% and temperature range of 0 to 50 οC with an error of ±2
οC. It weighs 2.7 g and has dimensions of 15.5 mm × 12 mm × 5.5 mm hence suitable for
embedded systems.
signal acquiring and humidity versus temperature measuring technologies, hence it is highly
reliable and very stable. The sensor has a component for measuring humidity which is basically
resistive material and a component for measuring temperature which is a resistor with negative
temperature coefficient (NTC). These two components are connected to a high-speed
microcontroller, thus giving high standards, cheap and quick response.
The DHT11 sensing components are calibrated in laboratories that are very
accurate in calibration of humidity (Tianlong, 2010). The calibration coefficients are kept as a
software in the memory (one time memory-OTP), which is utilized by the internal detecting
protocols of the sensor. The use of single wire interfacing makes integration easy (Han and
Zhao, 2011). In addition, the power consumption is low and signals can be transmitted for a
long distance up to a maximum length of 20 m. The DHT11 contains 4 pins in one row.
In this study, the sensor was placed inside the greenhouse then connected to the
microcontroller. Any variation in temperature or humidity in the greenhouse made the sensor
to produce a digital signal that is proportional to the temperature or humidity upon it. The
output signal was fed to the microcontroller and this was used to trigger the fans or heater in
case the temperature was above or below the pre-set values and sprinkler or fans in case
humidity was above or below the pre-set value. Figure 3.3.1.1 shows the components of the
DHT11 sensor. They include, a component to detect humidity, a thermistor and a
microcontroller to calibrate the digitized signal coming out the sensor.
The DHT11 sensor is a commonly used sensor for measuring temperature and
humidity in various electronic projects. It is a low-cost digital sensor that provides reliable and
accurate readings. Here's a brief overview of the functioning of the DHT11 sensor:
1.Sensor Construction:
• The DHT11 sensor typically consists of a resistive humidity sensing component and a
negative temperature coefficient (NTC) thermistor for temperature measurement. These
components are encapsulated in a plastic housing along with the necessary electronics.
• The DHT11 sensor produces a digital signal that can be easily read by a microcontroller
or other digital devices. It communicates using a single-wire digital protocol.
3.Signal Timing:
• Communication with the DHT11 sensor involves a specific timing protocol. To request
data from the sensor, the microcontroller sends a start signal, followed by a signal to
initiate data transmission. The DHT11 then responds by sending a sequence of bits
containing temperature and humidity information.
4.Temperature Measurement:
• The NTC thermistor in the sensor measures the ambient temperature. The resistance of
the NTC thermistor changes with temperature, and the sensor converts this resistance
into a digital temperature value.
5.Humidity Measurement:
• The humidity sensing component in the DHT11 measures the moisture in the air.
Changes in humidity cause the resistance of this component to vary, and the sensor
converts this resistance into a digital humidity value.
6.Checksum Verification:
• The DHT11 sensor includes a checksum in its data transmission to ensure the integrity
of the received data. The microcontroller performs a checksum calculation to verify the
accuracy of the received temperature and humidity values.
7.Data Transmission:
• The DHT11 sends the temperature and humidity data as a 40-bit data stream. The
microcontroller reads and decodes this data stream to obtain the actual temperature and
humidity values.
8.Calibration:
• The DHT11 sensor is calibrated during the manufacturing process, and the calibration
parameters are stored in the sensor's memory. This calibration ensures accurate readings
under normal operating conditions.
9.Limitations:
• While the DHT11 is a cost-effective sensor, it has some limitations. It may have a
relatively slow response time, and its accuracy may not be as high as more expensive
sensors. Additionally, it may not be suitable for extreme temperature or humidity
conditions.
1.Accuracy:
2.Response Time:
• The speed at which a humidity sensor can detect changes in humidity is important in
applications where rapid adjustments are necessary.
3.Calibration:
• Regular calibration may be required to maintain accuracy, and some sensors may come
pre-calibrated.
4.Operating Range:
• Different sensors may have specific operating ranges, and users should choose sensors
suitable for their intended environments.
5.Maintenance:
• Some humidity sensors may require minimal maintenance, while others may need more
attention to ensure accurate readings over time.
6.Environmental Considerations:
• Some sensors may be more suitable for harsh environments, while others are designed
for specific temperature and humidity conditions.
7.Output Signal:
• Humidity sensors can provide analog or digital output signals, depending on the type
and model. Digital sensors often interface well with microcontrollers.
8.Cost:
• The cost of humidity sensors can vary based on the technology used, accuracy, and
additional features.
Applications:
• Weather Monitoring: Humidity sensors are used in weather stations to measure and
report humidity levels, providing valuable data for forecasting.
• HVAC Systems: Humidity control is crucial for maintaining comfort and preventing
issues like mold growth. Humidity sensors are integrated into heating, ventilation, and
air conditioning (HVAC) systems.
• Industrial Processes: Various manufacturing processes may require precise humidity
control for optimal product quality and consistency.
• Agriculture and Greenhouses: Humidity sensors contribute to creating optimal growing
conditions for crops in controlled environments.
• Consumer Electronics: Humidity sensors are found in items like home thermostats,
dehumidifiers, and smart home devices.
• Medical Devices: In some medical applications, humidity sensors are used to monitor
and control conditions in environments like incubators or respiratory devices.
Humidity sensors play a vital role in maintaining the desired environmental conditions in a
wide range of applications, contributing to both comfort and efficiency in various industries.
Higher relative humidity decreases the resistance between the electrodes while
lower relative humidity increases the resistance between the electrodes. Therefore, the sensor
produces a potential difference against the relative humidity (RH) change that is proportional
to the power supply. This implies that, the point at which the power supply changes, the sensor
produces a voltage in the same proportion. This variation is detected, amplified and processed
by the sensor microcontroller, which makes it readable by the system microcontroller. It
operates on the voltage range of 4 to 5 V.
Soil moisture sensors are devices designed to measure the volumetric water content in
the soil. These sensors are valuable tools in agriculture, horticulture, and environmental
monitoring, providing crucial information about the moisture levels in the soil. Here's an
overview of soil moisture sensors:
• Principle: Measure soil moisture by assessing the electrical resistance between two or
more electrodes in contact with the soil.
• Advantages: Simple design, cost-effective.
• Considerations: Calibration may be necessary as soil properties can affect the readings.
• Principle: Measure soil moisture by analyzing the time it takes for an electromagnetic
pulse to travel along a probe inserted into the soil.
• Advantages: Provides accurate readings and is less sensitive to soil salinity.
• Considerations: More expensive than some other sensor types.
• Principle: Measure soil moisture by assessing the dielectric permittivity of the soil.
• Advantages: High accuracy and less affected by soil salinity.
• Considerations: Generally more expensive than resistance-based sensors.
1.Depth of Measurement:
• Some sensors measure soil moisture at specific depths, providing insights into the
moisture profile of the soil.
2.Accuracy:
• Consider the ease of installation and whether the sensor is suitable for the intended
soil type.
4.Calibration:
• Some sensors may require calibration to account for variations in soil type and other
factors.
5.Power Consumption:
• Power consumption is a consideration, especially for sensors that are part of wireless
sensor networks or remote monitoring systems.
6.Data Output:
• Soil moisture sensors can provide analog or digital output signals. Digital sensors are
often preferred for integration with microcontrollers and data logging systems.
• Some sensors can be integrated with irrigation systems to enable automatic and
optimized watering based on real-time soil moisture data.
Applications:
Soil moisture sensors play a crucial role in optimizing water management practices,
improving agricultural productivity, and supporting sustainable land use. Their application
is diverse, ranging from large-scale farming operations to environmental research and
ecosystem monitoring.
The functioning of soil moisture sensors varies depending on the type of sensor
technology used. Here, I'll provide a general overview of the principles commonly employed
by soil moisture sensors:
➢ Principle:
• These sensors typically consist of two or more electrodes embedded in the soil. The
electrical resistance between these electrodes changes with variations in soil moisture.
• As soil moisture increases, the conductivity of the soil improves, leading to a decrease
in resistance. Conversely, dry soil results in higher resistance.
Functioning:
Principle:
• Capacitance sensors use the principle that the dielectric constant of soil changes with
moisture content.
• The sensor has two plates (electrodes), and the soil acts as a dielectric material between
them.
Functioning:
Principle:
• TDR sensors operate on the principle that the dielectric constant of the soil affects the
propagation speed of electromagnetic pulses.
Functioning:
• The sensor sends a short electromagnetic pulse down a probe inserted into the soil.
• The time taken for the pulse to return is measured.
• The time delay is related to the soil moisture content, and this information is used to
determine volumetric water content.
Principle:
• Similar to TDR sensors, FDR sensors measure the dielectric constant of the soil to
determine soil moisture.
Functioning:
• The sensor sends an electromagnetic wave at a specific frequency into the soil.
• The reflected signal is analysed, and changes in frequency are correlated to changes in
soil moisture.
Important Considerations:
1.Calibration:
• Many soil moisture sensors require calibration to account for variations in soil type,
temperature, and sensor aging.
2.Installation Depth:
• The depth at which the sensor is installed affects the readings. Different sensors may
be suitable for different soil depths.
3.Soil Type:
• Soil composition can impact sensor accuracy. Calibration may be needed for different
soil types.
4.Temperature Compensation:
5.Power Supply:
6.Data Output:
• Sensors can provide analog or digital output. Digital sensors are often preferred for
integration with microcontrollers or data loggers.
Applications:
Understanding the functioning and considerations of soil moisture sensors is crucial for
accurate and effective use in various applications, particularly in optimizing water management
in agriculture and environmental monitoring.
Fans in a greenhouse control monitoring system play a crucial role in managing the
environmental conditions within the greenhouse. The use of fans is especially important for
controlling temperature, humidity, and air circulation. Here are key aspects of fans in a
greenhouse control system:
1. Temperature Control:
Function: Fans help regulate the temperature inside the greenhouse by facilitating air
movement. This is essential for preventing temperature extremes, especially during periods of
high heat.
Operation: During hot periods, fans can be used to exhaust hot air, allowing cooler air to replace
it. This process is known as ventilation and helps maintain an optimal temperature for plant
growth.
2. Humidity Control:
Function: Fans contribute to humidity control by promoting air circulation. Improved airflow
helps prevent the buildup of stagnant air, which can lead to high humidity and conditions
conducive to disease.
Operation: Proper ventilation through fans aids in moisture evaporation and prevents the
formation of localized high-humidity zones.
3. Air Circulation:
Function: Fans are critical for ensuring uniform air circulation throughout the greenhouse. This
helps distribute heat, humidity, and CO2 evenly, creating a more consistent growing
environment for plants.
Operation: Fans can be strategically placed to create a continuous flow of air, preventing the
formation of microclimates within the greenhouse.
4. Condensation Prevention:
Function: Fans assist in preventing condensation on plants and greenhouse surfaces. Adequate
air circulation helps maintain surface temperatures, reducing the likelihood of water vapor
condensing into droplets.
Function: Fans can be integrated into the overall greenhouse control monitoring system,
allowing them to be controlled automatically based on real-time environmental data.
Operation: Temperature and humidity sensors, along with the greenhouse control system, can
trigger the operation of fans as needed to maintain optimal conditions.
Function: Some greenhouse control systems allow for variable speed operation of fans. This
feature enables more precise control over air circulation and temperature.
Operation: By adjusting the speed of the fans, the system can respond to changing
environmental conditions with greater flexibility.
7. Energy Efficiency:
Operation: Some greenhouse control systems may include sensors and algorithms to optimize
fan operation, reducing energy usage while maintaining optimal growing conditions.
8. Backup Systems:
Function: Backup fan systems can be incorporated into greenhouse control systems to ensure
continued ventilation in the event of primary fan failures.
Operation: Redundant fan configurations or automated alerts can be part of the system to
address mechanical issues promptly.
The proper integration and operation of fans within a greenhouse control monitoring system
contribute significantly to creating a controlled environment that promotes healthy plant
growth, maximizes yields, and enhances overall efficiency in greenhouse farming.
The sensing unit, the displaying and indicating unit, the communication unit and the
actuation unit require a central processing unit in order to perform various tasks such as data
acquisition and data processing. Therefore a microcontroller was integrated into the system.
Microcontroller is an integrated chip that consists of all components including programmable
peripherals, input/output ports, central processing unit, timers and program (Augarten, 1983).
This research utilized ATmega328 microcontroller to analyse the input signals from the sensors
and subsequently instructing the actuators, the Bluetooth module and the GSM module
accordingly.
• 28 pins (as illustrated on figure 3.10. The table in Appendix B describes function(s) of
each of the pin) and 23 lines of programmable input/output (I/O).
• Three communication interface; Serial Interface, Programmable Serial USART and
Two-wire Master/Slave SPI.
• Operating temperature range of - 40 to + 105 °C and Operating Voltage range of
+ 1.8 to + 5.5 V.
• Six program based power save modes; Noise Reduction mode, Idle mode, Extended
Standby mode, Power-down mode, Standby mode and Power-save mode.
• Programmable Watchdog Timer with internal separate Oscillator.
• Kbytes EEPROM and 2 Kbytes Internal SRAM with CPU Speed 1 MIPS for 1 MHz.
Program or Flash memory 32 Kbytes (10000 write/erase cycles).
• 4 External Oscillator: 0 - 4 MHz at 1.8 to 5.5 V, 0-10 MHz at 2.7 to 5.5 V and 0
ATmega328 was chosen for this project work because of its cost effectiveness, its
excellent features and the fact that Arduino boards are designed on this controller. ATmega328
has many applications due to it 32 Kbytes program memory and with six program selectable
power save modes it can operates on movable electronic devices. The watchdog timer enables
the resetting of the controller in case of an error thus it can be utilized on devices with minimum
or no human involvement. The execution of the program is quick AVR Harvard architecture.
The chip has a sensor for controlling temperature meaning it can be operated on extreme
temperature levels. The microcontroller is designed to operate on low voltage (Howard, 1991)
and required about 5 V which was provided by voltage regulator discussed in section 3.6.3.
The structure of the internal components of the ATmega328. The data buses,
memories, analogue to digital converter, central processing unit and other key parts are very
well shown. The CPU is the “think tank” of ATmega328 chip that controls the software
implementation.
For data and program are distinct). For this reason the CPU carries
mathematical calculations, deals with interrupts, reaches memories and manages peripherals.
The diagram in figure 3.11 shows the central processing unit. For maximum performance in
accessing data and program, ATmega328 employs Harvard architecture (the bus and memories
In the program memory, instructions are executed in such a way that as one
instruction is being performed, the next instruction is pre-fetched from the memory (Single
level pipelining). This implies that instruction are executed in each and every cycle. The
reprogrammable flash memory is the custodian of the program memory. The access register
has 32 general purpose working registers which have one clock cycle access time, this enables
one arithmetic and logic unit cycle operation.
In one clock cycle the ALU comprises of two operands from the register; the
operation is done and the outcome is left in the register. For effective calculation of addresses,
6 registers in the 32 registers serves as 6-bit indirect register pointer to facilitate spacing of the
data addressing. One out of the 3 address pointers monitors tables in the flash memory hence
it is an address pointer.
The ALU performs the arithmetic and logic exercises between a register and
another or between a register and a constant. Operations of one register can also be performed
in in the ALU. Status register is updated to show information on the result of the operation after
an arithmetic operation. Conditional and unconditional jumps and call for instructions enable
the program to flow smoothly. The ATmega328 has one 16-bit word pattern instructions hence
each memory of program has an instruction bit of 16/32-bit.
Program flash memory is made up of two parts; the boot part and the program
application part, both having write and read or write protection lock bits. Boot program
memory is the custodian of program memory that that writes the applications in the flash
memory.
The stack is the custodian of the return program counter during subroutines and
interrupt calls. Its allocation is the data memory (SRAM) and thus limited to SRAM space and
use of SRAM. The static pointer must be initialized by all programs that are in use at any given
time and can be accessed through input/output space. The data memory can be accessed
through the 5 addressing modes in the architecture of ATmega328. The ATmega328 memory
spaces are all linear with regular memory maps.
Flexible interrupts contains control registers inside input/output space and its
control register contains an extra interrupt bit. In the interrupt vector table all interrupts have a
unique interrupt vector and they are accessed according to their position. The lower the address
of the interrupt vector the higher the chance. The input/output has 64 central processing unit
addresses for peripheral functions such as serial peripheral interface, control registers, and
other input/output roles. The access to the input/output memories can be direct, or as data space
locations followed by register file. In addition ATmega328 contains extended input/output
space in the SRAM for storage of special instructions.
The Arduino board has three sets of pins; 14 digital I/O pins, 16 analog I/O pins and 7
power pins. The 6 out 14 digital pins can generate pulse width modulated signal (PWM). Table
3.8 shows digital pins names and their descriptions.
For serial communication, the D0 and D1 pins were interfaced to RX and TX pins
respectively on the Atmega8U2 USB to serial chip, while for serial peripheral interface
communication, the board used the D10, D11, D12 and D13 pins. The D2 and D3 pins provided
external interrupts when configured to trigger interrupts on value change or low value or
fluctuating edge. The board inbuilt LED was operated by pin 13 hence the LED was on when
the pin value was high and vice versa. A serial library in addition to digital pins D0 and D1
facilitated serial communication on the digital pins. To send a pulse width modulated signal to
the relays the six digital pins were used as output. Signal from light sensor entered the board
through the analogue pins.
Table 3.8 shows the Arduino board analog input pins and their descriptions. A4 and
A5 pins supports TWI data transmission via wire library. The onboard quartz crystal produced
a 16 MHz synchronizing pulse.
Pin
No. Name Second Function Explanation
0 A0
1 A1
2 A2
3 A3
4 A4 SDA I2C Data Out
5 A5 SCL I2C Clock
To power the Arduino board, we used the USB interface or the external power
supply jack. The grounding of all pins was done through the GND pin. The 5 V pin supplied a
voltage of 5 V from the external voltage regulator to the board while the 𝐕𝐢𝐧 pin enabled the
voltage from external source to power the Arduino board. The Arduino uno board regulator
generated 3.3 V at a maximum current of 50 mA. This voltage was accessed through 3V3 pin.
The analog input reference voltage was accessed through 𝐀𝐑𝐄𝐅 pin and to reset the controller
RESET pin line was brought low. The range of operating external power was 6-20 V, when
powered with less than 7 V, the board was not stable and on using power greater than 12 V, the
regulator over heated hence damaging the board. This was in agreement with manufacturers
recommended range of 7 to 12 V. Textual data was sent to and from the board via serial monitor
of the Arduino software (IDE). The D0 and D1 pins LEDs flushed when the data was in
transmission process through USB interface to the laptop the USB to serial chip. Instead of
pressing physically to the reset button prior to uploading the program, the Arduino design
allows resetting by it software via the connected laptop.
Pin
No. Name Second Function Explanation
0 D0 RX UART Receiver
1 D1 TX UART Transmitter
2 D2 INTO Interrupt
3 D3 INT1 Interrupt
4 D4
5 D5
6 D6
7 D7
8 D8
9 D9
10 D10 SS SPI SS
11 D11 MOSI SPI MOSI
12 D12 MISO SPI MISO
13 D13 SCK SPI Clock
This project made use of the 5 volt 1 channel relay module shown in figure which
is an electromechanical relay. As can be seen in the relay schematic diagram in figure the relay
comprises of a coil of copper wire, movable contact and a return spring.
A drive circuit is incorporated between relays and the interface circuit to sense the
levels of the input and command the relays accordingly. For this reason a relay can operate
high power devices like motors and even low power devices like light bulbs.
The output connections of relay module comprise of normally open (NO), common
connection (COM) and normally closed (NC). COM which is used in both NO and NC is the
center terminal of relay. NO normally open behaves like a switch. Before the relay is activated
an open connection, hence no contact between COM and NO. But when the relay is activated,
it gets connected to the COM and supplies voltage to the load. Thus the circuit will initially be
in open state until the state is triggered. NC always remains in contact with COM and when the
relay is triggered it opens the circuit. Relay 1 (K1) connect one end of the load to the COM and
the other end to NO. Connections for K2, K3 AND K4 are the same.
3.10 ACTUATORS
a. Ventilation fans: Two direct current fans determined the rate of air flowing inside and
outside the greenhouse prototype hence providing ventilation.
b. Heat flow: Consisted of a 220 V heater positioned inside the greenhouse prototype to
provide heat when necessary.
c. Water Pump: Pump provided the means for moving water through the system at usable
working pressures for the sprinkler.
d. Lighting system: Bulb provided means of lighting the system when day light is dim or at
night.
In this study, the heater, bulb, fans, and water pump received commands from
the central processing unit via relays to control the greenhouse climatic parameters such as
temperature levels, humidity levels and light illuminance inside the greenhouse prototype.
Relative humidity was controlled by a water sprinkler and a fan, temperature by a fan and
heater and light illuminance by a lighting system (Appendix P). The DHT11 sensor was
positioned at the centre to measure temperature and humidity in the system. Also one light
sensor was placed in the same position for sensing light intensity. A sprinkler was placed inside
the greenhouse and attached to the pump from a water source.
Figure 3.26 and 3.27 shows the DHT11 interface to the ATmega328
microcontroller and pin configuration for the DHT11, respectively. DHT11’s power supply was
provided by 5 V adapter of the system. For power filter one capacitor valued 104 nF was
interfaced at Vcc and grounded. The sensor uses serial interface communication technique. For
data transfer and synchronization process between the sensor and the microcontroller, single
wire data technique is used, this lowers the cost and increases the length. To send data through
a bus, description on the manner in which the data is transferred (protocol) is important, this
enables the transmitters and receivers to be in harmony. The one wire line is connected via a
resistor to the power source. So the line is equal to 5 V if there is no charge. Communication
pattern is in three stage: request, respond, and read. A complete data flow has 40 bit, and higher
data bit is sent first. The format is, 8 bit RH + 8 bit RH + 8 bit T + 8 bit T + 8 bit SUM. If the
data transmission is correct, the sum is equal the last 8 bit of "8 bit RH + 8 bit RH + 8 bit T +
8 bit T ", where RH and T are relative humidity and temperature respectively.
Figure 3.11 shows how the 5 V 1 channel relays board was interface to ATmega328
microcontroller.
The Pin 2, pin 3, pin 4 and pin 5 of the relays interface board were connect to pin 23,
pin 24, pin 25 and pin 26 of the microcontroller respectively while the Pin 1 and pin 6 were
interfaced to power source and ground respectively.
The printed circuit board (PCB) mechanically supported and electrically connected
the electronic components of the project using conductive trucks, pads, and other features
etched from copper sheets laminated onto nonconductive substrate. Figure 3.30 shows a
screenshot of the project PCB design on eagle software PCB view during designing process.
The PCB design was made by converting our schematic design diagram into PCB
layout using eagle PCB software. A laser printer was used to make a printout of the PCB layout.
A copper plate measuring 16 by 22 was cut using a cutter. The copper side was scratched with
steel wool to remove the oxide and photo resist layer, The PCB was transferred to copper plate
and the circuit ironed from the paper onto PCB plate. Then, the PCB was dipped in warm water
for 15 minutes to dissolve and removed gently. Finally the plate was etched and cleaned. Final
touches included: Drilling vias, mounting pads and leads on the board for mounting electronic
devices and soldering the components on the PCB to prevent short circuiting them.
3.13.1 Introduction
The three levels of programming languages are: machine code, assembly language and high
level language.
In machine code instructions are written in binary form (digits 0 and 1), stored as
‘LOW’ and ‘HIGH’ voltages. It is the lowest level of programming language and
microcontrollers understand this language. The assembly language is the English
representation of the machine code – it is based on mnemonics and hexadecimals codes.
Architecture knowledge of the microcontroller is crucial in this language. The high level
language uses words and statements easily understood by human. Examples of high level
languages are BASIC, Pascal, C++ and Java. A program called compiler enables conversion of
the programs in high level language to binary form (digits 0 and 1) which can be uploaded to
computer memory for execution. High level languages are easy to work with, however,
assembly languages have the following merits;
a. Their programs are faster to execute and require less memory space.
iii. If the temperature is within the optimum range, the software maintains status quo. If the
temperature is greater than the maximum set temperature, the software checks status of the
heater. If the heater is off it turns on the fans. If heater is on it turns off the heater then turn on
the fan.
iv. If the temperature is less than the minimum set temperature, the software checks the status
of the fan. If the fan is off it turns on the heater. If the fan is on it turns off the fan then turn on
the heater.
v. If the humidity is within the optimum range, the software maintains. If the humidity is
greater than the maximum set humidity, the software checks status of the pump. If the pump is
off it turns on the fans. If pump is on it turns off the pump then turn on the fan.
vi. If the humidity is less than the minimum set humidity the software checks status of the fan.
If the fan is off it turns on the pump. If fan is on it turn off the fan then turns on the pump.
vii. If light is minimum it turns on the lamp otherwise it turns off the lamp. ix. If an error occurs
during the execution process go to step ii. Otherwise, it sends a message to the user on the
greenhouse parameters and go to step iii.
x. End.
The program was developed in Arduino IDE, converted to machine code and
uploaded to the ATmega328 microcontroller. Figure 3.31 shows the Arduino IDE during the
program development. This process involved the following procedure:
i. Creating new file. ii. Designing a sketch. iii. Compiling the sketch code. iv. Combining of
the sketch code with the Arduino libraries.
In Arduino programming there are two main functions, these are; the setup() and the loop().
START
SETUP()
YES
NO
LOOP() Powered
YES
Reset
Button
NO
END
The Setup() function is only operated once when device is booted up, it is mostly
used to perform the initiation settings. The Loop() is ran after the setup() function has finished,
the loop() function runs repeatedly until the power is put off or the reset button is pushed
(Figure 3.32). The Arduino programming is supported by a large number of libraries.
Before writing any code it is important to begin with comment section which contain the
general description of what the code does. The second section is the variable section which
declared the variables used in the program and could be called in any of the sections that
followed.
#include "DHT.h"
#include <LiquidCrystal.h>
#include <SoftwareSerial.h>
#include <EEPROM.h>
#include <avr/pgmspace.h>
#include <string.h>
#define DHTPIN 6
SoftwareSerial mySerial(3,4); // RX, TX LiquidCrystal lcd(8, 9, 10, 11, 12, 13); const char
config_delimeter[2] = "#"; char number[15] = "+254724593277";
The third section is the “void setup()” which defined which pins were input or output and any
other parameter in the program.
void setup() {
digitalWrite(sprinkler_pin,HIGH);
Last section is the “Void loop()” The microcontroller functions were written here. Any
action that needed reading or writing values from pins or computation of different variables
was done here.
void loop() {
data_received = true;
process_txt(sms_rx);
sms_rx[j] = '\0';
} index = 0;
The code extract below demonstrates how this function sent a message any time the user
requested the greenhouse parameters.
if (strcasestr_P(txt, PSTR("data")) != 0)
send_data_text();
if (strcasestr_P(txt, PSTR("manual")) != 0)
auto_mode = false;
send_text(number, manual_activated_string);
if (strcasestr_P(txt, PSTR("auto")) != 0)
auto_mode = true;
send_text(number, auto_activated_string);
CHAPTER 4
4.1 INTRODUCTION
This chapter presents the experimental tests and results obtained on each
component in the process of designing the greenhouse prototype. It also gives in details the
experimental results on testing the performance of the designed prototype of greenhouse
system. First the experiments were carried out on the LDR sensor, the DHT11 sensor, the
HD44780U LCD module, the HCO5 Bluetooth module, the GSM SIM800L module, the 5 V 4
channels relay module and the LM2596 power regulator. Then after each of the parts was tested
on breadboard, all the parts were assembled on the PCB to form the desired greenhouse system.
Finally the performance of the designed system was tested and the results obtained.
This research used the PCB mounted DHT11sensor, from Sunrom Company. Figure
4.3 shows how the DHT11 was interfaced to the Arduino during testing process. The DHT11
library files were installed from the arduino libraries and included in the sketch. To output the
humidity and temperature readings, a program to control the DHT11 sensor was uploaded to
the Arduino ATmega328 microcontroller.
Figure 4.2shows the Arduino serial monitor indicating the values of temperature and
humidity as measured by the DHT11 sensor.
To study the performance characteristics of the DHT11 sensor: the DHT11 sensor,
hygrometer and mercury thermometer were simultaneously exposed to three different
conditions. The first test was done inside Kenyatta University Physics research laboratory. The
second test was done inside a wooden box placed in the Kenyatta University Physics research
laboratory. The third test was done outside the Kenyatta University Physics research laboratory.
The data was taken at five minutes intervals for a period of 60 minutes. Table 4.2 shows the
humidity and temperature measurements for the data taken inside the laboratory.
From the table it is evident that the DHT11 sensor compared well with the hygrometer
and the thermometer in measuring the humidity and temperature in an ordinary environment
with average humidity and temperatures. Figure 4.5 shows humidity and temperature graph
plotted against time for the data in table 4.2.
Figure 4.4 shows how the relay module was interfaced with Arduino during testing.
The program to control the relays (Appendix J) was uploaded to the Arduino to test
the module. When the relay module was turned, the four LEDs turned on one by one repeatedly
meaning that the module was working well.
In this research; to test the functioning of the sensors, the GSM module, the Bluetooth
module, the LCD module, and the relay modules, separate programs were designed, developed
and implemented. Several simulations and tests were conducted on the devices and after
confirmation of each program proper working, all these programs were integrated to form one
comprehensive program to operate the whole greenhouse prototype. The comprehensive
program was simulated on the Arduino serial monitor before uploading to the ATmega328
microcontroller to ascertain it workability. The software uploading to the ATmega328
controller, was done by first housing the chip to the Arduino board and then configuring the
board and the ports as shown on figure
4.17. After uploading the program, the microcontroller was dismantled from the
Arduino board and plugged in the designed PCB system to operate the system.
Inputs:
1.Temperature Sensors:
2.Humidity Sensors:
• Humidity levels can impact plant health. Humidity sensors measure the moisture
content in the air, helping to maintain the desired humidity range.
3.Light Sensors:
• To optimize plant growth, light levels need to be monitored. Light sensors measure the
intensity of natural and artificial light in the greenhouse.
• These sensors measure the moisture content of the soil, providing information about
the need for irrigation.
5.CO2 Sensors:
• Carbon dioxide levels are crucial for photosynthesis. CO2 sensors monitor the
concentration of carbon dioxide in the greenhouse air.
• Sensors that monitor the state of ventilation systems, including the position of vents
and fans, ensuring proper air circulation.
• External weather conditions, obtained from a weather station, can influence the control
system. Data such as outside temperature, humidity, and sunlight can be considered in
the control algorithms.
Outputs:
1.Heating System:
• Based on temperature readings, the control system may activate heating systems to
maintain the desired temperature.
• Fans, vents, and other ventilation systems are controlled to regulate temperature and
humidity.
3.Irrigation Systems:
• Controlled watering systems are activated based on soil moisture sensor readings,
ensuring plants receive the appropriate amount of water.
4.Shading Systems:
• Automated shading systems can be adjusted to control the amount of light reaching the
plants.
5.Lighting Systems:
• Artificial lighting, such as grow lights, can be adjusted based on natural light levels and
the needs of the plants.
• If CO2 levels are below optimal, CO2 injection systems can supplement the greenhouse
atmosphere.
7.Alarm Systems:
• Alarms or notifications can be triggered if any of the monitored parameters fall outside
acceptable ranges, alerting greenhouse operators to potential issues.
• The system may log data over time and generate reports for analysis. This historical
data can help optimize greenhouse conditions and identify trends.
The combination of these inputs and outputs creates a closed-loop system where the
greenhouse environment is continuously monitored, and adjustments are made in real-time to
create the ideal conditions for plant growth. Advanced systems may also incorporate remote
monitoring and control capabilities, allowing operators to manage the greenhouse environment
from a distance.
CHAPTER 5
5.1 CONCLUSIONS
(i)The light dependent resistor (LDR) sensor was utilized to measure light intensity and the
DHT11 sensor was utilized to measure humidity and temperature in greenhouse.
(ii) The sensors, the relays, the LCD, the GSM and the Bluetooth were interfaced to the
microcontroller.
(iii) A program in C language was developed and uploaded to the ATmega328 microcontroller
to control the greenhouse prototype.
(iv)The prototype greenhouse system is able to: Measure the temperature levels, the humidity
levels and the light illuminance values in the greenhouse, display the values on the LCD,
transmit it to the owner’s phone via the Bluetooth or the GSM modules and keep these
parameters at optimum levels by use of the fans, the heater, the bulb and the sprinkler.
• Continued integration of Internet of Things (IoT) devices and sensors for real-time
monitoring and control. These sensors can provide data on temperature, humidity, soil
moisture, light intensity, and more, allowing for precise adjustments to create optimal
growing conditions.
• Increased use of automation and robotics for tasks such as planting, harvesting, and
maintenance. Automated systems can be programmed to respond to environmental
changes, ensuring a more efficient and consistent crop production process.
6.Smart Greenhouses:
• Development of smart greenhouses equipped with automated systems that can respond
to environmental changes in real-time. This includes smart ventilation, shading, and
irrigation systems that adapt to the specific needs of the plants.
REFERENCES
Augarten, S. (1983). The Most Widely Used Computer on a Chip: The TMS 1000. State of the
Art: A Photographic History of the Integrated Circuit. New York: Ticknor & Fields.
Dabadi, H. (2003). Techonology Transfer:Capacity building and the Private Sector of Nepal.
New York: United Nations.
Fraden, J. (2010). Handbook of Modern Sensors: Physics, Designs, and Applications. . Pringer
Science & Business Media.
Guraiah, B., and Nagaswetha, G. (2014). GSM Based Greenhouse Monitoring System for
Agriculture Field. International Journal of Professional Engineering Studies, 3(3).
Han, M., and Zhao, P. (2011). Design of temperature humidity wireless sensor network node
based on DHT11. Journal of Jinggangshan University (Natural Science), 32: 6770.
Howard, A. (1991). Data Acquisition Techniques Using Personal Computers. San Diego:
Academic Press.
Huho, J., and Kosonei, R. (2010). Understanding Extreme Climatic Events for Economic
Development in Kenya. International Organization of Scientific Research Journal of
Environmental Science, Toxicology and Food Technology, 8: 14-25.
Karvinen, T., and Karvinen, K. (2014). Getting Started with Sensors: Measure the World with
Electronics, Arduino, and Raspberry Pi. Maker Media, Inc.
Mizunuma, S., Katoh, T., and Hata, S. (2003). Applying IT to farm fields—a wireless LAN.
Journal of Nippon Telegraph and Telephone Technical Corporation Review, 2: 56–60.
Morais, R., Cunha, J., Cordeiro, M., Serodio, C., Salgado, P., and Couto, C. (1996). Solar data
acquisition wireless network for agricultural applications. Proceedings of the 19th IEEE
Convention of Electrical and Electronics Engineers in Israel, (pp. 527–530). Jerusalem, Israeli.
Obanda, W. (2010). Design and fabrication of an electronic system for monitoring and
controlling temperature, light illuminance and humidity in a greenhouse. Master's
thesis,Kenyatta University,Kenya.
Plaksina, O., & Raush, T. (2005). Development of a KNX Based Greenhouse Climate Control.
Journal of Vienna University of Technology, Institute of Computer Technologies, 27-29.
Pushkar, M., and Amey, D. (2016). PIC Microcontroller Based Greenhouse Monitoring and
Control System. International Journal of Advanced Research in Electrical, Electronics and
Instrumentation Engineering, 5(9).
Rana, H., Ali, F., and Moofed, T. (2013). Wireless Monitor and Control system for greenhouse.
International Journal of Computer Science and Mobile Computing, 2 (12): 69-87.
Remya, K., Yaseen, M., Nisil, M., and Ajay, M. (2016). Greenhouse Monitoring and Control
Based on IOT Using WSN. ITSI Transactions on Electrical and Electronics Engineering(ITSI-
TEEE), 4 (3): 2320-8945.
APPENDIXES
#include <avr/io.h>
#include <util/delay.h>
#define TEMP_SENSOR_CHANNEL 0
void init_ADC() {
// Set AVCC as reference voltage, enable ADC, and set prescaler to 128 (for example)
uint16_t read_temperature() {
return ADC;
} else {
// Temperature is within the desired range, turn off both heater and fan
int main(void) {
// Initialize ADC
init_ADC();
while (1) {
control_temperature(temperature);
_delay_ms(1000);
return 0;
This is a simple example that reads the temperature from an analog sensor using
an ADC, and based on the temperature readings, it controls a heater and a fan. You may need
to adapt this example to your specific microcontroller and sensor interfaces. Additionally, for
a complete greenhouse control system, you would need to integrate other sensors, actuators,
and control algorithms based on the requirements of your greenhouse environment.
APPENDIX B: FLOWA:
APPENDIX CHART OF THE
Flow Chart ofPROTOTYPE
the PrototypeGREENHOUSE PROGRAM
Greenhouse Progr
22 GND GROUND