TWS - GreenHouse Monitoring System Chapter 2
TWS - GreenHouse Monitoring System Chapter 2
HARDWARE DESIGN
The objective of this chapter is to define and develop hardware design for Greenhouse
2.1 Background
In the smart system design, 8051 Microcontroller was used as the development platform. An
8051 Microcontroller compatible temperature sensor was used to measure soil temperature. An
8051uc compatible soil moisture sensor module was used to measure soil moisture. An 8051
Microcontroller CO2 sensor, temperature and humidity sensor were used for soil CO2 level, air
temperature and air humidity measurement. The following sections contain information on the
An Intel 8051 microcontroller is used as the main decision making processor in the system. It is a
low cost, Harvard architecture, CISC instruction set single chip Microcontroller [1]. Its
architecture includes CPU, RAM, ROM, I/O, Interrupt logic, timer, etc in a single processor. It
has a 8 bit accumulator and 8 bit ALU thus making it an 8 bit processor. This unit also uses a
crystal to generate clock frequency. This crystal has been specifically chosen to have
11.0593MHz of frequency and the timer and delay programs have been generated taking this into
consideration.
Figure 2.1: Block Diagram 8051 Mircocontroller
Keil software is used in green house monitoring system. This software was introduced in 1992
by two people Gunter and Reinhard Keil [4]. This tool is used to compile and this being helpful
assembler, debuggers, simulators, linkers. ISP- In system programming. Also called as in-circuit
serial programming. It allows to involve both programming and testing in a single phase and
helps reduce the cost. It helps one to change the program as required by the user than getting
already programmed chips that does not have an advantage of editing them.
2.2.1 Registers:
Registers are used to store information temporarily. The vast majority of 8051 registers are 8- bit
registers. With an 8 bit data type, any data larger than 8 bits must be broken into 8-bits chunks
before it is processed. Commonly used registers of the 8051 are A(accumulator), B, R0, R1, R3,
Stack Pointer(SP)
Data Pointer(DPTR)
Accumulator(ACC)
B Register(B)
Timer/Counter control(TCON)
Serial Control(SCON)
Power Control(PCON)
8051 microcontroller has 40 pins which perform functions such as input/output, read/write,
address, data interrupts. Out of the 40 pins, 32 pins are for the four ports namely: P0, P1, P2, P3.
VCC, GND, XTAL1, XTAL2, , , ALE and RST are the other 8 pins available on microcontroller
chip.
VCC (Pin 40) Voltage input is +5V, purpose of VCC is to supply voltage to
microcontroller.
XTAL1 AND XTAL 2 (Pins 18 and 19): An external clock is required to run 8051. Two
capacitors of 33pF are connected in addition to a quartz crystal oscillator to XTAL1 and
XTAL2. The crystal oscillator used in our circuit has been set at 11.0592 MHz.
RST(Pin 9) 4 It is normally low, when a high pulse is applied to this pin, microcontroller
will terminate all activities and reset all register values.
ALE(Pin 30) It is an output pin and stands for Address Latch Enable.
P0(Port 0)(Pins 32 to 39) Port 0 can be used for address as well as data. If ALE=1, P0
has address A0-A7 and if ALE=0, P0 provides data D0-D7. Port 0 needs pull-up resistors
The soil moisture sensor consists of 2 parts: Humidity meter probes and voltage comparison
board. Figure 2.3 shows soil moisture sensor. Moisture measurement is carried out by immersing
the probes in the soil. The resistance between the probes immersed in the soil causes a voltage
difference between the probes [6]. Soil moisture can be measured with this voltage difference.
Adjustable resistance (trim pot) in the voltage comparison board can be used to adjust the
sensitivity. The voltage comparison board has a digital and analog output to which the value of
the humidity can be transferred. 8051 is compatible with Analog output. The value readable from
the analog output is in the range 0-1023 [7]. The properties of the soil moisture sensor are shown
in Table 2.2.
Table 2.2: Soil moisture sensor properties [7]
The DS18B20 humidity sensor is used to measure the soil temperature [8]. Figure 2.4 shows soil
moisture sensor. This sensor is the waterproof version of the DS18B20 sensor. It’s a digital
sensor. Nine or configurable 12-bit reads can be performed via the single-wire interface. The
The DHT11 temperature and humidity sensor includes a resistance-type component for
temperature. Figure 2.3 shows air humidity and temperature sensor. DHT11 can transmit
measured values up to 20 meters, has low energy consumption and is small in size. The
temperature sensivitiy is between 2% and 5% [11]. For use with 8051, the output pin must be
connected to a 10 kΩ resistor. The DHT11 library needs to be added to 8051 such that 8051
acquire measurement results from DHT11.
RS232 to RS485 converter is used for data transmission. RS232 to RS485 is mainly used for
communication between end to end or end to ends of main electronic controllers. The converter
works between the main controller and submachine station to complete System Industrial
automatic control, universal card system, system access control, parking system, banking system
self-served, bus system tickets, restaurant menu system, personal care system, and road toll
system, etc. RS232-485 converter can transfer the TXD and RDX signals of RS-232 serial port
to parallel half-duplex RS-485 signals without external power source because it can collect
electricity supply Pin 3 RS-232 port and also, after the request to send RTS to pin 7, the Ready
DTR pin 4 help supply the converter this process control presented makes the easy application of
[1] M.A Mazidi, J.G mazidi, R.D Mckinlay, “The 8051 Microcontroller and its embedded
systems”, 13th Edition, Pearson Publications, 2008 Dorlings Kindersley (India) Pvt. Ltd.
[2] Predko Myke., “Programming and Customizing the 8051 Microcontroller, TATA McGraw
[3] Mazidi Muhammad Ali, “The 8051 Microcontroller And Embedded Systems Using
14- 04-2021].
[7] F. S. Zazueta and J. Xin. Soil moisture sensors. Soil Sci, 73:391–401, 1994.
[11] 8051Türkiye. Dht11 sıcaklık ve nem sensörünün 8051 ile kullanımı. http://8051turkiye.com/