GARBAGE BIN MONITORING FOR SMART RESIDENCE
By
Ng Tian Xun
A REPORT
SUBMITTED TO
Universiti Tunku Abdul Rahman
in partial fulfillment of the requirements
for the degree of
BACHELOR OF INFORMATION TECHNOLOGY (HONS)
COMPUTER ENGINEERING
Faculty of Information and Communication Technology
Department of Computer and Communication Technology
(Perak Campus)
JAN 2018
UNIVERSITI TUNKU ABDUL RAHMAN
REPORT STATUS DECLARATION FORM
Title: __________________________________________________________
__________________________________________________________
__________________________________________________________
Academic Session: _____________
I __________________________________________________________
(CAPITAL LETTER)
declare that I allow this Final Year Project Report to be kept in
Universiti Tunku Abdul Rahman Library subject to the regulations as follows:
1. The dissertation is a property of the Library.
2. The Library is allowed to make copies of this dissertation for academic purposes.
Verified by,
_________________________ _________________________
(Author’s signature) (Supervisor’s signature)
Address:
__________________________
__________________________ _________________________
__________________________ Supervisor’s name
Date: _____________________ Date: ____________________
GARBAGE BIN MONITORING FOR SMART RESIDENCE
By
Ng Tian Xun
A REPORT
SUBMITTED TO
Universiti Tunku Abdul Rahman
in partial fulfillment of the requirements
for the degree of
BACHELOR OF INFORMATION TECHNOLOGY (HONS)
COMPUTER ENGINEERING
Faculty of Information and Communication Technology
Department of Computer and Communication Technology
(Perak Campus)
JAN 2018
ii
DECLARATION OF ORIGINALITY
I declare that this report entitled “GARBAGE BIN MONITORING FOR SMART
RESIDENCE” is my own work except as cited in the references. The report has not been
accepted for any degree and is not being submitted concurrently in candidature for any
degree or other award.
Signature : _________________________
Name : _________________________
Date : _________________________
iii
ACKNOWLEDGEMENTS
First, I would like to thank my supervisor, Mr. Teoh Shen Khang for providing me such a
good chance to develop an IoT system and application. I must thanks him for all the
valuable guidance, advices and suggestions given throughout the development stage of
the system. I appreciate for his patience and continuous support, especially when I am in
doubt when designing the system.
I would like to express my deepest appreciation to my parents as well as my elder
brother. Thanks for their unconditional love and support throughout my studies, which I
will not have it any other way. Thanks for everything.
iv
ABSTRACT
The Internet of Thing (IoT) is a keystone to achieve the Smart Residence vision as a part
of Smart City vision. In today scenario, the effectiveness of the Garbage Managing
System in the cities has become a crucial factor to achieve the Smart Residence Vision.
Oftentimes, the garbage bins in the residential area like parks, gardens are overflowed
with the garbage and they will deteriorate the environment of the city, residential area
and affect the life of the nearby housings. The absence of the proper garbage
management will incur a lot of issues. Namely because the garbage management
companies in most countries and cities nowadays are generally not aware of when and
where the location of the garbage bins when they are becoming full, or collapsed by the
stray animals or even people. This will incur a lot of environmental issues, cost issues,
workforces’ distribution issues as well as health issues to nearby residence. Therefore, in
this report, an Internet of Things (IoT) based Smart Garbage Monitoring System (SGS) is
being developed to solve these kinds of issues. The proposed garbage monitoring system
will help to provide an efficient waste management and cost saving, yet environmental
friendly strategy to the corresponding cities or residential area. The garbage management
companies no longer need to fix their waste collecting schedule. This will aid the
company to become a versatile player in the market, as the garbage collectors of the
management company only need to collect the garbage at indicated time and location
based on the web-based application for monitoring the condition of the garbage bins,
which is to be embedded in the garbage trucks or their phones. This approach will help to
improve the cost efficiency, workforces’ distribution issues, and environmental issues
and even traffic congestion. In today scenario, the proper management of garbage is
underdeveloped in most area in the world. With the proper use of the Smart Garbage
Monitoring System (SGS), the overall waste management efficiency can be improved
almost significantly.
v
TABLE OF CONTENTS
TITLE PAGE i
DECLARATION OF ORIGINALITY ii
ACKNOWLEDGEMENTS iii
ABSTRACT iv
LIST OF FIGURES vii
LIST OF TABLES x
LIST OF ABBREVIATIONS xi
Chapter 1: Introduction 1
1.1 The Problem Statement 1
1.2 Project Background and Motivation 2
1.3 Project Objectives 2
1.4 Highlight of What Have Been Achieved 4
1.5 Report Organization 5
Chapter 2: Literature Review 6
2.1 Review and Comparison of Previous Work 6
2.2 Previous work and proposed studies – The Comparison 12
Chapter 3: System Design 19
3.1 System Flow Diagram: The overview of the system 19
3.2 System Block Diagram 20
3.3 Pseudocode for Modules 25
3.3.1 Pseudocode: Remote Site (Arduino Micro/Nano) 25
3.3.2 Pseudocode: Base Station (Arduino UNO) 26
3.3.3 Pseudocode: Raspberry Pi 27
3.4 System Flowchart for Modules 28
Chapter 4: Methodology and System Requirements 31
4.1 Methodology and tools 31
4.2 System Requirements 32
4.2.1 Hardware Requirements 32
4.2.2 Software Requirements 42
Chapter 5: System Specifications and Implementation 48
5.1 Specification: Analysis and Design 48
vi
5.1.1 Protocols used in the system 48
5.1.2 System hardware connections and setting up 52
5.1.3 System software installation and setting up 60
5.1.3.1 Raspberry Pi 60
5.1.3.2 Python 3.x 62
5.1.3.3 Python IDLE 3.x 63
5.1.3.4 MySQL Database 65
5.1.3.5 Openhab 2 68
5.2 The Implementation and Results 74
5.2.1 Arduino Micro/Nano 74
5.2.2 Arduino UNO 79
5.2.3 Raspberry Pi 3 Model B 85
5.2.4 Openhab2 90
5.2.4.1 Items 92
5.2.4.2 Sitemaps 93
5.2.4.3 Persistence 94
5.2.4.4 HTML 96
5.2.4.5 Javascript 97
5.2.5 The System as Whole 99
5.2.5.1 Remote site 99
5.2.5.2 Base station 100
5.2.5.3 Server Site 101
Chapter 6: Conclusion 109
6.1 Project Review, Discussion and Conclusion 109
6.1.1 Project Achievement 109
6.1.2 Problem Encountered 109
6.1.3 Personal Insight into Research Experience 110
6.2 Novelties and Contributions 111
6.3 Future Improvement 111
References/ Bibliography 113
vii
LIST OF FIGURES
Figure Number Title Page
Figure 2.1 A RFID based selective bin 7
Figure 2.2 Overall implementation of RFID-based SGS 8
Figure 2.3 The system block diagram of the proposed system 9
Figure 2.4 The general concept of the system proposed by the
scholars
10
Figure 2.5 System block diagram of the proposed system 11
Figure 2.6 Principle of Operation of IR Sensor 17
Figure 3.1 The General System Flow Diagram of the Whole
System
19
Figure 3.2 The System Block Diagram of the Whole System 21
Figure 3.3 Array Arrangement for RF Transmission 22
Figure 3.4 Multiple RF transmitters to one RF receiver - The
collision occurred
23
Figure 3.5 Multiple RF transmitters to one RF receiver - The
solution to data collision
24
Figure 3.6 General program flow for remote site 28
Figure 3.7 General program flow for base station 29
Figure 3.8 The general program flow for Raspberry Pi 3 30
Figure 4.1 General idea of “Prototyping Model” 32
Figure 4.2 Ultrasonic Sensor HC-SR04 physical view 33
Figure 4.3 Working principle of Ultrasonic Sensor 34
Figure 4.4 Ultrasonic Sensor HC-015 physical view 34
Figure 4.5 Angle required to ‘switch’ the state from one to
another
35
Figure 4.6 Tilt Switch Sensor 35
Figure 4.7 Tilt Sensor 36
Figure 4.8 Transmitter and Receiver module in physical view 37
Figure 4.9 Arduino Micro pin descriptions and physical
layout
37
Figure 4.10 Arduino Nano pin description and physical layout 38
Figure 4.11 Arduino Uno pin descriptions and physical layout 39
Figure 4.12 Ethernet Shield pinouts 40
Figure 4.13 Raspberry Pi 3 Model B Pinouts Descriptions 41
Figure 4.14 Interface of Arduino.exe 42
Figure 4.15 Interface of Fritzing.exe (Breadboard View) 43
Figure 4.16 Interface of Fritzing.exe (Schematic View) 44
Figure 4.17 Python 3 IDE interfaces - Compiler and Code
Editor
45
Figure 4.18 MySQL CLI interface - show databases 46
Figure 4.19 MySQL CLI interface - show tables 46
Figure 4.20 Openhab2 main menu page 47
Figure 4.21 Openhab2 user interface with basic UI option 47
Figure 5.1 The IPv4 protocol datagram 49
Figure 5.2 Internet Protocol 5-Layer Model 50
Figure 5.3 The relationship between MQTT Client and
MQTT Broker
51
Figure 5.4 The whole system implemented with various
protocols
51
Figure 5.5 Physical connection of RF Transmitter to Arduino
Nano
53
viii
Figure 5.6 Physical connection of Ultrasonic sensor to
Arduino Nano
54
Figure 5.7 Physical connection of Tilt sensor to Arduino
Nano
55
Figure 5.8 The whole setup of the Arduino Micro/Nano is
remote site
56
Figure 5.9 Arduino Ethernet Shield on top of Arduino UNO 57
Figure 5.10 433Mhz RF Receiver on base station (Arduino
UNO)
58
Figure 5.11 RGB Led with Arduino UNO for status
monitoring
59
Figure 5.12 Verify the OS installed on Raspberry Pi 60
Figure 5.13 Internet Configurations on Raspberry Pi 3 Model
B
61
Figure 5.14 Python 3.x version checking 62
Figure 5.15 Update the packages on Raspberry Pi 62
Figure 5.16 Python 3.x installation process 62
Figure 5.17 Check if Python 3.x is working 63
Figure 5.18 IDLE is being opened up from terminal console 64
Figure 5.19 A Python IDLE 3.x console window 64
Figure 5.20 MySQL version checking 65
Figure 5.21 Installing MySQL-server 65
Figure 5.22 Creating password for MySQL account 66
Figure 5.23 Create password for MySQL ‘root’ user 66
Figure 5.24 MySQL console view 67
Figure 5.25 Querying mySQL in console 67
Figure 5.26 Adding the openhab 2 bintray repository key to
package manager
68
Figure 5.27 Installing apt-transport-https 69
Figure 5.28 Choosing the stable version of Openhab 2 to
install
69
Figure 5.29 Installing openhab 2 69
Figure 5.30 Installing the openhab 2 addons 70
Figure 5.31 Showing the status of Openhab 2 70
Figure 5.32 Openhab 2 successfully launched 70
Figure 5.33 The startup page of openhab 2 71
Figure 5.34 Inside sambal configuration file 72
Figure 5.35 Adding lines of configurations inside sambal
configuration file
72
Figure 5.36 Accessing Openhab 2 from remote laptop’s
browser
73
Figure 5.37 Installing python MQTT library 73
Figure 5.38 Connecting Arduino Micro/Nano to PC/Laptop 74
Figure 5.39 Selecting Board Type and Port from Arduino.exe 75
Figure 5.40 Successfully Uploaded the Program 75
Figure 5.41 Displaying Results via Serial Monitor with 9600
baud rate
76
Figure 5.42 Data Received from Remote Site are being
Displayed on Base Station
79
Figure 5.43 Data arrangement for data transmitting 80
Figure 5.44 The averaging technique used by base station to
smoothen the data
82
Figure 5.45 Data without smoothing (left) versus data that is
smoothed (right).
83
Figure 5.46 Python program runs on Python IDE 3.4.2 85
ix
Figure 5.47 Array arrangement of data for RPi on server site 85
Figure 5.48 Data collect from base station 87
Figure 5.49 RPi successfully get the data from the base station 87
Figure 5.50 MQTT Topics and relationship 88
Figure 5.51 Installing MQTT - Clients dependency 91
Figure 5.52 Send data to MQTT subscriber 92
Figure 5.53 Successfully get data from the MQTT broker 92
Figure 5.54 The structure of default.items file 92
Figure 5.55 The structure of the default.sitemap file 93
Figure 5.56 The layout of the software after the
default.sitemap is configured
93
Figure 5.57 Configurations in default.persistence 94
Figure 5.58 The data history for garbage piling status using
MySQL database(1)
95
Figure 5.59 Google Map API configured on html file 96
Figure 5.60 Accessing to the default.items file 97
Figure 5.61 Google Map integrated into the software 98
Figure 5.62 The modules installed on the bin 99
Figure 5.63 Laptop sharing internet to Arduino UNO through
Ethernet Shield via RJ45 cable
100
Figure 5.64 Base station receiving (left) and not receiving
data (right)
101
Figure 5.65 Server site (RPi) is up and running 101
Figure 5.66 RPi python program is getting data continuously 102
Figure 5.67 Openhab received filling level from Bin 1 103
Figure 5.68 Openhab received status from Bin 1 103
Figure 5.69 Openhab received filling level from Bin 2 104
Figure 5.70 Openhab received status from Bin 2 104
Figure 5.71 Openhab received filling level from Bin 3 105
Figure 5.72 Openhab received status from Bin 3 105
Figure 5.73 The bin connectivity demonstration 106
Figure 5.74 Bin 2’s battery level 106
Figure 5.75 The marker colors on map changes accordingly
when the status of bin change (1)
107
Figure 5.76 The marker colors on map changes accordingly
when the status of bin change (2)
108
x
LIST OF TABLES
Table Number Title Page
Table 1.1 Comparison between the ordinary garbage bin
(non-smart) and the proposed Smart Garbage
System (SGS)
3
Table 2.1 Comparison between Wireless Communication
Technologies
14
Table 4.1 Specifications for Ultrasonic Sensor HC-SR04
model
33
Table 4.2 Tilt Sensor specifications 35
Table 4.3 Transmitter operating specification 36
Table 4.4 Receiver operating specification 36
Table 5.1 TCP/IP as compared to UDP/IP 49
Table 5.2 Ultrasonic Sensor actual distance versus collected
distance
76
Table 5.3 The procedure to start the Ultrasonic Sensor 77
Table 5.4 RF module without antenna versus RF module with
antenna
80
Table 5.5 Virtualwire implementation in steps 81
Table 5.6 The UDP transmission setup and procedures on
base station
83
Table 5.7 Socket configurations for RPi in steps 86
Table 5.8 MQTT configurations and setup in python program 89
xi
LIST OF ABBREVIATIONS
IoT Internet of Things
UDP/IP User Datagram Protocol/Internet Protocol
SGS Smart Garbage System
RFID Radio-frequency identification
MQTT Message Queuing Telemetry Transport
RPi Raspberry Pi 3 Model B
TCP/IP Transmission Control Protocol/Internet Protocol
RF Radio Frequency
GUI Graphical User Interface
WMN Wireless Mesh Network
GSM Global System Mobile Communication
SIM Subscriber Identity Module
IR Infrared
WAPU Wireless Access Point Unit
UART Universal Asynchronous Receiver-Transmitter
Chapter 1: Introduction
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 1
Chapter 1: Introduction
1.1 The Problem Statement
Waste management has become a great challenge in urban area for most countries
throughout the world. Very often than not, the garbage bins in the resident park, beside
the city buildings are filled with garbage. The overflowed garbage can incur a lot of
issues to the nearby residences as well as the environment. Generally, the garbage
collectors are not on duty to monitor the garbage bin 24-hour and collect the garbage
immediately once the garbage bins are full. Hence, the garbage overflowing issue of
garbage bin is often occurred and usually unpreventable. The garbage overflowing issues
caused by improper management and collection of the garbage bin can incur a lot of
issues to the society. These issues range from administration and finance issues to
environment and health issues.
From administration and finance point of view, the improper management of the garbage
bins and the overflowing of the garbage bins will not only deteriorate the area’s
environment, but also incur more cost to clean the affected area. On the other hand, it is a
costly investment to distribute the garbage collectors to every garbage bins’ locations in
every resident park in everyday basic; if the garbage bins are empty, the collection
process will accomplish nothing but a ride for nothing in return. (Ambrose, Ford &
Norris). Furthermore, the garbage trucks are usually large in size and they will block the
way of the other vehicles on the busy traffic road. If the garbage trucks need to travel to
the residential every day to every garbage bin on everyday basis, the garbage trucks will
probably become one of the culprits of traffic congestion in the city.
From environmental and health point of view, the improper management of the garbage
bins and the garbage overflowing issues will definitely bring the negative impacts to the
environment and the health of the residences. The overflowed garbage bin will make the
area becomes deteriorated as the smell of the solid waste and the liquid waste are
Chapter 1: Introduction
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 2
spreading throughout the area, affecting the lives of the nearby neighborhoods. The smell
of the overflowed garbage bin will in turn, lure the stray dog, rat, cat, etc. to the garbage
bin. These animals will make the scenario even worse by spreading the diseases,
rubbishes throughout the residential area. Hence, affect the life and health of the nearby
life as well as the environment.
1.2 Project Background and Motivation
“The Internet of Things (IoT) is a concept in which surrounding objects are connected
through wired and wireless networks without user intervention.” (Ashton 2009) The
Internet of Things (IoT) is a blooming technology that incorporates various devices,
vehicles, buildings, gadgets to form an enormous network. These incorporated units are
usually embedded with microcontrollers, sensors, actuators, displays, etc. to perform
specific tasks or data transaction with the other devices. The incorporated units are
enabled to communicate and exchange data with each others and sometime, when
necessary, also provide an interface to communicate with the user via a Graphical User
Interface (GUI). By using the paradigm of Internet of Things (IoT), the network becomes
even more immersive and pervasive (Zanella & Vangelista 2014). Implementing this
paradigm (IoT technologies), Smart Residence vision as a part of Smart City vision can
be achieved. In order to achieve the Smart Residence vision, the hygiene management
system of the residential area is one of the crucial factors. This project, hence, is proposed
to improve the features and functionalities of ordinary (traditional) garbage bins to
achieve a clean and beauty environment.
1.3 Project Objectives
The main objectives of this project is to help the garbage collecting companies to enhance
their garbage collection efficiency using various technologies and platforms, namely
Arduino, Python, TCP/IP protocol, MQTT, SQL database and Openhab2. The most
obvious reason for this project to initial is to help the garbage management company, as
this will allow the company to extend their flexibility in the market, for instance, the
company do not have to distribute their garbage collectors to exactly every garbage bins
Chapter 1: Introduction
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 3
in daily basic. This will not only help to improve the cost efficiency, workforces’
distribution, time efficiency of the management company, also be an infrastructure to
prepare for an era of Smart Residence in the near future.
Based on an experiment, which was conducted by some Korean scholars (Hong, Park,
Lee & Jeong 2014), shows that their proposed IoT ‘pay-to-trash’ Smart Garbage System
(SGS), which had been operated as a pilot project in Gangnam district, Seoul, Republic
of Korea, for 1 year had successfully reduced the average amount of food waste by 33%.
This significant improvement could be achieved by implementing the ‘pay-to-trash’
model of the Smart Garbage System. However, in this project, the basic model (non-pay-
to-trash) model is to be developed.
Table 1.1: Comparison between the ordinary garbage bin (non-smart) and the proposed Smart
Garbage System (SGS)
NO Ordinary Garbage Bin (Non-Smart) SGS
1 Time consuming and less effective:
garbage trucks go and empty the garbage
containers no matter if they are full or
not. Extra cost for fuel and time.
Real-time information on the fill level of the
dustbin. Deployment of dustbin based on the
actual needs.
2 High Cost in long run. Lower cost in long term.
3 Unhygienic environment and outlook of
the residence/city.
Improves environment quality:
-Fewer smells
-Cleaner cities
4 Bad smell spreads and may cause illness
to human beings.
Intelligent management of the services in the
city.
Chapter 1: Introduction
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 4
5 Traffic issues. Less routing of garbage collecting trucks.
Furthermore, according to (Shueh 2016), says that San Francisco-based Compology, co-
founded by entrepreneurs Ben Chehebar and Jason Gates in 2012, claims that by using
the technology of smart garbage monitoring system, the waste collection costs could be
reduced as much as 40 percent.
1.4 Highlight of What Have Been Achieved
The system consists of multiple components that are required for the setting up of the
garbage monitoring system. Each of them needs to be interconnected using various
technologies in order to make them all work as whole.
First, the Arduino Micro/Nano which are on the remote side (garbage bin) need to
communicate with the Arduino Uno, which is a remote data gathering hub. This can be
achieved by using the RF Transmitter/Receiver approach, which is implemented using
the 433Mhz Transmitter and Receiver Module. This approach has been successfully
implemented with more than one transmitters to one receiver, some programming and
optimizations have been done to avoid the transmitter and receiver for being crashed in
the time where multiple transmitters send the data to receiver at the same time.
The Arduino Uno is the central hab for the data gathering from the remote
microcontrollers (Arduino Micro/Nano). The data can be gathered and managed in here
before sending the data to the central server (Raspberry Pi Model B). While the
communication between Arduino Uno and Raspberry Pi can be achieved using the
technology of UDP with the use of Arduino Ethernet Shield. Hence, the Raspberry Pi can
receive the data and finally, post the data to the respective section of the designed
software with the technology of MQTT. Hence, the data can be displayed on the software
in both PC and mobile phone’s (IOS/Android) platform.
Chapter 1: Introduction
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 5
In a nutshell, the communication between each components are successfully
interconnected, and the hardware and software both working seamlessly to support for
the whole system though there are some improvements can be done.
1.5 Report Organization
In this section, the organization of the report will be stated. Chapter 1 covers all the
general information such as the background of this project, the problem statement and the
motivation behind this project, and also the object and achievement of this project.
Chapter 2 will discuss the works/projects that were previously done by other scholars, the
discussion and comparison of the previous proposed works will be mentioned in this
section. Chapter 3 includes the general system design information such as the system
flow diagram, system block diagram, pseudocode for each module, flowchart for each
module and also explanation for each respective topic. In Chapter 4, the methodology and
the system requirements (software & hardware) will be discussed. In Chapter 5, a more
detailed system design will be discussed, namely the protocol used, system setup
(hardware setup & software setup), the implementation and results for each module and
for whole system, and also explained how to operate the whole system. Lastly in Chapter
6, the conclusion for the project will be made.
Chapter 2: Literature Review
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 6
Chapter 2: Literature Review
2.1 Review and Comparison of Previous Work
As review of previous proposed project, which was done by researchers (Glouche &
Couderc), the project use the RFID technology to smartly distinguish the rubbish
automatically. Their project title is self-describing smart garbage bin. This project
focuses on the smart distinguishing of the rubbish automatically. Main goals of their
project are as shown below:
- To reduce the waste generation
- Ensure that the waste is properly handled
- Ease for recycling the garbage
Based on their research, to realize this product some techniques and technologies shall be
used. The technology that is used in their proposed project is based on Radio-Frequency
Identifier (RFID). The proposed system is to implement the technique of auto-sorting.
Their proposed project is to establish a local interaction in order to track the flow of the
waste. (Glouche & Couderc 2013). Every waste is attached with RFID to order to
communicate with the garbage bin. The project proposed is based on a self-classification
of each waste, which means each waste is tagged with specific RFID identifier, for
example, plastic material is marked as a plastic waste, and a newspaper is identified as a
paper waste. By distinguishing all the waste, the garbage bin can then determine whether
it could accept the waste or not. If the waste is of plastic category, the plastic waste bin
will be opened, the other 2 bins (glass and paper bin) will be closed. This is to ensure that
all the wastes are thrown in a correct or appropriate bin. According to the illustration
proposed by (Glouche & Couderc 2013) the generally idea of the system is as shown
below.
Chapter 2: Literature Review
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 7
Figure 2.1: A RFID based selective bin
The general idea of the proposed project which was done by (Glouche & Couderc 2013)
is a great project that can be realized and implemented in the future time. The auto
classification of the waste can greatly reduce the workload of the garbage management
company, as well as the user. The proper disposal of the waste can make sure that the
area is clean and the cost efficient is also increased drastically. These are all the strengths
of the proposed project.
However, to realize this type project, it requires a lot of resources (both people and
monetary object). First, it will need to have each waste identified with specific RFID tag.
This will significantly increase the budget the respectively product. As the RFID tag will
need to be attached to corresponding waste. In addition, not all the waste is appropriate to
tag with RFID tag, for example, the small waste like candle and chewing gum. If theses
‘small’ waste cannot be tagged, then there would be no way to dispose the waste because
the smart garbage system as introduced by (Glouche & Couderc 2013) will not accept the
waste that are not classified.
The second project to be discussed was done by a team of Korean scholars, from Chung-
Ang University, Seoul, Republic of Korea (Hong, Park, Lee & Jeong 2014). The project
title is “IoT-Based Smart Garbage System for Efficient Food Waste Management”.
Although the title project is focused more on food waste management, it is still relevant
to the smart garbage system and the garbage management. The section below discusses
Chapter 2: Literature Review
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 8
about the strength as well as the weakness of the existing system which was proposed by
the team.
The proposed IoT-based Smart Garbage System of the team is based on RFID tag
technology. The smart garbage system is proposed to operate in a ‘pay-to-trash’ manner.
Hence, to reduce the average food wastes in the city. The RFID-based smart garbage bin
is proposed and held as an experimental project in Seoul, Republic of Korea for 1 year
time. The result shows that the food waste has been successfully been reduced by nearly
33% (Hong, Park, Lee & Jeong 2014). The strength of the proposed smart garbage
system (SGS) is that the smart bin has greatly reduced the overall food waste in the city.
The overall cleanliness of the city has been becoming cleaner and the stray animals that
were lured by the smell of the garbage bin have been reduced drastically. Below shows
the general idea of the system.
Figure 2.2: Overall implementation of RFID-based SGS
From the figure above, one can see that the technology that is used is RFID. The next
section will discuss further about its advantages and disadvantages.
Besides of these projects, there is another project which was done by the researchers
(Omar, Termizi, Wahap, Ismail & Ahmad 2016) from Malaysia. The smart garbage
system was proposed and uses the technology of Global System Mobile Communication
(GSM) as part of their product. According to (Omar 2016), “GSM can be used to transmit
data from the sensor to the local server. The sensors need to be equipped with the GSM
module including the Subscriber Identity Module (SIM) card and thus, need to subscribe
mobile packets.” “The coverage depends to the providers like Celcom, Maxis, Digi, Red
Once, U Mobile Altel and Tunetalk.” (Omar 2016) By using GSM, the smart garbage
system can be deployed widely in the SIM covered area. Their product also provides a
Web application for the smart garbage system. This will ease the garbage management
company. This figure below shows the implementation of the system.
Chapter 2: Literature Review
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 9
Figure 2.3: The system block diagram of the proposed system
The forth project that is going to be discussed is proposed by the Indian Scholars
(Ramson, Moni 2016) from Karunya University, Coimbatore 641 114, Tamil Nadu,
India. This project’s title is “Wireless sensor networks based smart bin”. The idea of this
project is to use the sensors that were installed on the garbage bins as the sensor nodes.
And these sensor nodes will send the data to the Wireless Access Point Unit (WAPU) via
the 2.4 GHz wireless communication. Then from the Wireless Access Point Unit, the data
received will be forwarded to the Central Monitoring Station. The communication
method that the system used is wifi connection, in order for the sensors nodes to be
connected to the WAPU. Furthermore, the system’s WAPUs will send the data to the
Central Monitoring Station via the UART interfaces, which is done by connecting the
WAPU and the Central Monitoring Station together. The general concept of the proposed
system is as illustrated below.
Chapter 2: Literature Review
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 10
Figure 2.4: The general concept of the system proposed by the scholars
Another proposed smart garbage system was done by Parkask and Prabu from Calicut,
Kerala, India. The proposed system’s tittle is ‘IoT Based Waste Management for Smart
City’.
The components that were used their smart garbage system (SGS):
- 8051 Microcontroller
- IR Sensor
- RF Module
- Intel Galileo Gen 2
- Power Supply
A brief explanation, 8051 Microcontroller is used to receive, process, and transfer the
data that were gathered from the respectively sensors and modules. IR Sensor is used to
detect the level of the garbage in the garbage bin using the infrared led technology. It will
send the data to the microcontroller for processing. RF modules consist of RF transmitter
and RF receiver, the former is used to send out the data wirelessly and RF receiver is
Chapter 2: Literature Review
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 11
used to receive the data from the microcontroller. Intel Galileo Gen2 is used to receive
the data sent by the multiple transmitters and process the data and the same data
transmitted to the client i.e web-based application. The figure below shows the system
block diagram of the proposed system.
Figure 2.5: System block diagram of the proposed system
Chapter 2: Literature Review
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 12
2.2 Previous work and proposed studies – The Comparison
The previous proposed project which was done by Glouche & Couderc in 2013 has its
own advantages and features, such as the self-describing ability and the smart
management to save the cost. As compared to current proposed project, it lacks of the
ability to track the level of the garbage bin, which is necessary in order to achieve the
effectiveness. Furthermore, the system also lacks of the capability to track whether the
garbage is fallen down by foreign objects. Besides that, the system did not provide a user
interface for the user to track the garbage bins’ condition and location in real time, the
software shall be imposed to achieve the internet of things. If the previous proposed
project are implemented with these elements, the system will be more rounded.
On the other hand, the current proposed system also lack of the elements that the previous
proposed project has, namely the self-describing ability. The self-describing ability is
necessary so that to make sure that the user throw the garbage accordingly to the
respective garbage bin. However, this will also incur a lot of cost such as the
implementation of RFID and various monetary objects. The ideal solution would be to
implement web camera sensor to the respective smart garbage bins. The web camera
sensor will detect and recognize the pattern of each type of waste. The web camera is to
remember the pattern and characteristic of the respective waste. For example, the web
camera will detect the glass when it captures something that is reflective. Each of the
smart bin is embedded with a web camera, the camera will scan the waste and determine
whether to open the cap of the garbage bin before the user throw the waste. If the
technology and maturity of the web camera sensor is strong enough to detect each of
these wastes, it would be a greater alternative as compared to RFID tag which applied to
each of the waste. This approach will helps to save a lot of resources and monetary
object.
The project “IoT-Based Smart Garbage System for Efficient Food Waste Management”,
which was done by a team of Korean scholars, from Chung-Ang University, Seoul,
Republic of Korea (Hong, Park, Lee & Jeong 2014) is doing well in food waste reduction
and also improved the cleanliness of the city as stated in the statically outcomes.
Chapter 2: Literature Review
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 13
However, the proposed smart garbage system which is based on RFID technology needs
resident to have RFID card in order to discard the garbage. The RFID card should be hold
anytime at any moment by the local residences. These will incur a lot of issues, for
instance, forgetting to bring the RFID card, then the resident wouldn’t be able to throw
the garbage immediately when it is in a critical situation. According to figure above, the
payment of each discarding can cause server overload to the central server
(administration server). This is due to the complex discarding process of RFID-based
SGS, user may suffer from the waiting process of the scanning and data processing of the
RFID process. In addition, RFID systems or related item can be disrupted quite easily, as
RFID implement electromagnetic spectrum, for instance WiFi and cellular phones, they
are vulnerable and can be jammed at any time. This will cause inconvenience for the
consumers. Furthermore, RFID tags can be accessed without even the consumer’s
knowledge. “Since the tags can be read without being swiped or obviously scanned (as in
the case of barcode), anyone with an RFID card can accidentally read the tags that are
inside their clothes and other consumer products without consumer’s knowledge.”
(Technovelgy.com).
For the third project, despite the conveniences of using Global System Mobile
Communication (GSM), this will incur a lot of monetary issues and also the issue for the
database and usage. Based on the proposed product, the Subscriber Identity Module
(SIM) card was deployed to solve the connecting issue. However, application of SIM
card to each smart garbage system will incur some issues. First, need to consider all the
garbage bins and apply the SIM card to each of the garbage system, this will in turn
increase the budget of the data subscriptions dramatically. The second issue is the SIM
card generally requires a lot of energy to operate, since the SIM card needs to
communicate with the courier server consistently. This is not ideal because the smart
garbage system is supposed to operate for years and so on.
To solve all these issue, the interrupt services of the platform (Arduino) can help. By
using the interrupt subroutine of the proposed platform, the battery life of the proposed
system will be prolonged. For example, the SIM card sends the data to the courier server
Chapter 2: Literature Review
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 14
only when there is something disposed into the garbage bin. For the rest of time, the
system is in idle mode, hence, to save a lot of energy incurred by the SIM card.
Besides that, several wireless communication technologies have been investigated and
studied. To determine which type of technology will be used throughout the project.
According to (Dar, Bakhouya, Gaber & Wack 2010), the general wireless communication
technologies include Bluetooth, ZigBee, Global System Mobile Communication (GSM),
WiMax, Infrared wireless (IR) and WLANs (a/b/g/n).
Table 2.1: Comparison between Wireless Communication Technologies
N.O Name Data Rate Mobility Range Power
Consumption
Latency
1 WiMax 1 – 32
MBits/s
Yes 15 km High ~110 ms
2 Bluetooth 1 - 3
MBits/s
Limited 10 m Medium ~100 ms
3 Zigbee 20 - 250
KBits/s
Yes 10 – 100
m
Very Low ~16 ms
4 Global System
Mobile
Communication
(GSM)
80 – 384
kb/s
Yes 10 km High 1.5 – 3 s
5 WLANs (a/b/g/n) 54 - 600
MBits/s
Limited 50 – 100
m
High ~46 ms
6 IR ~1 MBits/s No ~10 m Medium Very Low
Chapter 2: Literature Review
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 15
Based on the table, conclude that either GSM or Zigbee is more applicable for this
proposed project. Due to the limitations of other technologies, there are not appropriate
for the application of this project, for instance, WLANS, as shown in the table, its
mobility is limited and the range of coverage is quite small, which is only 50 – 100
meters. Besides that, its power consumption is high despite its latency is fairly low.
The forth project which was proposed by the Indian scholars has its own advantages and
disadvantages by using the technologies mentioned (WiFi and UART) in the previous
section. The main advantages of the system that they proposed is that it provides a
reliable and stable communication route for the data to be sent from WAPU to the
Central Monitoring Station. The cabled communication between WAPU and Central
Monitoring Station will guarantee that the data sent from WAPU will be received from
the Central Monitoring Station, which is insusceptible to the factors like electromagnetic
disruption which is often occurred in the wireless communication.
However, this method of communication also causes some inconveniences while
transmitting the data from WAPUs to the Central Monitoring Station. In real life, it is not
always possible to setup all WAPUs to 1 Central Monitoring Station using the cable
connections, due to the fact that the sensors are usually in the place where that is in far
distance away from the Central Monitoring System. Hence, using the UART
communication between the WAPU and Central Monitoring Station is not very reliable
when the distance is too far away. Furthermore, the system’s sensors are connected to the
WAPU via the WiFi connection. The same issue applies to this case, it is the distance that
is too short. As discussed in the previous section, the maximum range of WiFi cannot
even exceed 1 KM (based on current WiFi technology). However in real life, the distance
between the garbage bins and the WAPU is always far in distance, typically in term of
Kilometers.
Hence, a better options shall be considered, that are RF (radio frequency) communication
for the communication between sensor nodes and WAPU and Internet Communication
via UDP or TCP for the communication between WAPU and the Central Monitoring
Chapter 2: Literature Review
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 16
Station. By using these 2 types of communication, the long range communication
between each component and node can be realized.
In the fifth proposed project which was done by Parkask & Prabu. There exist several
strengths and weaknesses. The strengths of he proposed system is that the smart garbage
system are using the 8051 microcontroller. 8051 microcontroller is famous for its low
power consumption. As the IoT-based garbage system is basically be placed in external
location. External location scenario requires the continuous service, which means the
battery of the system must have higher capacity and fault tolerance, yet small in size.
With the low-power consumption characteristic of the 8051 microcontroller, the proposed
system can continue to service even for a longer period. On the other hand, the proposed
system provides a graphical website for the management company to monitor the
condition of all garbage bins in the respective cities. Hence, improve the garbage
management of the company. This website can be accessed anywhere and anytime
(Parkash & Prabu 2016).
However, there exist some issues in this proposed system. To detect the level of the
garbage, appropriate sensors must be attached to different part of the garbage bin. Type
of sensors will affect the quality of detecting the garbage level in the garbage bin. In this
proposed system, IR Sensor is used.
There exist various types of approaches to detect the level of garbage of the garbage bin
by using different kind of sensors. Each sensor has its own strengths and weaknesses.
Section below shows some sensors that are implemented in the previous research and
proposal that were done by the other researchers and scholars:
Possible sensors that are used to detect the level of garbage in bin:
- IR Sensor
- Ultrasonic Sensor
- Weight Sensor
IR Sensor - For the garbage detection, IR sensor can be used. It gives the level of the
garbage in the dustbin. It provides information about the level of the garbage in the
dustbin. Hence, Infrared (IR) sensor is use for garbage detection. IR sensor radiates light,
Chapter 2: Literature Review
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 17
which is invisible to the human eye because it is at infrared wavelengths, but it can be
detected by electronic devices (Kurre 2016). The IR sensor is act as level detector .The
output of level detector is given to the microcontroller. The output consists of information
of garbage levels of respective dustbins.
Figure 2.6: Principle of Operation of IR Sensor
There are a few strengths of using the IR sensor. These are:
• Less expensive
• Low power consumption
However, there are few weaknesses of using the IR sensor. These are:
• Not accurate ranging
• Narrow beam width
• Cannot be used while exposed in sun
Ultrasonic Sensor – Ultrasonic Sensor use sound instead of light for ranging as compared
to IR Sensor, so Ultrasonic Sensors can be use outside in bright sunlight. These sensors
are amazingly accurate, although their performance maybe weakens by some absorbing
materials, like a sponge (Eric 2015).
Chapter 2: Literature Review
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 18
Figure 2.7: Principle of Operation of Ultrasonic Sensor
Advantages of using Ultrasonic Sensor:
• Accurate ranging measurement
• Works under sun exposure
• Good performance either inside or outside room
Disadvantages of using Ultrasonic Sensor:
• May become inaccurate when encounter adsorbing obstacle
• Generally expensive than other similar sensors
Weight Sensor – Weight sensor is place below the garbage bin to sense the weight of the
garbage bin. The LOAD cell will continuously will continuously give the weight readings
in voltage format (Prajakta , Kalyani & Snehal 2015).
Advantage of using Weight Sensor:
• Well settle below the garbage bin, tightly embedded as compared to attached to
cap.
Disadvantages of using Weight Sensor:
• Inaccurate measurement, cannot detect the level
Based on the discussion above, the proposed system is using IR sensor. Due to the
limitation of using IR sensor (as mentioned above), the performance of smart garbage
system (SGS) can be deteriorate. This will incur many issues, for instance, the garbage
bin is empty but it reports condition as full to the central server (administration server).
The solution to this issue is to implement the system using Ultrasonic Sensor. Ultrasonic
Sensor provides a more reliable detection when it comes to garbage monitoring system.
As it detects the level of the garbage bin by emitting the ultra sound and the reflected
ultrasonic will feedback to the ultrasonic sensor, instead of using infrared led light, which
could be malfunctioned while exposed in sunlight.
Chapter 3: System Design
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 19
Chapter 3: System Design
3.1 System Flow Diagram: The overview of the system
To design this system, the following concept and procedure has been adopt and
implemented. The graph below shows the general idea of the whole system, depicting
how the system will work as whole, showing how the communication between each
components of the system can be done and achieve. Various methodologies had been
utilized, it shall all be covered in the following topics.
Figure 3.1: The General System Flow Diagram of the Whole System
The diagram above shows the general connections and setup of the whole system.
Various technologies had been adopted, namely radio transmission protocol, UDP
protocol, TCP/IP protocol and MQTT protocol. These protocols are necessary, in order to
interconnect all the modules in the system and enable them to communicate with each
Chapter 3: System Design
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 20
other. Let’s start the discussion from bottom level, the connections between modules can
be achieved using the RF protocol which is enabled with 433 MHz radio frequency. The
RF transmitter modules are installed on the respective bins while the RF receiver module
is installed on the processing station (Arduino UNO). The RF transmitter modules will
send the data to the Arduino UNO in a round-robin fashion (each bin send data in
different timestamp), this is to avoid the collision between multiple RF transmitters while
sending multiple signals to one receiver. Hence, this will guarantee that the data from
multiple bins will safety be sent to the Arduino UNO.
On the other hand, when the data are being collected and gathered in Arduino UNO, the
data is then processed and filtered in the module, namely smoothing the data, to make the
data more reliable and accurate before forwarding the data to the RPi. The Arduino UNO
is to be connected to the internet via Ethernet Shield. The Ethernet Shield is used to
enabled the Arduino Uno with internet connection to allow the Arduino UNO to forward
the data to the RPi via internet. Hence, the data transmission between RPi and Arduino
UNO can be achieved. The transmission protocol between Arduino UNO and RPi is UDP
protocol, as the UDP protocol provides a lower overhead in the datagram transfer. Both
ends (RPi and Arduino UNO) need to setup the connection in respective program (C and
Python), before the data can be transferred.
On the RPi, the data received will be sent to web server (Openhab2) for display purpose.
The data will be sent using the MQTT protocol, which consists of MQTT broker and
MQTT client, the details will be discussed in Section 5.1.1 “Protocols used in the
system”. Finally, the web server received the data and post the data to the display, and
lastly, allow the end users to connect to it and view the real-time monitoring updates.
3.2 System Block Diagram
The system block diagram below shows the general connections between each modules
and data flow between each components. The general concept has been depicted in the
figure below to have a better understanding of the system design.
Chapter 3: System Design
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 21
Figure 3.2: The System Block Diagram of the Whole System
Chapter 3: System Design
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 22
From the diagram above, Ultrasonic Sensor is connected to Arduino Micro/Nano. It is
used to detect the level of garbage in the garbage bin and report the data collected back to
Arduino Micro/Nano, this will be the main indicator to show the status of each bin.
On the other hand, tilt sensor is implemented to the system. It is used to detect whether
the garbage bin is collapsed or not. It will send the signal ‘1’ or ‘0’ back to Arduino
Micro/Nano to determine whether the garbage bin is collapsed, where ‘1’ implies fallen,
and ‘0’ implies standing still. Arduino Micro/Nano will store all the collected sensor
value into an temporary array before sending them to Arduino UNO. The arrangement of
the array is as shown.
Figure 3.3: Array Arrangement for RF Transmission
After storing each sensor value inside the array. The whole array is sent to Arduino UNO
(base station) with the help of RF transmitter module. The transmitter module is of 433
Mhz, and the receiver module is of 433 Mhz. Thus, the transmission between the 2
modules should be working as fine.
However, the scenario now is that the system has multiple RF transmitter modules
communicating with one RF receiver module. Hence, program optimization need to be
done first before the data can be sent. Otherwise, the data will collide with each other
very oftenly and caused data unreliability. The approach used, is to set a slightly different
refresh rate for each transmitter to send the data, this will greatly increase the probability
of not being crashed by other RF transmitter. The general idea of this issue is as
illustrated below.
Chapter 3: System Design
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 23
Figure 3.4: Multiple RF transmitters to one RF receiver - The collision occurred
From the figure above, one can observe that 2 RF transmitters are being crashed at the
same time interval - 2000 ms. The reason behind this issue is that the 2 RF transmitters
are transmitting the data at the same time, and arrive at the RF receiver at the same time,
this will cause the receiver to reject the data because of the inability to handle 2 data at
the same time. This issue can be an issue if there are more RF transmitters are to be
added. Hence, a solution is implemented to greatly reduce the probability of the data
collision. The solution is depicted below and will be discussed later.
Chapter 3: System Design
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 24
Figure 3.5: Multiple RF transmitters to one RF receiver - The solution to data collision
The solution proposed is as shown in above, by assigning different refresh rate to each
RF transmitter, which are refresh rate of 2000, 1800 and 1600, the RF receiver will take
turn to handle each transmitter, this will works in a round-robin fashion to avoid the
collision from happening. This approach currently works with 3 remote sensors, however
with even more sensors a better solution would be needed.
In the base station site, the Arduino Uno Microcontroller will act as a base station. It will
receive the data from remote site (Arduino Micro/Nano) and process the sensor values
before sending them to Raspberry Pi 3 (RPi). The data transmission between Arduino
Uno and Raspberry Pi 3 needs to be wireless, as this is how it works if it is in production.
Hence, the Ethernet shield must be placed on Arduino Uno in order for it to access the
internet and send its data the Raspberry Pi 3. Finally, in Raspberry Pi 3, the received data
Chapter 3: System Design
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 25
will be furthered processed and integrated with software/website to display the outcomes
of the statistical results.
3.3 Pseudocode for Modules
3.3.1 Pseudocode: Remote Site (Arduino Micro/Nano)
#Include RF transmission libraries
#Include virtualwire libraries
Void setup () {
Initialize serial monitor with baud rate of 9600.
Initialize sensors input pins
Initialize sensors output pins
Initialize transmitter
Initialize libraries for RF transmission
}
Create an temporary array to store sensor value
Void loop () {
Read sensor value from every sensor
If (error reading sensor value)
Output error message and restart the system
For (ultrasonic sensor)
Store ultrasonic sensor value in array[0-9]
For (tilt sensor)
Store tilt sensor value in array[10-15]
For (bin id)
Store bin id in array[16]
For (battery level)
Store bin id in array[17]
Send array[] to RF receiver on base station repeatedly
Chapter 3: System Design
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 26
if (data sending is not successful)
Skip this step and retry for another round
Delay [refresh rate]
}
3.3.2 Pseudocode: Base Station (Arduino UNO)
#Include RF transmission libraries
#Include Ethernet Libraries
#Include virtualwire libraries
#Include SPI libraries
Void setup () {
Initialize serial monitor with baud rate of 9600
Initialize required libraries (RF libraries)
Initialize receiver input and output pins
Initialize input and outputs pins
Initialize Ethernet interfaces and port for transmitting data to RPi
}
Void loop () {
Create an array to store the received data
If (Send “get” request to remote site) {
If (data received = TRUE)
Store the received array into local array
Else
Output error message
//Process local array:
Filter the received data
Smoothen the sensor value
If (Received request from RPi)
Send the processed data to another RPi.
}
Chapter 3: System Design
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 27
}
3.3.3 Pseudocode: Raspberry Pi
Import socket libraries
Import time libraries
Import MQTT libraries
Import math libraries
Defining server’s IP and port
Try:
Create MQTT Object
Connect to local IP address and MQTT port for data transmitting
While(1):
try:
Send request to base station
Transform the data received to utf-8 format
Split the received data and store them in array dat[0] - id, dat[1] -
ultraSensor, dat[2] - fillingLevel, dat[3] – tiltSensor, dat[4] – batteryLevel
If (dat[0] is ‘1’)
Send data to ‘1’ MQTT’s topic
Else If (dat[0] is ‘2’)
Send data to ‘2’ MQTT’s topic
If (dat[0] is ‘3’)
Send data to ‘3’ MQTT’s topic
Else
Display error message “ID not registered”
Except:
Display error message
Except:
Exits if keyboard interruption occurred.
Time.sleep(1 second)
Chapter 3: System Design
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 28
3.4 System Flowchart for Modules
1.) Arduino Micro/Nano
Figure 3.6: General program flow for remote site
Chapter 3: System Design
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 29
2.) Arduino UNO
Figure 3.7: General program flow for base station
Chapter 3: System Design
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 30
3.) Raspberry Pi 3 Model B
Figure 3.8: The general program flow for Raspberry Pi 3
Chapter 4: Methodology and System Requirements
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 31
Chapter 4: Methodology and System
Requirements
4.1 Methodology and tools
To design a system that works according to the expected functionalities. Various kinds of
design methodologies can be referred to and used. The list below shows the commonly
used design models in Embedded System Design:
- Big-bang model
- Spiral model
- Waterfall model
- Prototyping model
The Prototyping model is most suitable will be adopted to this project.
Prototyping model – This design model work best when the requirements for future
design is unknown or partially known. For example, currently there are requirements that
are not deployed and will be implemented in the future, that means there is an uncertainty
about the requirements of the current system. This design method promotes test-and-trial
process, which means that when certain designs do not meet the requirements, one can
always do it again until the specification or requirements of the system is worked as
specified, designing time is not sensitive in this design method. During the final stage of
design, refine the product (prototype) to check if the specifications of the system work as
final product. The maintenances need to be carried out to the final product to ensure that
the system is working as desired as always. This design is most suitable for the Smart
Garbage Monitoring System (SGS), as this design method can be done in a test-and-trail
manner until all the requirements meet the client’s expectation or any newly added
requirements. As illustrated below, the general idea of prototyping model. This model
will help to realize the product in a more effective way.
Chapter 4: Methodology and System Requirements
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 32
Figure 4.1: General idea of “Prototyping Model”
4.2 System Requirements
During the implementation of the proposed project, certain software and hardware shall
be used. Design a Smart Garbage System (SGS) requires certain type of sensors, software
platforms, clouds, etc. in order to work accordingly. The components and modules to
design the SGS will be discussed in this section.
4.2.1 Hardware Requirements
Ultrasonic Sensor - Ultrasonic Sensor HC-SR04 is used to detect the level of the garbage
in the container. According to (Alexnieva 2016), “Ultrasonic sensor has 2 operation
modes, which are Reflection Mode and Direct Measurement Mode.” In this proposed
project, the Reflection Mode will be used to get the distance between the sensor and the
object.
These are the specifications for Ultrasonic HC-SR04 Sensor:
Chapter 4: Methodology and System Requirements
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 33
Table 4.1: Specifications for Ultrasonic Sensor HC-SR04 model
Figure 4.2: Ultrasonic Sensor HC-SR04 physical view
Trig pin is connected to output pin of Arduino Micro, trig is used to burst the microwave
from the sensor to the target. Echo is connected to the input pin the microcontroller, it is
used to receive the data that reflect from the other side. Vcc is connected to 5v power
source and Gnd connected to ground respectively. Below shows the how the Ultrasonic
sensor work in general.
Chapter 4: Methodology and System Requirements
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 34
Figure 4.3: Working principle of Ultrasonic Sensor
Another model of Ultrasonic Sensor has also been adopted, which is US-015 model. The
US-015 model Ultrasonic Sensor is very similar to HC-SR04, in term of the
functionalities and functions. The physical view of US-015 model is as shown below.
Figure 4.4: Ultrasonic Sensor HC-015 physical view
Tilt Sensor – Tilt Sensor is attached to the bottom of the garbage bin. It is used to detect
whether the garbage bin has been collapsed. The tilt sensor has two stages which are ‘0’
stage and ‘1’ stage, where ‘0’ will be used to indicate the garbage is standing still and ‘1’
is used to indicate that the garbage bin is fallen and need attention. There is a rolling ball
inside the tilt sensor, whenever the tilt sensor is move from one side to another, the
rolling ball inside the tilt sensor will switch the circuit to become either closed or opened.
Below is the specification of Tilt Sensor (tilt switch/ angle sensor).
Chapter 4: Methodology and System Requirements
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 35
Figure 4.5: Angle required to ‘switch’ the state from one to another
Table 4.2: Tilt Sensor specifications
The physical views of the tilt sensors that were used in the project were shown in below.
Figure 4.6: Tilt Switch Sensor
Chapter 4: Methodology and System Requirements
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 36
Figure 4.7: Tilt Sensor
Both tilt sensors as shown in the above section have been adopted. The main difference
between the 2 sensors is that the Tilt Sensor has slightly a better sensitivity in detecting
the tiltiness. However, the difference between the 2 can almost be ignored. Thus, these 2
sensors were used and treated as the same.
RF module – RF module consists of RF Transmitter Module and RF Receiver Module.
Transmitter Module is used to transmit the acquired data from sensor to Receiver Module
side. Receiver Module is used to receive the date that was sent from the RF Transmitter
Module. RF module that were used are only one way communication. Below show the
specifications for both Receiver module and Transmitter module.
Table 4.3: Transmitter operating specification
Working Voltage 3V -12V
Working Current Max Less than 40mA max, and min 9mA
Transmission power 25mW
Table 4.4: Receiver operating specification
Working Voltage 5 V
Working Current <= 5.5mA max
Chapter 4: Methodology and System Requirements
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 37
Figure 4.8: Transmitter and Receiver module in physical view
Arduino Micro – Arduino Micro is placed on the cap of the smart garbage system
(SGS). It is used to receive the data from sensors. It computes and processes data and
then send the data to the base station. It was used as it is light-weighted and small in size.
Hence, the installation of the sensor will be easier. Below shows the pin descriptions and
physical layout of Arduino Micro, the design will require this pin layout to map the
connections of the components.
Figure 4.9: Arduino Micro pin descriptions and physical layout
Chapter 4: Methodology and System Requirements
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 38
Arduino Nano - Other than Arduino Micro, Arduino Nano is also been used to apply on
the system. The functionalities and physical layout is almost identical to Arduino Micro.
The difference between the 2 is minor and can be ignored. Hence, Arduino Nano is used
to have the same function which the Arduino Micro has and to be applied on the cap of
the garbage bin. The reason being to use Arduino Nano as a alternative is mainly because
of its cost, the cost is much more lower than Arduino Micro but the functionalities are
almost identical. The pin layout below shows that it is very similar to Arduino Micro, and
hence, can be used as an alternative.
Figure 4.10: Arduino Nano pin description and physical layout
Arduino Uno – Arduino Uno is used as a base station for the Smart Garbage System. It
works as a base station to receive all the data collected from Arduino Micro/Nano. In
Arduino Uno, it receives and processes the data, smoothen the sensor values to achieve a
more readable and reliable data before forwarding/sending the data to the central server
(Raspberry Pi 3 Model B). The main purpose of having Arduino UNO in the system is
due to its ability to communicate with the internet with the help of Ethernet Shield, which
will be discussed in the following section, hence, the communication between Arduino
UNO and Raspberry Pi can be achieved through internet connection (using UDP
protocol). The pin descriptions for Arduino Micro is provided below.
Chapter 4: Methodology and System Requirements
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 39
Figure 4.11: Arduino Uno pin descriptions and physical layout
Arduino Ethernet Shield – Arduino Ethernet Shield is used to enable the Arduino Uno
to access internet. As Arduino Uno itself do not have internet capability, the Arduino
Ethernet Shield need to be placed on top of the Arduino Uno in order to access the
internet. The reason being for that is because Arduino UNO needs to have internet in
order to be able to send its processed data to Raspberry Pi wirelessly using the internet
protocol - UDP. In order to send the data through internet, Arduino UNO needs to have
its own IP address and network settings, hence, the implementation of Ethernet Shield is
necessary to enable this functionality. Below illustrate the pinouts of Ethernet shield.
Chapter 4: Methodology and System Requirements
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 40
Figure 4.12: Ethernet Shield pinouts
Raspberry Pi 3 Model B – Raspberry Pi 3 Model B has been used as a central server and
database system to receive the processed data from Arduino Uno via Ethernet Shield and
host the web monitoring application in real-time and provide a graphical user interface
(GUI) for the user to monitor the condition of Smart Garbage Monitoring System (SGS).
Inside the Raspberry Pi, an IoT framework - Openhab 2 has been used to establish a web
server that accept the data from the Raspberry Pi and send the data visually to user using
various techniques such as Python and MQTT, such that, a simple GUI will be generated
and displayed to the user with real-time information. Various libraries and packages need
to be installed on RPi and each of them will be discussed and explained in the following
section for how it works and why it is necessary.
Chapter 4: Methodology and System Requirements
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 41
Figure 4.13: Raspberry Pi 3 Model B Pinouts Descriptions
Chapter 4: Methodology and System Requirements
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 42
4.2.2 Software Requirements
There are certain software that are required to be used in order to design the system in an
efficient way. The software that were used will be discussed in the following section.
Arduino IDE – Arduino IDE is a program that enable the user to program the Arduino
microcontroller in ease, by just selecting the correct port and Arduino model in the
program setting, then the coding can then be fetched into respective microcontroller. This
program provides a simple user interface and ease for development, tons of libraries can
be installed and used easily. The sample interface of the program is as illustrated below.
Figure 4.14: Interface of Arduino.exe
Chapter 4: Methodology and System Requirements
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 43
Fritzing.exe – Fritzing.exe is a schematic drawing program that allow the user to draw
the schematic of the product designed and allow the draw the block diagram of the
microcontroller designs. Provide wide range of available sensor and microcontroller for
the user to integrate and design. Furthermore, it allows the user to compile and see the
components are working with each other. This is necessary to test out the components
before really decide to buy the components, hence, this program saves a lot of monetary
object and time before really developing the real product. Hence, the prototype model can
be developed and tested to make sure it is working before really connecting the physical
components. The 2 images below illustrated how the design tool looks alike and the
interfaces.
Figure 4.15: Interface of Fritzing.exe (Breadboard View)
Chapter 4: Methodology and System Requirements
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 44
Figure 4.16: Interface of Fritzing.exe (Schematic View)
Python IDE - Python 3 IDE is a program that allow the user to edit and compile the
python code using a simple interface. Python 3 IDE is to be installed on Raspberry Pi 3
for the data receiving and data displaying purpose. In order to receive the data from
Arduino UNO, the Raspberry Pi need to have a program to handle this. After the
Raspberry Pi has received data through the Python program, the program will then
immediately post the data to the respective MQTT topics (data destination) via the use of
MQTT protocol. Hence, the Openhab 2 will receive the data and use them for displaying
purpose, and this all can be achieved in real-time. The interface layout of the Python 3
IDE is as shown in below.
Chapter 4: Methodology and System Requirements
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 45
Figure 4.17: Python 3 IDE interfaces - Compiler and Code Editor
MySQL - MySQL database is a database system that allow the user to create databases
and tables within the Raspberry Pi system. The MySql database management tools are
required in the development of the system. The database is required to keep the data for
the graph plotting purpose in Openhab 2. Hence, Openhab 2 will connect to the MySql
database and use the data stored inside the database created for data history querying and
data displaying purpose. The MySql management CLI interfaces are shown below for
illustration purpose.
Chapter 4: Methodology and System Requirements
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 46
Figure 4.18: MySQL CLI interface - show databases
Figure 4.19: MySQL CLI interface - show tables
Openhab 2 - “openHAB is a software for integrating different home automation systems
and technologies into one single solution that allows over-arching automation rules and
that offers uniform user interfaces.” (Openhab 2017) Openhab is a IoT framework that
enable the IoT developer to efficient focus on the development of the embedded devices
Chapter 4: Methodology and System Requirements
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 47
without focus too much on software design. Hence, this will enable the developer to
design a system in an efficient and timely manner. The Openhab will collect all the data
processed from Raspberry Pi and display them in the openhab user interface and it is in
real-time. Some interfaces are illustrated below for referencing purpose.
Figure 4.20: Openhab2 main menu page
Figure 4.21: Openhab2 user interface with basic UI option
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 48
Chapter 5: System Specifications and
Implementation
5.1 Specification: Analysis and Design
5.1.1 Protocols used in the system
To design a system that the modules are able to communicate with each other, the system
needs some protocols, in order for them to communicate and send data to each other. In a
typical IoT system, protocols such as TCP/IP, UDP/IP, HTTP/HTTPs, would be used. In
this section, the protocol that were implemented in the system will be discussed and
analysed.
The list below shows the protocols that were used in the system:
- IP
- UDP
- MQTT
Each of them will be discussed in detail to further investigate why and how it is used.
IP - “The Internet Protocol is where it all begins. IP is responsible for basic networking.
The core of the IP protocol works with Internet addresses and every computer on a TCP/
IP network must have a numeric address.” (Neale, G 2013) Every device that is
connected to a network need to have an unique IP address within the network. IP
addresses are used to identify each device and this will allow them to communicate with
each other. In this case, the ip address will be assigned to the Arduino UNO, which is the
base station, in order to grant it internet access to the local area network. After the IP is
assigned to Arduino UNO, the station will be able to send its data to the device that is on
the same network or different network by using port forwarding. On the other hand,
Raspberry Pi, which is the central server, also need to have a IP address setup, in order
for it to connect to the local network and make it accessible from the Arduino UNO.
When both devices are in the same network, the communication between both will be
possible. The image below demonstrate the datagram of IP protocol, from the graph, one
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 49
can observe that the total length of ip is 32 bits, which included all the required
information such as TTL, Source Address, Destination Address, etc.
Figure 5.1: The IPv4 protocol datagram
UDP - On top of IP protocol, UDP data transfer protocol is used to transfer the data from
Arduino UNO to Raspberry Pi. UDP stands for User Datagram Protocol. The UDP works
similar to TCP transport protocol, but it throws all the error checking staff out of the
datagram. It will just send the data continuously from the source to the destination
without checking whether the data is received by the destination (the receiver). The UDP
saves its overheads by throwing away the checking staffs such as ack and fin hand-
shaking protocols, etc. Hence, the devices can communicate with each other more
quickly. “UDP is used when speed is desirable and error correction is not necessary.”
(Neale, G 2013) Due to this reason, UDP was used, as the system requires real-time
monitoring, the UDP will provide such privileges to allow a quick data transfer between
Arduino UNO and Raspberry Pi, miss of a little data is not that significant in this case.
The graph below shows comparison between TCP/IP and UDP/IP, it will shows why
UDP is necessary as compared to TCP in this system.
Table 5.1: TCP/IP as compared to UDP/IP
No. TCP UDP
1 Connection oriented protocol Connectionless protocol
2 Connection in byte stream Connection in message stream
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 50
3 Provides error-checking and control Error-checking and flow control is not
provided
4 Induce more latency in transferring data Lower overheads mean faster data transfer
From the table above, one can see that UDP/IP is a connectionless protocol, which means
it doesn’t care whether the receiver receive the data that was sent from the source, this is
what make the UDP/IP to become a faster and a lower latency data transferring protocol.
The internet protocol layer model is as shown in below, it shows the relationship between
TCP and UDP in typical internet layer model. One can see that both of them are on the
same layer, which is Transport Layer.
Figure 5.2: Internet Protocol 5-Layer Model
MQTT - “MQTT is a machine-to-machine (M2M)/"Internet of Things" connectivity
protocol. It was designed as an extremely lightweight publish/subscribe messaging
transport. It is useful for connections with remote locations where a small code footprint
is required and/or network bandwidth is at a premium.” (MQTT.org). In this project,
MQTT is used to transfer the data from Raspberry Pi to Openhab. There are 2 main
modes in MQTT protocol, one is MQTT Client, and the other one is MQTT Broker.
MQTT Client is the subscriber that request the data from MQTT Broker, where MQTT
Broker is the Raspberry Pi and MQTT Client is Openhab in this system. The graph below
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 51
helps to demonstrate how the MQTT Client and Broker work together and their
relationship in a nutshell.
Figure 5.3: The relationship between MQTT Client and MQTT Broker
From the diagram above, one can observe that the MQTT Broker is the Raspberry Pi,
which will publish the data that is subscribed/requested by the MQTT Client (Openhab).
MQTT provides a transfer layer that is quick and secured, hence, the data transfer
between the Client and Broker can be performed almost immediately and securely. This
characteristic suits the application of the real-time processing which is used in this
system. Once the MQTT Client requests the data from MQTT Broker, this action will
immediately be performed, whether it is requesting data from, or sending data to MQTT
Broker. The graph below demonstrate how the system work as whole with the protocols.
Figure 5.4: The whole system implemented with various protocols
The graph above shows the relationship between each module with different protocols.
The protocol used between Arduino UNO and Raspberry Pi is UDP/IP and the protocol
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 52
used between Raspberry Pi and Openhab is MQTT. This shows how the system work as
whole and how the modules (Arduino UNO, Raspberry Pi and Openhab) work and
communicate with each other.
5.1.2 System hardware connections and setting up
In this section, the hardware connections will be set up and make sure the requirements
are met. To demonstrate the connections between components, let’s break it into 2 parts,
the remote site (Arduino Micro/Nano) and the base station (Arduino UNO). Hence, a list
of required components are shown:
Remote Site
- Arduino Micro/Nano
- 433MHz RF Transmitter Module (with antenna: wire)
- HC-SR04/US-015 Ultrasonic Sensor
- Tilt Switch
- 3 x Micro USB Cable
- 2 x 10k Resistors
- Wires
Base Station
- Arduino UNO
- Ethernet Shield
- 433MHz RF Receiver Module (with antenna: wire)
- 3 x 220 Ohm resistors
- 1 x USB Cable for Arduino UNO
- RGB Led
First, the setup of remote site (Arduino Micro/Nano) will be discussed and explained. In
remote site, the microcontroller need to be small and fit the size in the garbage bin cap.
Hence, Arduino Micro/Nano is used, not only due to this reason, both of these
microcontrollers can save more energy last longer as compared to those bigger
microcontroller, such as Arduino UNO, MEGA, etc, which are very power consuming.
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 53
With Arduino Micro/Nano, the simple data collecting can then be performed. First, the
setting up of 433MHz RF Transmitter Module will be discussed.
433MHz RF Transmitter Module
Figure 5.5: Physical connection of RF Transmitter to Arduino Nano
The 433MHz RF Transmitter is setup as shown in above. The 433MHz RF Transmitter is
used to transmit the data from Arduino Micro/Nano (remote site) to Arduino Uno (base
station). As shown in the figure above, the Data (in) pin of transmitter is connected to the
output pin 12 of Arduino Micro/Nano. The Arduino Micro/Nano will send its data to pin
12 so that the transmitter can get the data from Arduino Micro/Nano and forward the data
to the base station’s RF Receiver Module. It is worth to mention that the 433MHz RF
Transmitter will only work properly with the voltage supply of 5 V, otherwise, the data
may be corrupted. An antenna wire will need to be inserted to the RF Transmitter Module
to improve its maximum transferring range, as the range of the ordinally 433MHz RF
Transmitter is quite short (≤ 3 - 4 m).
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 54
HC-SR04/US-015 Ultrasonic Sensor
Figure 5.6: Physical connection of Ultrasonic sensor to Arduino Nano
Ultrasonic Sensor is used to measure the level of garbage in the garbage bin. It will burst
a microwave using trig pin and obtain the distance from echo pin. The general connection
of Ultrasonic sensor is as shown in figure. From the figure, can observe that the
Ultrasonic requires 5 v in order to operate properly. If the voltage is not high enough, the
measured value will be rather inaccurate. Notice that the ultrasonic sensor do not need
any resistor in between the power source and input pin. The Trig pin of Ultrasonic sensor
is connected directly to the Pin A0 of Arduino Micro/Nano, pin A0 will be set as output
pin to send the signal to Trig. The echo pin is connected to Pin A1 of Arduino
Micro/Nano. Pin A1 will served as an input pin to receive the reflected distance. One can
obtain the measured distance from pin A1 (input) of the Arduino Micro/Nano and
perform some calculation and conversion to change the raw data into a more readable
data.
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 55
Tilt Switch
Figure 5.7: Physical connection of Tilt sensor to Arduino Nano
Tilt sensor is used to detect whether the garbage bin has been collapsed or not. The
connection above shows that the tilt sensor is connected to Arduino Micro/Nano. In order
to make the tilt sensor work, the power supply 5v and GND is necessary. As shown in the
figure above, the data will be either ‘0’ or ‘1’. By observing the state of the tilt sensor,
one can know that whether the garbage bin is standing still or has been collapsed.
Battery Level
Figure 5.8: Battery level detection using voltage divider
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 56
In order to detect the battery level of the remote site, the voltage divider shall be applied
to the system. This voltage divider used 2 x 10 K Ohm resistors to divide the 9 volts into
4.5 volts. The reason being is that the A2 analog input pin cannot withstand with volt that
is bigger than 5v, hence, a voltage divider will be needed. The voltage divider is as
shown as above.
The whole setup of remote site
Figure 5.8: The whole setup of the Arduino Micro/Nano is remote site
The graph above shows the whole connections for remote site Arduino Micro/Nano, after
integrating all the components into a single module. It is notable to mention that there are
more remote sites to be added to the system, the same methodology and setup applied to
all the other addons (Arduino Micro/Nano).
The next part to discuss is on the base station. The main purpose of base station is to
collect all the sensor data from various remote sites, and then process them before
sending to Raspberry Pi. Arduino UNO act as a middle man between sensors and
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 57
Raspberry Pi, this is necessary because Arduino UNO and Arduino Ethernet Shield has a
capability to access internet. First the setup of Arduino Ethernet Shield will be discussed.
Ethernet Shield
Figure 5.9: Arduino Ethernet Shield on top of Arduino UNO
From the image above, one can observe that the Ethernet Shield work together with
Arduino UNO by just putting the Ethernet Shield on top of the Arduino UNO. This will
add the ethernet capability to the Arduino UNO as it provides an ethernet port as shown
in the image. This ethernet port will enable the Arduino UNO to have access to internet,
hence, the data collected from Arduino UNO can be send to the Raspberry Pi via internet.
The ethernet port needs to have an ethernet cable RJ45 to connect either to a router, or to
bridged network from pc/laptop, by doing this, the Arduino UNO will get its ip address
and be able to access the internet for doing the rest of the processing, namely sending
data to RPi.
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 58
433MHz RF Receiver Module
Figure 5.10: 433Mhz RF Receiver on base station (Arduino UNO)
433Mhz RF Receiver Module is used to receive data from 433MHz RF transmitter
module. Receiver will receive the data via DATA pin as shown in the figure. The DATA
pin is then forward the received data to Arduino Uno. The voltage requirement of RF
Receiver is smaller which is 3.3V. If 5V is applied to the receiver, the data will sometime
be lost and unstable. Hence, 3.3V is most suitable for RF receiver. Notice that an antenna
(wire) is added to the RF Receiver Module, the purpose of doing so is to extend the
receiving range of the receiver. If both ends (transmitter and receiver) applied with
antenna, the data transmitting and receiving range will be greatly improved.
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 59
RGB led and the whole system
Figure 5.11: RGB Led with Arduino UNO for status monitoring
The image above shows the whole module of base station, which consists of Arduino
UNO, Arduino Ethernet Shield, 433MHz RF Receiver module and RGB led. An RGB
Led has been added to the system to act as a monitoring tool. When the led light is in blue
color, it means that the module is searching for any available data from remote site. Vice
versa, when the led light is in green color, it means that the module has successfully get
the data from one of the remote sites. Hence, this will act as an signalling led to show
whether the station is receiving any data.
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 60
5.1.3 System software installation and setting up
5.1.3.1 Raspberry Pi
The first thing that need to do is to ensure that the Raspbian OS has been installed on the
system. The Raspbian is an OS that the Raspberry Pi is relying on. It handles all the
events and provides GUI to the user. Make sure the Raspbian is installed on the SD card
of the Raspberry Pi before any further action. To install Raspbian on the SD card, the
following components will be needed:
- At least 16GB Micro SD card
- Raspbian Image file
- Card Reader (Optional)
The first step to install the Raspbian on the SD card is to plug the SD card to the
laptop/PC. On the laptop/PC, copy the Raspbian image file that have been downloaded to
the SD card. Then that’s, just plug the SD card into the Raspberry Pi’s SD card slot and
boot the Raspberry Pi, the system will now start to install the Raspbian OS automatically.
After successfully launched the OS, check the OS version by entering the command:
$ uname -a to check the version of OS installed. The result will be something as shown
below. One can observer the line that mentioned the Raspbian version, arm version and
etc
Figure 5.12: Verify the OS installed on Raspberry Pi
Next, before any software setup and installation, first make sure the Raspberry Pi is
connected to internet by checking internet status on Raspberry Pi. To check if the
Raspberry Pi have connected to the internet and have access to internet, use the
command: $ ifconfig. The output will shown as below.
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 61
Figure 5.13: Internet Configurations on Raspberry Pi 3 Model B
From the graph above, one can see if the Raspberry Pi has successfully get the internet
access, the wlan0/Eth0 (depends on the connection type: wireless or ethernet) will show
the respective IP address and Broadcast address, in this case, it is 192.168.137.181 for the
IP address with wireless mode (wlan0), as shown in the graph above. If the Raspberry Pi
is not connected to the internet, the IP addresses will not be shown in this section.
After making sure that the Raspberry Pi has the internet access, the following list of
software and dependencies can then be installed. The list of softwares and dependencies
to be installed are as shown below:
1.) Python 3.x
2.) Python IDLE 3.x
3.) MySQL Database
4.) Openhab 2
5.) MQTT
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 62
5.1.3.2 Python 3.x
First, to check if the Python 3.x is already installed, use the command: $ python3 --
version. If Python 3.x is already installed on the Raspberry Pi system, it will shows its
current version, as shown in the graph below.
Figure 5.14: Python 3.x version checking
In this case, the system is installed with Python 3.4.2 version. However, if the command
does not show any of the Python 3 version, a manual installation is required.
To install Python 3.x, enter the command: $ sudo apt-get update to update the the
packages before installing the python 3.x, the result of the updates will be something as
shown below.
Figure 5.15: Update the packages on Raspberry Pi
After performed the updating command, the installation of Python 3.x is now ready. To
install the Python 3.x, enter the command: $ sudo apt-get install -y python3. Note that the
-y option is to accept to install the package on the system.
After this command, the python 3.x installation will begin shortly, the images below
shows the sample installation process.
Figure 5.16: Python 3.x installation process
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 63
One can see that the Python 3.x is already installed on the system, hence, installation will
be halted, however if Python 3.x is not installed on the system, this step will do the job.
After the installation is successfully completed, checking the version of the Python 3.x to
make sure it is installed, by entering the command: $ python3 --version. It should now
show the version of the Python 3.x installed.
To make sure that the python 3.x is working properly, enter the command: $ python3 to
enter to the python console panel, and type: >>> print (“Hello from Python 3.x”) to make
sure that it prints out a line of message. If the message is shown, the system already
installed the Python 3.x properly, quit the console by entering the command: >>> quit()
on the console panel, this will terminate the python3 console session. The process is
shown in the image below.
Figure 5.17: Check if Python 3.x is working
After all these steps, the python 3.x should now be installed and ready to be used.
5.1.3.3 Python IDLE 3.x
In order for Raspberry Pi to be able to run the program on its own as a server. A Python
IDLE is needed in order to edit and compile/run the python program. There are 2 types of
Python IDLEs, one is Python IDLE 2.x version and the other one is Python IDLE 3.x
version. In this system, the Python IDLE 3.x is used to develop and run the program on
the server.
To install the IDLE, first, check whether the current system have Python IDLE 3.x
installed, enter the command: $ idle3. If the Python IDLE 3.x is installed, this command
will open up the Python IDLE 3.x in another window as shown in the graph below,
otherwise, the IDLE will not be started and an error message will be prompted.
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 64
Figure 5.18: IDLE is being opened up from terminal console
If the IDLE has not been installed, enter the command: $ sudo apt-get install -y idle3 to
install the Python IDLE 3.x on the system. Once the installation has been done, check
whether the Python IDLE 3.x has been installed by entering again the command: $ idle3
to see if the program can be launched. If the program has been successfully run, it will
show something like the graph below.
Figure 5.19: A Python IDLE 3.x console window
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 65
5.1.3.4 MySQL Database
MySQL Database is needed to store all the data collected from Arduino UNO (Base
Station). The data collected from Arduino UNO will be stored inside this database based
on the Bin Id of each respective remote site. The data stored in the database will then be
extracted from a python program and sent to the openhab topics via the use of MQTT
protocol. Hence, MySQL needs to be installed on the system before the data can be
forwarded.
To ensure that the MySQL database has already been installed on the existing system,
enter the command: $ mysql --version to check if it is installed. If the mySQL is installed,
it will display the message as shown in the image below.
Figure 5.20: MySQL version checking
Otherwise, an error message will be shown instead.
To install MySQL Database, first is to install the MySQL server by entering the
command: $ sudo apt-get install -y mysql-server, as shown in the image below.
Figure 5.21: Installing MySQL-server
After that, you will be prompt for creating password for root of the MySQL account as
shown in the picture below.
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 66
Figure 5.22: Creating password for MySQL account
If the command prompt does not show the configuration page for creating password, a
manual setup for the MySQL will be needed. To create the user information manually,
enter the command: $ sudo mysql_secure_installation. This will bring message as shown
in graph below to create the password for ‘root’.
Figure 5.23: Create password for MySQL ‘root’ user
Enter the password for the ‘root’ user account then the MySQL is almost ready to go.
Now, logging to the MySQL server to see if it is working by entering the command:
$ mysql -u root -p. Then, the MySQL console page will be shown as shown in the picture
below.
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 67
Figure 5.24: MySQL console view
Inside this MySQL console, the database querying, creating can be done. For example, to
show the current available databases on MySQL server, enter the SQL query: > SHOW
DATABASES; then the results will be shown, as in the picture below.
Figure 5.25: Querying mySQL in console
Some default databases will be shown up, such as information_schema,
performance_schema, etc.
Now that the MySQL has been successfully installed and runned. The next step is to
install the an dependency that allow the MySQL to communicate with Python 3.x. To
install the dependency, enter the command: $ sudo apt-get install -y python-mysqldb.
This will install the required dependency for the communication between Python and
MySQL. Hence, the querying using Python will be enabled.
Now, the MySQL has been fully installed and should be able to communicate with the
Python 3.x.
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 68
5.1.3.5 Openhab 2
Openhab 2 is an IoT framework that allow the sensor devices to send data to its server for
visualizing the data in form of graph and different representations. This enable the IoT
devices to share the data within a single platform so that it allows the user to monitor all
the devices at once and in a single application.
Openhab 2 is used for this system to provide a simple, yet useful information for the user
in a single application that allow the real-time monitoring and data visualization. This
will enable the users to have the capabilities to keep track of the garbage bin information
in palm of hand.
The following section discuss the steps that are required to install the Openhab 2 on the
Raspberry Pi.
To install Openhab 2 ,first make sure that the system has the followings:
- Raspberry Pi 2 or newer
- Micro SD card (16GB or more to support wear-leveling)
- Steady power supply
- Ethernet connection
- No connected display or keyboard needed
The first step is to add the openHAB 2 bintray repository key to package manager and
allow apt to use the HTTPS Protocol by entering the command: $ wget -qO -
'https://bintray.com/user/downloadSubjectPublicKey?username=openhab' | sudo apt-key
add -
After doing so, the console will print a message saying “ok” on screen, as shown in the
image below.
Figure 5.26: Adding the openhab 2 bintray repository key to package manager
Then, enter the command: $ sudo apt-get install apt-transport-https. This will install the
apt-transport-https for the installation of openhab 2 as shown in image below.
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 69
Figure 5.27: Installing apt-transport-https
Next, choose a stable version of Openhab2 to install on the raspbian system by using:
$ echo 'deb https://dl.bintray.com/openhab/apt-repo2 stable main' | sudo tee
/etc/apt/sources.list.d/openhab2.list. The console will output the selected stable version of
openhab 2 that is be to installed as shown in image below.
Figure 5.28: Choosing the stable version of Openhab 2 to install
The next step is to resynchronize the package index by entering the command: $ sudo
apt-get update. Now, install Openhab2 by using the command: $ sudo apt-get install -y
openhab2. This will take for while for the installation to complete.
Figure 5.29: Installing openhab 2
Then, install the addons for further utilization of openhab 2: $ sudo apt-get install
openhab2-addons. The installation will take for while, it depends on the network speed of
the internet.
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 70
Figure 5.30: Installing the openhab 2 addons
After the installation of addons is done, the openhab 2 is nearly to be fully functional. In
order for the openhab 2 to automatically startup at system startup, need to register
openhab2 to be automatically executed at system startup by entering the command:
$ sudo systemctl start openhab2.service. This will enable the openhab services to launch
when the system startup.
To check whether the service is enabled for system startup, enter the command: $ sudo
systemctl status openhab2.service, to see whether the service is “enabled”. The enabled
openhab will look something as shown below.
Figure 5.31: Showing the status of Openhab 2
Next, enter the following command to enable the openhab 2 service at once: $ sudo
systemctl daemon-reload | sudo systemctl enable openhab2.service. If the service has
been successfully started, the following output message will be outputted.
Figure 5.32: Openhab 2 successfully launched
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 71
Finally, the openhab2 will now be set up and ready to be accessed from localhost. To
access this address, open up the browser and enter the address: http://localhost:8080.
Then, an Openhab 2 simple configuration page will be shown up as shown in the picture
below.
Figure 5.33: The startup page of openhab 2
To enable remote development for openhab:
The openhab 2 is now ready to be implemented on the system. However, sometime the
remote development s required, for example, telnet from another computer to Raspberry
Pi to perform remote openhab development. By default, the openhab 2 will ignore the
other connection other than Raspberry Pi to have access to control its property, hence, in
order to enable the other computer to have access to control the openhab 2’s platform:
- First, need to add openhab to the privileged groups by entering the command:
$ sudo adduser openhab dialout | sudo adduser openhab tty | sudo adduser
openhab audio
- Then, allow the java environment to access the serial port of the connected
peripheral by using the command: $ EXTRA_JAVA_OPTS="-
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 72
Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0:/dev/ttyS0:/dev/ttyS2:/dev/ttyACM0:/dev/
ttyAMA0"
- Next, setting up a remote to be able to easily access and modify these files from
local PC or Mac by installing Samba: $ sudo apt-get install samba samba-
common-bin
- Edit the content of smb.conf by entering the command: $ sudo vim
/etc/samba/smb.conf. Inside the configuration file, uncomment and enable WINS
support:
Figure 5.34: Inside sambal configuration file
- Then, add the desired share configurations to the end of the file:
Figure 5.35: Adding lines of configurations inside sambal configuration file
- Finally, create and add user to Samba group: $ sudo smbpasswd -a openhab
By doing all these step, the openhab 2 will now allow the remote devices to have access
to the localhost’s development. The sample result of remote access from windows
browser.
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 73
Figure 5.36: Accessing Openhab 2 from remote laptop’s browser
MQTT
The communication protocol between Python 3.x on Raspberry Pi and Openhab 2 is
MQTT. Hence, the MQTT need to be installed first before they can sending and request
data from each other. The MQTT service the system used is Mosquitto MQTT, to install
the Mosquitto MQTT, enter the command: $ sudo pip3 install paho-mqtt, this will install
the paho-mqtt library for later use.
Figure 5.37: Installing python MQTT library
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 74
5.2 The Implementation and Results
5.2.1 Arduino Micro/Nano
To make the hardware of the remote site work as desired, first compile the program into
the hardware using the hardware that were set up in section 5.1.2. Connect the Micro
USB port of Arduino Micro/Nano to the PC/laptop’s USB port as shown in the picture
below.
Figure 5.38: Connecting Arduino Micro/Nano to PC/Laptop
Once the connection between Arduino and pc/laptop is established, open up the Arduino
IDE program to compile and upload the program into the Arduino Micro/Nano. After
open up the Arduino IDE program, select the board and port for the connected Arduino
for program uploading as shown in the picture below.
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 75
Figure 5.39: Selecting Board Type and Port from Arduino.exe
After selected the board type and port for the program to upload, the setup has been done.
Next, upload the remote site’s program code to the Arduino Micro/Nano. A compilation
message be will prompted as shown.
Figure 5.40: Successfully Uploaded the Program
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 76
Once the compilation has been done, now let’s have a look to the results collect from the
remote site (Arduino Micro/Nano) using the serial monitor from Arduino IDE. Open the
serial monitor by selecting “Serial Monitor” option under the “Tools” category. Make
sure 9600 baud rate is selected, then the results collected from the sensors will be
displayed.
Figure 5.41: Displaying Results via Serial Monitor with 9600 baud rate
The accuracy of the sensors has been recorded and summarized in the table below:
Table 5.2: Ultrasonic Sensor actual distance versus collected distance
No Actual Distance (CM) Measured Distance (CM)
1 0 3- 5
2 0.5 3 - 4
3 1 3 - 4
4 2 3
5 3 3
6 5 5
7 15 15
8 100 98 - 100
9 200 120 - 125
From the table above, one can observe that the Ultrasonic Sensor does not work as
expected in the scenario that the distance between the object and the Ultrasonic Sensor is
too short (0 - 1 cm) and when the distance is too far (> 200cm). This is one of the
disadvantage and property of Ultrasonic Sensor in general. However, the garbage bin is
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 77
designed in such a way that it do not require for so much depth (more than 200 cm),
hence, the Ultrasonic Sensor should be working as fine.
The algorithm to derive the distance measured by Ultrasonic Sensor has been given
below:
(Distance) = (Duration of time traveled from source to target / 2) / 29.1
By using the formula as shown above, the distance between Ultrasonic Sensor and target
object can be obtained. The duration of time traveled from source to target can be
obtained using the native library from Arduino IDE, called pulseIn(echo_pin, HIGH).
pulseIn() is a function that is used to calculate the time traveled by observing the status
“HIGH” on the echo_pin. By using this function, the time traveled from source to target
object can be obtained.
The initial procedures to start to record the distance measured by Ultrasonic Sensor is
first to define its pins and initialize the respective pin to the appropriate input and output
pin. After the pin declarations have been performed, the Ultrasonic Sensor can be used.
The general procedure to start the Ultrasonic Sensor as shown.
Table 5.3: The procedure to start the Ultrasonic Sensor
Step Function to be executed Definition of the function
1 digitalWrite(trig_pin, LOW) Configure the trig pin of Ultrasonic Sensor to low,
this implies to turn off the Ultrasonic Sensor. The
purpose of this is to make sure that the Ultrasonic
Sensor is resetted everytime the Ultrasonic Sensor is
called.
2 delayMicroseconds(3) This is to delay for 3 microsecond before the
Ultrasonic Sensor is started.
3 digitalWrite(trig_pin, HIGH) Write the “HIGH” signal to the trig pin of Ultrasonic
Sensor, this is to start the Ultrasonic Sensor. The
sensor will burst a soundwave out from the source
for measuring the distance.
4 delayMicroseconds(10) After sending the “HIGH” signal, let the sensor
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 78
delay for 10 microseconds for the response to come
back.
5 digitalWrite(trig_pin, LOW) Turn off the sensor’s bursting mode by writing
“LOW” to its trig pin and wait for response.
6 dur = pulseIn(echo_pin, HIGH) Record the time spent travel from source to target
object and bounce back to source can be done by
observing the echo pin of the sensor. Normally the
echo pin is “LOW” when no signal to bounce back.
Hence, if the echo pin receive “HIGH” signal, the
time interval can be recorded.
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 79
5.2.2 Arduino UNO
The same procedure is applied to upload the code to the Arduino UNO as Arduino
Micro/Nano. Make sure that the board type and port is selected in accordance to the
Arduino UNO connected. After the connection of Arduino UNO has been setup via USB
cable and the compilation of the code has been done. Launch the serial monitor to display
the data received from the remote site (Arduino Micro/Nano). The image below shows
that the Arduino UNO (base station) is displaying the data obtained from remote site.
Figure 5.42: Data Received from Remote Site are being Displayed on Base Station
The figure above shows that the base station (Arduino UNO) is receiving the data
received from remote site (Arduino Micro/Nano) and displaying the data through serial
monitor. The data transmission between remote site and base station is achieved via the
implementation of 433 MHz RF Module, where the transmitter module is installed on the
remote site, and the receiver is installed on the base station. On both remote site and base
station need to have one communication method in order for them to communicate with
each other.
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 80
There exists numerous communication libraries for the RF communication. The
“virtualwire” library has been adopted in this system. The “virtualwire ” is a library for
the RF communication, it eases the process of sending data through RF modules,
however, its data sending quota is limited to 27 bytes. Hence, a proper arrangement for
the data to be sent is necessary to ensure that the data that need to be sent does not exceed
the limit, otherwise issue will occur (data corruption). The system has the following data
structure to ensure that the data does not crash.
Figure 5.43: Data arrangement for data transmitting
The RF modules has its own advantages and limitations, one of the most obvious
advantage is that the 433 MHz RF modules is low cost. However, the transmission range
is also limited, hence, an antenna (wire) needs to be installed along with the RF modules
to maximize the receiving and transmitting range. The table below compare how much
difference in term of transmitting/receiving range between the RF module without
antenna and the one with antenna.
Table 5.4: RF module without antenna versus RF module with antenna
RF without antenna RF with antenna
Min range
(meter)
0 0
Max range
(meter)
~10 ~25
It is obvious that the RF module with antenna has a greater range, which is ~25m. It is
~15 meter more than the one without antenna, hence, an antenna is required in the
system.
“Virtualwire” library plays an important role in RF transmitting and receiving. The steps
of using the virtualwire in listed in the table below.
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 81
Table 5.5: Virtualwire implementation in steps
Step Function to be executed Function definition
1 vw_set_rx_pin(receiver_pin) Indicate the receiver pin in the RF transmission
receiver_pin: The receiving pin on Arduino UNO
2 vw_set_ptt_pin(transmitter_en_pi
n)
Indicate the transmitter pin in the RF transmission
transmitter_en_pin: The transmitting pin on
Arduino Micro/Nano
3 vw_set_ptt_inverted(true) Required for dr3100 wireless transmission
4 vw_setup(2000) Setup time for 2000ms
5 vw_rx_start() Start the RF receiving process
6 vw_get_message(buf, &buflen) Get the data transmitted from remote site.
buf: A variable that contains data
&buflen: The transmitted data’s length
After the data has been received by the base station, the data then need to be filtered and
processed, before sending them to Raspberry Pi 3. The data processing technique that is
used to smoothen the data received from remote site is the averaging technique. This is to
guarantee that the data is reliable and be ready to used by the RPi. The general concept of
the averaging technique used is as shown below.
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 82
Figure 5.44: The averaging technique used by base station to smoothen the data
The smoothen technique is necessary to avoid the data unreliability such as a sudden
value changes. This huge changes of the data value can affect the reliability of the data.
The images below demonstrate and compared the data received without smooth and
smoothed.
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 83
Figure 5.45: Data without smoothing (left) versus data that is smoothed (right).
From the graph above, one can observe that after the data is smoothed, there are less
glitches as compared to the raw data collected, which will increase the data reliability for
the later use.
The processed data will then be forwarded to RPi via UDP internet transmission protocol.
In order to use the UDP transmission protocol, the program on the base station needs to
include Ethernet, EthernetUDP and SPI libraries. These libraries are necessary to
initialize the ethernet shield IP configurations and UDP setup for the internet
transmission. There are several steps that the program need to execute in order to make
the connection and the transmission successful. The steps are listed ascendingly in the
table in below.
Table 5.6: The UDP transmission setup and procedures on base station
Step Function to be executed Function definition
1 byte mac[] = { 0x00, 0xAA, 0xBB, 0xCC, 0xDE,
0x03 }
Define Mac Address of the Arduino
UNO for the ethernet configuration
2 IPAddress ip(192, 168, 43, 33) Define IP Address for the ethernet
configuration
3 unsigned int localPort = 8989 Assign a local port as 8989 for later
RPi data retrieval
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 84
4 Ethernet.begin(mac, ip) Start the Ethernet service using the
mac address and ip address defined
mac: Mac Address
ip: IP Address
5 Udp.begin(localPort) Start the UDP service using the local
port defined
localPort: Port number
6 Udp.read(packetBuffer,
UDP_TX_PACKET_MAX_SIZE)
Read the UDP data request from RPi
packetBuffer: The packet that
contains the request info from RPi
UDP_TX_PACKET_MAX_SIZE:
The maximum allowable packet size
for UDP transfer.
7 Udp.beginPacket(Udp.remoteIP(),
Udp.remotePort())
Initialize packet to send to RPi
Udp.remoteIP(): The RPi’s IP
Udp.remotePort(): The RPi’s Port
Number
8 Udp.print(String(buf[STARTINGVALUE_BIN])
+ " " + String(ultraAverage) + " " + String(level) +
" " + String(tiltAverage))
Send a string of data to the destination
(RPi)
String(buf[STARTINGVALUE_BI
N]): Containing the Bin ID
String(ultraAverage): Containing the
Ultrasensor data
String(level): The level of garbage
bin
String(tiltAverage): The status of tilt
sensor
9 Udp.endPacket() End the UDP packet
10 memset(packetBuffer, 0,
UDP_TX_PACKET_MAX_SIZE)
Clear out the packetBuffer array
packetBuffer: The packet that
contains the request info from RPi
UDP_TX_PACKET_MAX_SIZE:
The maximum allowable packet size
for UDP transfer.
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 85
5.2.3 Raspberry Pi 3 Model B
On Raspberry Pi, a program is needed to send a “GET” request to the base station, in
order to get the status of each garbage bin. A program is designed in RPi and runned in
Python IDE 3.4.2. A picture below shows the python program is running continuously
sending the “GET” request to the base station, and the base station return the data
containing the information about each bin, until the user choose to exit it.
Figure 5.46: Python program runs on Python IDE 3.4.2
As shown in figure above, one can observe that the data received is in format of array, ex:
[‘2’, ‘8’, ‘46.67’, ‘0’, ’44.00’]. The arrangement of the data in form of array is as shown
below.
Figure 5.47: Array arrangement of data for RPi on server site
As UDP internet protocol is used to communicate between the base station and server
side. Hence, socket library needs to be implemented. Socket library provides a method to
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 86
set the internet configuration for UDP, namely IP Address, Port Number. To setup the
socket configuration on RPi, the following steps are required in the python program.
Table 5.7: Socket configurations for RPi in steps
Step Function to be executed Function definition
1 from socket import * Import Socket library for internet
configurations
2 address=( '192.168.43.33', 8989) Specific the ip address and port number to
request the data.
'192.168.43.33': Base station’s ip address.
‘8989’: Base station’s port number
3 client_socket = socket(AF_INET,
SOCK_DGRAM)
The socket(domain, type, protocol) call
creates a socket in the specified domain
and of the specified type.
AF_INET: Internet domain
SOCK_DGRAM: A datagram-based
protocol - UDP. Send one datagram and
get one reply and then the connection
terminates.
4 client_socket.settimeout(1) Set the client socket to timeout in 1
second
5 client_socket.sendto( data.encode(), address) Encode the request data, and send to the
base station’s ip address.
data.encode(): Encode the request data,
ex: “status”.
address: The address that contains the
base station’s ip address and port number.
6 rec_data, addr = client_socket.recvfrom(2048) Read the response data from remote site
with maximum size of 2048 bytes and
store it in rec_data.
7 dat = rec_data.decode('utf-8') Decode the rec_data to ‘utf-8’ which RPi
can accept and store the data to dat for
later user.
The following images show that the RPi python program has successfully received the
data sent from the base station.
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 87
Figure 5.48: Data collect from base station
Figure 5.49: RPi successfully get the data from the base station
The two images above shows that two sites (base station and server site) are with the
same data, this shows that the data transmission from base station to RPi is successful.
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 88
Besides of receiving data from the base station, RPi also need to categorize its received
data and send to the Openhab2 (IoT framework) at the same time. To send the data to
Openhab2, the transfer protocol MQTT was used. Hence, MQTT library needs to be
installed on RPi and imported to the python program. The installation of MQTT can be
performed by typing the command: $ sudo pip3 install paho-mqtt. Then the python
program will be able to import the MQTT client library to perform the data sending
procedure to Openhab2.
MQTT has 2 types of roles, MQTT Broker and MQTT Client. MQTT Client subscribes
the data request to MQTT Broker, MQTT Broker provide the data that the MQTT Client
requests. In short, MQTT Broker is a service provider and MQTT Client is the service
subscriber. In this system, Openhab2 will be the MQTT Client that will request the data
from MQTT Broker, which is the RPi (Python Program) itself. To send the data, the
MQTT needs to have paths for it to post and get the data, and this path is called “topic”.
In this system, 3 topics have been created (for 3 garbage bins). The figure below
demonstrate the concept of topics of MQTT.
Figure 5.50: MQTT Topics and relationship
Using the topics, the path to “POST” and “GET” can be defined. Hence, the data
transmission between openhab2 and RPi (python program) can be done.
To implement the MQTT in the python program, the following steps are required.
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 89
Table 5.8: MQTT configurations and setup in python program
Step Function to be executed Function definition
1 import paho.mqtt.client as mqtt Import MQTT Client library
2 mqttc = mqtt.Client() Create MQTT Client object
3 mqttc.connect("192.168.43.250", 1883) Connect to MQTT service with port
number 1883 (MQTT) and ip address of
“192.168.43.250” (RPi)
4 mqttc.publish("/siteA/bin/level", dat, qos=0,
retain=False )
Publish the data to each respective topic.
"/siteA/bin/level": Topic path
dat: Data to be sent
qos: Quality of service
retain: Retain the information sent
5 mqttc.disconnect() Disconnect the MQTT service
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 90
5.2.4 Openhab2
Openhab 2 is an IoT framework for the rapid development of IoT solutions. This system
is designed partly with Openhab 2, to create an UI that allow the user to monitor the
status of all the garbage bin in the area. Openhab 2 is implemented to retrieve the data
from RPi, and display the data from it to an user friendly website/app. All the
dependencies for Openhab 2 have been explicitly explained in section 5.1.3 “System
software installation and setting up”. After making sure that the dependencies are
installed, the service is ready to be launched. To launch the Openhab 2 service, in the
command prompt, type the command $ sudo /bin/systemctl start openhab2.service, then
the service will be launched. After the service is launched, it is now ready to open up the
main menu of the Openhab 2 type typing localhost:8080 on the browser for development
purpose.
There are numerous file components of Openhab that need to be programmed and
designed, they are listed below:
- Items
- Sitemaps
- Persistence
- HTML
- Javascript
Some explanations for the terms being used:
Items - Items is a configuration file that specific which components to be included in the
software. Each of these components can be binded to certain value or label for displaying
purpose, namely binding with the MQTT to get the value display on these components.
Sitemaps - Sitemaps is a configuration file that is used to design the layout of the
software, this allows the components of the software to be grouped together and and
displayed to control the GUI layout of the software.
Persistence - Persistence file is used to keep the data updated and populated in the
MySQL database. The data stored in the database can be used to display the historic data
stored in form of graph for visualizing the data in a more convenient way (inspect the
garbage overflowing peak hours).
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 91
HTML - HTML is a webpage’s layout design tool that is used to design the interface of
the Google Map. The Google Map will be integrated into the software by implementing
this HTML file together with the Javascript file. This HTML file will be used to display
the UI of this system.
Javascript - This file is a Javascript file that is used to control the HTML page and allow
the HTML to access the Openhab2 variables. This includes initializing the Google Map,
etc.
There exist several UI framework options in Openhab 2, namely BasicUI, PaperUI and
ClassicUI. For this project, BasicUI has been chosen due to its simplicity and clear
interface.
MQTT is the communication protocol between local RPi’s python program and Openhab
2. Hence, the MQTT communication dependency need to be installed first before
Openhab can requests the data from the python program. This can be done by inserting
the command $ sudo apt-get install mosquitto mosquitto-clients. The image below shows
that after the command, the dependency will be installed.
Figure 5.51: Installing MQTT - Clients dependency
After installed the above MQTT dependency, the Openhab will be able to request the
data for each topic requested from the python program on RPi. The images below show
that the broker (publisher) successfully sent the data “Successfully Get Data” to the client
(subscriber).
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 92
Figure 5.52: Send data to MQTT subscriber
Figure 5.53: Successfully get data from the MQTT broker
Hence, the communication tunnel between python program and Openhab is enabled. In
the following section, each component of the Openhab as mentioned previously will be
further discussed.
5.2.4.1 Items
Items need to be defined in order to display the desire data to the user. The main items to
display are the filling level of the garbage bin, the status, and alert information. These
items can be defined in a file called default.items. The structure of the default.items file is
as shown below.
Figure 5.54: The structure of default.items file
The structure of the code as shown above is as [data type] [variable] [Message to display
on software] <Icon> {MQTT request topic}. From the image above, one can see that
there is a line “{mqtt="<[mosquitto:/siteA/bin1/status:state:default]"}”. This line of code
tells the program that the variable “status1” should subscribe and get the data from topic
“/siteA/bin1/status”, where the python program will publish to.
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 93
5.2.4.2 Sitemaps
Sitemaps is necessary to decide how the items are grouped together. It is basically a
layout tool to arrange the position for the items defined. So that the items are grouped
together according in the UI of the software. The structure of the sitemaps file is as
shown below.
Figure 5.55: The structure of the default.sitemap file
After this configuration file is saved and compiled, the resulting layout of the software
will be as shown below.
Figure 5.56: The layout of the software after the default.sitemap is configured
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 94
The software will be then provide the information for Bin’s filling level, its status (empty,
partial, full or error), the fallen status, the connection status and the battery level of the
bin.
5.2.4.3 Persistence
Persistence configuration file is used to define and setup the database connection between
Openhab 2 and MySQL database. In this file, the items to be stored and how often the
database update these variables will be configured. The image below shows the
configurations of the persistence file.
Figure 5.57: Configurations in default.persistence
The configuration shows that the persistence file will keep the variables “level1”,
“level2” and “level3” updated to MySQL database once any one of the variables
“changed” or “updated” and specific that these data need to be restored on system set up.
These data stored in database will then be used to show the data history for the user to
inspect the peak period for the garbage pilling issue to occur. The user can then analyze
the optimal time to collect the garbage and this will save their time and promote
efficiency. The images below shows the data history graph for the garbage piling status.
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 95
Figure 5.58: The data history for garbage piling status using MySQL database(1)
The images above shows the data history for “Daily”, one can always change the data
history graph for “Weekly” or “Monthly”.
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 96
5.2.4.4 HTML
HTML is used to define to webpage that display the Google Map on top of the software.
In order for the Google Map to be able to work in this web page, the Google Map API
and settings are configured in this file. The Google Map API can be generated by visiting
official Google Map website. The snippets belows show that Google Map API is
configured in the html file.
Figure 5.59: Google Map API configured on html file
Furthermore, to make the html to be able to get the data from Openhab, the html file
needs to include the path to the Openhab’s items.default. This can be done by using the
command GetOpenHABItem() to access the data from default.items.
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 97
Figure 5.60: Accessing to the default.items file
As shown in the figure above, variables “loc1”, “loc2”, “loc3”, etc were used to stored
the data collected from default.items. These variables will then be used to set the status
markers on the map later.
5.2.4.5 Javascript
Javascript file acted as a middleman and is used to control the html file and as the
communication tool between Openhab and html module. Javascript file provides
functions to allow the html module to access the data from the Openhab (default.items).
The function that was implemented for the html module namely GetOpenHABItem() to
allow the html module to be able to get the data from the default.items. Hence, the html
module can get the latest status for each garbage bin and update its status accordingly.
The Google Map is shown on top of the software, after all the required configurations is
done. The image below shows that the Google Map is being called and working as
expected.
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 98
Figure 5.61: Google Map integrated into the software
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 99
5.2.5 The System as Whole
This section will implement the whole system to verify that the system is working as
expected. Some general operational guidance on setting up the whole system will be
given. Besides that, various test results will be demonstrated.
5.2.5.1 Remote site
First, the Arduino Micro/Nano (remote site) needs to be installed on the different parts of
the bin as shown in the picture below.
Figure 5.62: The modules installed on the bin
From the graph above, one can see that the bin is installed with external power supply.
The remote site needs to have external power supply in order to work due to the fact that
there won’t have any plug-in power source for the remote site. Besides that, the Arduino
Micro/Nano is placed on the side of the bin together with the tilt sensor. On the cap, the
Ultrasonic sensor is installed at the center position. One of the remote sites will then be
set up after installed all these parts on the bin. The remote site will keep sending the data
to the base station based on the data sending refresh rate defined.
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 100
5.2.5.2 Base station
The base station is responsible to receive all the data sent from remote sites and forward
the data processed to RPi. The base station (Arduino UNO) need to have access to
internet, in order to send the data to RPi. Hence, Arduino UNO needs to be connected to
laptop/router to allow the laptop/router to share the internet access to Arduino UNO. In
this project, the internet sharing device will be laptop. The connection of the Arduino
UNO will be as shown.
Figure 5.63: Laptop sharing internet to Arduino UNO through Ethernet Shield via RJ45 cable
As shown in figure above, Arduino Ethernet Shield is connected to the Ethernet Port of
the laptop. Then the internet sharing through the port can be done by bridging the
networks. The bridging of the networks can be done by selecting the local network (ex.
Local Area Network #1, with internet access) adapter and the cable connected network
adapter (ex. Local Area Network #2), right click the mouse and click “Bridge Networks”,
then the Arduino UNO will be able to access to the internet. After the base station have
access to the internet, it is now ready to send the data to RPi.
The base station will keep receiving and searching for the data from remote sites. There is
a status led showing the status (receiving or not receiving) at the base station. If the base
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 101
station receives the data, the led will goes greed, otherwise it will stays in blue. The
picture below shows both of the statuses of the base station.
Figure 5.64: Base station receiving (left) and not receiving data (right)
5.2.5.3 Server Site
The server site is responsible for the data receiving from base station, and send the data to
the Openhab 2 user interface for data visualization. Hence, the server site (RPi) need to
be connected to the internet at all time, and it should be connected to the same network as
the base station (otherwise network port forwarding will be needed to forward to different
network). The image below shows that the Server Site (RPi) ) is up and running.
Figure 5.65: Server site (RPi) is up and running
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 102
Inside the server site, a program is designed to receive the data from base station as
discussed in Section 5.2.3 “Raspberry Pi 3 Model B”. The program shall run itself at all
time except that the user choose to abort the service. Hence, run the program from the
Python IDLE and the server is then ready to receive the data from base station and serve
the services to the users. The image belows shows that the RPi’s python program is
running and constantly getting the data from base station.
Figure 5.66: RPi python program is getting data continuously
Finally, the Openhab should be able to display the data received from the server site via
the MQTT protocol.
To verify that the server site is actually receiving and processing all the data from remote
site. The following section will discuss the system testing and the results in the actual
implementation. The following aspects will be inspected:
- The bin statuses (level and status)
- The bin connectivity
- The bin battery level
- The Google Map
The bin statuses
The status of each bin shall be displayed on Openhab in real-time. The results below
shows the transmission from remote site to Openhab is successful.
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 103
Figure 5.67: Openhab received filling level from Bin 1
Figure 5.68: Openhab received status from Bin 1
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 104
Figure 5.69: Openhab received filling level from Bin 2
Figure 5.70: Openhab received status from Bin 2
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 105
Figure 5.71: Openhab received filling level from Bin 3
Figure 5.72: Openhab received status from Bin 3
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 106
The bin connectivity
Bin connectivity status is implemented to identify whether the connection from the bin in
remote is dropped. The images below show that the bin connectivity’s status is shown as
“OFF” (disconnected) when the bin is turned off, and shown as “ON” (Connected) when
the bin is turned on.
Figure5.73: The bin connectivity demonstration
The bin battery level
The battery level status is implemented to monitor the battery level of each garbage bin,
so that the user can know when to replace the battery of the system in the remote site.
The image below shows the battery level of garbage bin 2.
Figure 5.74: Bin 2’s battery level
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 107
The Google Map
The google map shall update the status on the map while the status of the bins changed.
The map shall provide the user’s current location as well. The pictures below illustrated
that the google map is working and the application automatically change the color of the
markers to show different status of the bins.
Figure 5.75: The marker colors on map changes accordingly when the status of bin change (1)
Chapter 5: System Specifications and Implementation
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 108
Figure 5.76: The marker colors on map changes accordingly when the status of bin change (2)
The figures above show that the Google Map is pre-configured with some markers for
representing the bins location and status. These markers will change its color accordingly
and automatically based on the status of each bin. This will ease the user to track the
status of each bin. In addition, the user’s current location will be shown to allow the user
to know how far the distance between the current location and the bin that need to be
collected or managed. This feature requires the users to allow the GPS tracking
permission on their smartphones or tablet, otherwise, the current location of the user will
not be shown.
Chapter 6: Conclusion
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 109
Chapter 6: Conclusion
6.1 Project Review, Discussion and Conclusion
6.1.1 Project Achievement
This system has been successfully developed and implemented. Each module in the
system can now transmit the data between each other and finally display the data to the
end users. The users can access the website and server designed from everywhere
(outside of local network), since this software has been published to the internet. This
system’s software can be accessed from pc, laptop, smart phones as well as tablets, as
long as the device has the capability to browse the web services. Thus, the real time
monitoring for each garbage bin in the area can be achieved.
6.1.2 Problem Encountered
Along the way of developing this system, there definitely exist some difficulties that I
have faced. There are 2 kinds of difficulty, one is related to psychological or mentally
challenges, and one is the technical challenges. For the technical challenges, the most
challenging one during the development stage is the ability to grasp new information and
learn to apply them into the real system. Learning the new information is only a tip of an
iceberg, learning how to apply the information can be an another challenge. For example,
some theories seems simple and can be done easily, however, when implemented in the
system, they did not function together. This is one of the biggest challenge in the
technical aspect of the developing stage. Besides that, researching time spent during the
development stage is tremendous. Countless hours of researching and implementing have
been performed to make sure that the system is working as expected. The research areas
cover from hardware perspective to software perspective, in the middle of the two
includes all the protocols and technologies such as MQTT, RF and more. All this require
both mentally and technical skills, which I’m lacked of.
Chapter 6: Conclusion
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 110
On the other hand, the mentality shall be skilled enough to be able to develop a system,
the determination and the commitment to oneself shall always be applied. Also, time
managing stands a big role in developing a system, a self-proposed due date shall always
be met, which to me is kind of a big challenge.
6.1.3 Personal Insight into Research Experience
During the development stage of the system, tremendous amount of skills and knowledge
have been learned and applied. Though there is hard time during the development, the
outcomes are always cherishing. Developing a system is not an one-day-work, a step-by-
step developing stage need to be strictly followed. A big task shall be broken up into
several smaller parts where it is more applicable and implementable, then only a system
can be developed. Skills such as time managing, self-discipline have also been learnt.
Though these are not the skills that are required for developing a system, however, it
stands a big role in the stable product development and also self-development. Various
technologies and skills have also been learnt, from the low level programming design -
embedded system design to high level design - software design (configuration of existing
software). After completed this project, it helped me to become a more rounded computer
engineer, where both hardware programming skills and software programming skills are
needed.
Chapter 6: Conclusion
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 111
6.2 Novelties and Contributions
By completing this project, it is hoped that this system will help to improve the quality of
life of human, by creating a more efficient garbage collection system and technology.
This can be the keystone to the era of smart cities and it is a crucial development, when
everything demands for efficiency and speed in managing the cities. Garbage is always
one of the top aspects when considering about the proper development and management
of a city, hence, this project could help to improve that. This project does not open as a
pilot experiment, however, it is hoped that someday it will, to see if this system really
improve the efficiency of the traditional garbage collecting schedule.
6.3 Future Improvement
There are things that can be improved for the current project. First, it is the garbage
detecting accuracy. In this project, the ultrasonic sensor was used to detect the level of
the garbage for the garbage bin, although the results are considered as promising for most
of the time, sometime it will produce the data that is not accurate. This can be improved
by researching a more suitable sensor or improve the design of the system to minimize
the data inaccuracy of the system. This is one of the improvement that the system can
done to improve the reliability of the system.
Besides that, the software that was implemented in this system is using the existing
framework for the IoT design - Openhab. Although the framework is sufficient to design
the UI for this system, some capabilities are limited by using this framework, such as a
more dynamic software. This can be improved by designing a software from scratch
instead of using the framework.
Also, the current system is lacking of the capability for system extensibility, meaning that
the current system need to be configured every time user wants to add in more garbage
bin to the system. This can be improved by providing the users a more implementable
approaches and method of adding the garbage to the system.
Chapter 6: Conclusion
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 112
Lastly, the system currently works well in the condition that is ideal, such as low light
intensity and low humidity environment. This is crucial because the system is supposed
to withstand against the water and sunlight exposure. Some improvements such as a
better packaging and design layout of system can be made to make the system
invulnerable to these possible hazards.
In conclusion, the system is considered as completed. I must thank my parents, lectures
and supervisor, with their unconditional support and help, I only able to design and
complete this system. A big thank to my supervisor, for all the valuable advices and
guidance during the system development stage of the system. Last but not least, thank to
my parents and brother for their unconditional love and caring, without their support, I
won’t be able to make it.
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 113
References/ Bibliography
Alexander, M & Walkenbach, J 2013, ‘Microsoft Excel Dashboard & Reports’, 2nd edn.
John Wiley & Son, Inc, New York.
Dar, K, Bakhouya, M, Gaber, J & Wack, M 2010, ‘Wireless Communication
Technologies for ITS Applications’, pp.156 – 162, DOI: 10.1109/MCOM.2010.5458377.
Dado, A 2013, ‘The “Big-Bang” Software development lifecycle model’. Available from
https://lameguy.wordpress.com/2013/05/29/the-big-bang-software-development-lifecycle-
model/ [29 May 2013]
Eric 2015, ‘Infrared vs Ultrasonic – What You Should Know’. Available from:
https://www.societyofrobots.com/member_tutorials/book/export/html/71 . [2015]
Glouche, Y & Couderc, P 2013, ‘A Smart Waste Management with Self-Describing
objects’, Hal archives-ouvertes.
Gus, 2015, “Raspberry Pi MYSQL & PHPMyAdmin Tutorial”. Available from:
https://pimylifeup.com/raspberry-pi-mysql-phpmyadmin/
Hong, I, Park, S, Lee, B, Lee, J, Jeong, D & Park, S 2014, ‘IoT-Based Smart Garbage
System for Efficient Food Waste Management’, Hindawi Publishing Corporation The
Scientific World Journal, pp. 1-13.
K.Ashton, ‘That “internet of things” thing’, RFiD Journal, vol.22, pp.97-114, 2009.
Ambrose, T, Ford, C & Norris, M n.d., ‘Smart City Trash Cans’. Available from:
https://betacityyeg.files.wordpress.com/2015/12/trash_project.pdf. [10 December 2015]
K.Kurre, V 2016, ‘Smart Garbage Collection Bin Overflow Indicator using IoT’,
International Research Journal of Engineering and Technology (IRJET), vol. 3, no. 5, pp.
2288 – 2290.
Naveen 2016, ‘What is Spiral Model in software testing and what are advantages and
disadvantages of Spiral Model’. Available from http://testingfreak.com/spiral-model-
software-testing-advantages-disadvantages-spiral-model/
Neale, G 2013, “11 Protocols you have got to know (Part of the ‘Concise Byte Series’)”.
Available from: https://www.concise-courses.com/11-protocols/
Openhab 2, 2017, “What is Openhab”. Available from:
https://www.openhab.org/introduction.html
Openhab, “openHAB 2 on Linux”. Available from:
https://docs.openhab.org/installation/linux.html
BIT (HONS) Computer Engineering Faculty of Information and Communication Technology (Perak Campus), UTAR. 114
Oracle Corporation, 2010, “Socket Tutorial”. Available from:
https://docs.oracle.com/cd/E19620-01/805-4041/6j3r8iu2l/index.html
Omar, M, Termizi, A, Wahap, N, Ismail, N & Ahmad, N 2016, ‘Implementation of
spatial smart waste management system in Malaysia’, Earth and Environmental Science,
vol. 37, no. 1, pp. 1 – 9.
Parkash & Prabu, V 2016, ‘IoT Based Waste Management for Smart City’, International
Journal of Innovative Research in Computer and Communication Engineering, vol. 4, no.
2, pp. 1267 – 1274.
Prajakta, G, Kalyani, J & Snehal, M 2015, ‘Smart Garbage Collection System In
Residential Area’, IJRET: International Journal of Research in Engineering and
Technology, vol. 4, no. 3, pp. 122 – 124.
Problem with RFID Standards 2010, Available from:
https://www.technovelgy.com/ct/Technology-Article.asp?ArtNum=20.
Shueh, J 2016, ‘’Smart Garbage’ Startup Cuts City Trash Costs by 40 Percent’. Available
from https://www.govtech.com/civic/Smart-Garbage-Startup-Cuts-City-Trash-Costs-by-
40-Percent.html. [11 April 2016]
S.R. Jino Ramson, D. Jackiline Moni 2016, ‘Wireless sensor networks based smart bin’,
Department of Eletronics and Communication Engineering, Karunya University, PP.1 -
17, DOI: 10.1016/j.compeleceng.2016.11.030.
Zanella, A & Vangelista, L 2014, ‘Internet of Things for Smart Cities’, IEEE Internet of
Things Journal, vol. 1, no. 1, p. 22.