Professional Documents
Culture Documents
Chapter 2 Personal Weather Station
Chapter 2 Personal Weather Station
Chapter 2 Personal Weather Station
CHAPTER 2
BACKGROUND THEORY OF PERSONAL WEATHER STATION
2.1.1. Microcomputer
A microcomputer is a small, relatively inexpensive computer. In some cases, it
includes only a single printed circuit board containing a microprocessor, memory, and
input/output(I/O) circuitry. They may be called single board computers (SBCs).
Microcomputer are very useful for running multiple tasks simultaneously. And
moreover, general tasks can be performed similar to running programs in computers
and PCs. Their processing speed is very high [3].
2.1.2. Microcontrollers
A Microcontroller is a small and low-cost device, which is designed to perform
the specific tasks as in embedded systems. Examples of applications is the controller
for washing machines, microwave ovens, and air conditioners. They can be
programmed to perform these specific tasks, but once programmed, they will perform
the functions as in the program.
When compared based on the price, the Arduino family are relatively cheaper
than the Raspberry Pi. As the proposed system consists of measuring the environmental
parameters, the choice of the processor may have an impact to interface with sensors.
Upon this issue, the Raspberry Pi have only GPIO pins which are digital only [4].
Arduino and NodeMCU, however, have both analog input pins and digital pins.
There may be doubt whether the microcontrollers can be used for building the desired
applications since the Arduino is relatively low in speed to Raspberry Pi. For running
specific tasks, the speed of NodeMCU is enough. Although the processing speed of the
Raspberry Pi is high, this high speed is shared by running multiple programs. Therefore,
the Raspberry Pi is not suitable for running specific tasks like microcomputers although
it can be programmed to perform such kinds of tasks. Based on these facts, the
NodeMCU will be used as the processor for the system. Therefore, what type of
NodeMCU should be used has to considered. Before this, it is very useful to study about
NodeMCU.
The NodeMCU ESP8266 development board comes with the ESP-12E module
containing ESP8266 chip having Tensilica Xtensa 32-bit LX106 RISC microprocessor.
This microprocessor supports RTOS and operates at 80MHz to 160 MHz adjustable
clock frequency. NodeMCU has 128 KB RAM and 4MB of Flash memory to store data
and programs. Its high processing power with in-built Wi-Fi / Bluetooth and Deep Sleep
Operating features make it ideal for IoT projects. NodeMCU can be powered using
Micro USB jack and VIN pin (External Supply Pin). It supports UART, SPI, and I2C
interface. NodeMCU has 128 KB RAM and 4MB of Flash memory to store data and
programs. Its high processing power with in-built Wi-Fi / Bluetooth and Deep Sleep
9
Operating features make it ideal for IoT projects. NodeMCU can be powered using
Micro USB jack and VIN pin (External Supply Pin). It supports UART, SPI, and I2C
interface. Table 3.1 shows the pin description of ESP8266 NodeMCU [5].
Control Pins EN, RST The pin and the button resets the microcontroller
2.3. Webserver
A web server, according to wikipedia, is server software, or hardware dedicated
to running this software, which can satisfy client requests on the World Wide Web. A
10
web server can, in general, contain one or more websites, which are made up of
webpages [6]. The primary function of a web server is to store the webpage, process
and deliver web pages upon requests. Pages are written in HTML (Hypertext Markup
Language) which is used to create the content of the page, such as written text, while
CSS (Cascade Styling Sheets) is used for the design or style of the website such as the
layout, visual effects and background color. Javascripts is also used to deliever the
dynamic behavior of the contents.
The communication between client and server takes place using the Hypertext
Transfer Protocol (HTTP). A user agent, commonly a web browser, initiates
communication by making a request for a specific resource using HTTP, and the server
responds the request with the content of that resource or an error message if unable to
do so.
“Many generic web servers also support server-side scripting using Active
Server Pages (ASP), PHP (Hypertext Preprocessor), or other scripting languages. This
means that the behaviour of the web server can be scripted in separate files, while the
actual server software remains unchanged. Usually, this function is used to generate
HTML documents dynamically ("on-the-fly") as opposed to returning static documents.
The former is primarily used for retrieving or modifying information from databases.
The latter is typically much faster and more easily cached but cannot deliver dynamic
content.”
Web servers can also be integrated in devices such as printers, routers, webcams
and serving only a local network. For routers, user can configure the device via the
webpage provided by the embedded server which can be reached by entering the IP
address of it. No additional software has to be installed on the client computer since
only a web browser is required. This eliminates the cross platform problems. That is
the reason why web applications is more popular than platform specific applications.
Since the purpose of the thesis to provide the data so that people on the local
area network can monitor, a small webserver is to be built to deliver the webpage
containing environmental data. Among different hardware options to serve as the web
server, ESP8266 WiFi Module is applicable. There is also community support on using
this device, including tutorials, examples, and libraries. Therefore, the features and
specifications of this module should be studied.
2.4. Sensors
Since the proposed system intends to measure some environmental parameters,
11
such as temperature, humidity and pressure sensors have to selected to get the desired
range and accuracy of environmental conditions.
Temperature should be known to avoid extreme heat problems. Humidity is
directly connected with how much the air is moist. Moist air mostly contains negative
ions. Research says a higher level of negative ions does good to well-being of humans.
Therefore, beside temperature, humidity is also to be measured. Atmospheric pressure
should be known to avoid noise bleeding problems.
Power
3.3-6V 3.5V to 5.5V
Supply
Output
Digital signal via single-bus Digital signal via single-bus
Signal
Sensing
Polymer capacity Polymer capacity
element
Humidity±2%RH(Max±5%R Humidity±1%RH(Max±5%RH);
Accuracy
H); temperature < ±0.5°C temperature < ±1°C
From the table, it is found that DHT22 offers better performance than DHT11.
However, its price is two times more than DHT11. Since the desired application is not
mission-critical application, the lower option, DHT11 is enough. The DHT11 is given
as shown in the Figure 2.2.
From upper to lower, the first pin is VCC pin to which 5V supply must be given,
the second is data pin, the third pin has no connection, and the lowest being ground pin.
13
Specifications of BMP 180 pressure sensor are that supply voltage is 1.8V to
3.6V, it has low power consumption with 0.5uA at 1Hz, it has I2C interface, max I2C
Speed is 3.5Mhz, it has very low noise with up to 0.02hPa (17cm), it is full calibrated,
its pressure range is 300hPa to 1100hPa (+9000m to -500m). The theoretical noise level
at the BMP180s highest resolution is 0.25m (about 10 inches). The accuracy can be
improved by taking a large number of readings and averaging them, although this will
slow down the sample rate and response time.
There is an interface IC, HD44780 whose function is to get the commands and
data from the MCU and process them to display information onto the LCD Screen. The
operating voltage of the module is 4.7V to 5.3V. Hence, the data pins can be connected
directly to Arduino. Current consumption without blacklight is 1mA [10].
Since it is an alphanumeric LCD display module, it can display alphabets and
numbers. It can work on both 8-bit and 4-bit mode. It can also display any custom
generated characters by writing own libraries. These modules are available in green and
blue backlight. The pinout of the module is shown in Figure 2.5.
The collected and processed data may need to be displayed. A LCD is a thin,
flat display device made up of any number of color or monochrome pixels arrayed in
front of a light source or reflector. It is often utilized in battery-powered electronic
devices because it uses very small amounts of electric power. The pin description of the
16x2 LCD module is shown in Table 2.3 to serve as the reference when interfacing with
microcontrollers.
15
Table 2.3. The pin description of the 16x2 LCD module [11]
7 to 14 Data Pin 0 Data pins 0 to 7 forms an 8-bit data line. They can be
to 7 connected to Microcontroller to send 8-bit data. When
operating in 4-bit mode, Data pin 4, 5, 6 and 7 will be
left free.
If the driver module is not used, a little circuit has to be added to adjust the light
intensity. The driver module eliminates this requirement, and has a potentiometer for
adjustment of the contrast of the display for best viewing. For easy programming with
Arduino, there is also “LiquidCrystal_I2C.h” library. The I2C address of the module is
either 0x3F (63 decimal) or 0x27 (39 decimal) but can be changed if needed. There are
3 address jumper locations marked A0, A1, A2 for this purpose [11].
The module connection to the display is via a 4-pin header. These connections
are listed as below.
▪ GND – Connect to system ground.
▪ VCC – Connect to 5V.
▪ SDA – Connect to the I2C / SDA pin on the microcontroller.
▪ SCL – Connect to the I2C / SCL pin on the microcontroller.
A red LED on the I2C interface board lights when power is applied.
2.11. Buzzer
A buzzer is a device which makes a buzzing or beeping noise. It is also a small
yet efficient component to add sound features to the system. It is compact two-pin
structure hence can be easily used on breadboard, Perf Board and even on PCBs which
makes this a widely used component in most electronic applications.
There are two types of buzzers that are commonly available. The one is a simple
buzzer which when powered will make a continuous beep sound. The other type is a
18
readymade buzzer which looks bulkier than this and will produce a beep sound due to
the internal oscillating circuit present inside it [14].
The buzzer can be used by simply powering using a DC power supply ranging
4V to 9V. A simple 9V battery can also be used, but it is recommended to use a
regulated 5V or 6V. The sound is created by inducing rapid movements in the
diaphragm of the buzzer. In electronic buzzers these variations are made by an oscillator
circuit which drives a piezo to produce the sound. In electromechanical buzzers these
oscillations are self-made through a rapid switching of an electromagnet.
2.12. Relay
A relay operates as an electromagnetic switch. It can control a high voltage
circuit by using only a low voltage control signal. The building components of an
electromechanical relay are a fixed coil, a movable armature, a spring and contacts. The
coil generates a magnetic field when a low voltage control signal has been sent. The
armature is attracted by the magnetic field so that it pushes the contact pair towards
each other [15].
This completes the high voltage circuit. The spring is attached between the coil
and the armature. When the control signal is no longer sent to the circuit, the spring
pulls the armature back to its original position. The 5V relay shield consists of four
relays, which can be used to switch devices up to 250V AC with up to 10A of current
using 5V input signals from the microcontroller.
2.13. Summary
This chapter describes theoretical background of each one is also described.
Specifications and pinout diagram as well as pin descriptions are also presented to serve
as the reference for interfacing with each other. The next chapter describes the
implementation steps of building the system.