ch3 Software New
ch3 Software New
CHAPTER 3
SOFTWARE IMPLEMENTATION OF THE SYSTEM
12 V adapter output
Vcc, Reset, CH-EN and ground pin of these components are connected to the
3.3 V and ground pin of the Arduino Mega. LCD module requires 7data pin. So, LCD
driver is used. LCD driver only needs two pins to work. SCL and SDA of the LCD
driver are connected to A20 and A21 of the Arduino Mega. Supply and ground pins of
these components are connected to 5 V and ground pins of the Arduino Mega.
SCL and SDA of the BMP180 sensor are connected to A20 and A21 of the
Arduino Mega. Supply and ground pins of these components are connected to 3.3 V
and ground pins of the Arduino Mega. LEDs are connected to the Arduino Mega pin
no 3,4,5,6,7. Relay is connected with pin (8) of Arduino mega. Fan supply is
connected relay on and ground pin is connected to ground pin of the Arduino Mega.
Aout of the CO sensor is connected to A2 of the Arduino Mega. Supply and ground of
these components are connected to 5 V and ground pin of the Arduino Mega. Aout of
the UV sensor is connected to A0 of the Arduino Mega. 3.3 V, EN and ground of
these components are connected to 3.3 V and ground pin of the Arduino Mega. 12
VAC adapter is used for power supply. LM2596 DC to DC converter is used for 5V
power supply to operate the whole system.
3.2. Operation of the Environmental Measuring and Monitoring via Web System
The Arduino Mega reads the data from temperature and humidity sensor,
atmospheric pressure sensor, carbon monoxide sensor and ultra violet intensity sensor.
All these sensor data are displayed on LCD display and LEDs are also used to signal
the extreme conditions. And then, Arduino Mega tries to connect with the webserver.
The web page can be accessed by joining ESP8266 and entering http//192.168.4.1 in
browser. If connection is made, it will be sent sensor data to the server. These sensor
data can be viewed from any devices containing browser by connecting the IP address
of the server. If the controller does not get connection with the server, these data can
still be viewed on LCD display. The temperature exceeds the predetermined value the
cooling fan will turn on.
Start
Exceed With
predetermined values
No
Tem > 30 degC, Hum < 65%,
Pre < 1012mb, CO > 100ppm, UV >
1mW/cm^2
?
Yes
Connected No
?
Yes
End
Figure 3.2. Flowchart of Environmental Measuring and Monitoring via Web System
language is studied for programming. And then, Arduino IDE is used to program the
Arduino Uno and all of the hardware components. Details of Arduino IDE, C
programming and circuit design software are mentioned below.
wide variety of computer platforms and operating systems with few changes to its
source code. The main features of C language include low-level access to memory,
a simple set of keywords, and clean style, these features make C language suitable for
system programming like an operating system or compiler development. Many later
languages have borrowed syntax/features directly or indirectly from C language. Like
syntax of Java, PHP, JavaScript, and many other languages are mainly based on C
language. C++ is nearly a superset of C language (There are few programs that may
compile in C, but not in C++).
includes a code editor with features such as syntax highlighting, brace matching, and
automatic indentation, and is also capable of compiling and uploading programs to the
board with a single click. There is typically no need to edit make files or run programs
on a command-line interface. Interface Arduino Uno program is as shown in Figure
3.5.
Arduino programs are written in C or C++. The Arduino IDE comes with a
software library called “Wiring” from the original Writing project, which makes many
common input/output. Operations can be much easier. Users only need define two
functions. To make a runnable cyclic executive program:
1. Setup ( ): a function run once at the start of a program that can initialize
settings.
2. Loop ( ): a function called repeatedly until the board powers off.
The control software program is written in ‘Embedded C’. The program has
the capability of sending and receiving the SMS from and to the user mobile via GSM
modem to tell that unauthorized entry/smoke has detected in case of security system
and to control some devices in case of automation system respectively. The program
also provides the display of current status of the system.
32
Select the serial device of the board from the tools | Serial Port menu. This is
likely to be COM3 or higher (COM1 and COM2 are usually reserved for hardware
serial ports). To find out, disconnect this board and re-open the menu; the entry that
disappears should be the Arduino board. Reconnect the board and select that serial
port.
A web server is server software that can satisfy World Wide Web client
requests. The web server may then be used as a part of a system for monitoring.
Server controls and monitors the various sensors, and can be easily configured to
handle more hardware interface module (sensors).
After IP address and port address are obtained user can login from the mobile
phone or monitor. After the successful connection to the server, the data of sensors are
sent to the web server for monitoring of the system. Figure 3.8 shows the web server
page on the PC which will allow the user to monitor the system. The browser used is
chrome running on Windows 10. By entering the assigned IP address in the web
browser this web server page will appear. The web server gives the information about
the temperature or other conditions in different conditions around the environments. It
also gives the status of the various electrical appliances like light, fan etc. A few
seconds after the upload finishes, the pin 13 (L) LED on the board start to blink in
orange. If it does, Arduino board up and running.
Filter search by typing ‘BMP180’. There should be a couple entries. Look for
Adafruit BMP085 Library by Adafruit. Click on that entry, and then select install as
shown in figure 3.12.
The following sketch will give that complete understanding on how to read
barometric pressure from BMP180 module and can serve as the basis for more
practical experiments and projects.
And then, ‘dht’ and ‘adafruit unified sensor’ is searched and looked for the
library by Adafruit. The latest version is selected and then clicked Install as shown in
figure 3.15.
The following figure as shown in figure 3.15 is uploaded code to the Arduino
using the Arduino IDE.
The following figure as shown in figure 3.18 is uploaded code to the Arduino
using the Arduino IDE.
3.13 Summary
This chapter explains the overall software implementation of the system. The
program flowchart, Arduino IDE and C programming language are expressed this
chapter. Test and results are described in the next chapter.