Chapter 3

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 19

CHAPTER 3

METHODOLOGY AND DESIGN

3.1 INTRODUCTION

Nowadays, garbage issues have become a serious thing in maintaining the


cleanliness of the city. Many of the city areas are still without public garbage
bins so the garbage is thrown at the roadside or at the corners in the locality,
which creates ugliness at the corners. Due to no garbage bins, garbage is
thrown in the small water reservoirs or the drainage water which creates
blockages. In the rainy season, these blockages damage the water flowing
system and then water overflows through the roads. In some areas the
overflowed water blocks all the ways of transport or small floods within the
city are generated. The open garbage containers pose problems for the people
living in that vicinity as it becomes the breeding ground for insects like
mosquitoes, germs, etc. which spreads numerous diseases. These open garbage
areas create unhygienic conditions in those areas.
In many of these areas, the garbage bins are not cleaned at regular intervals
which means that no proper maintenance is kept in cleaning the bins. To avoid
this, smart waste management and monitoring systems should be adopted. And
for the adoption of these smart systems, there should be a paradigm shift
towards the “Internet of things” i.e. IoT technology. This will help in
optimizing the garbage management system and also in reducing the
consumption of the fuel by the current system. Some of the projects on smart
garbage management and monitoring system have been implemented using IoT
technology and has been proved to be very effective for environmental issues.
These projects are mainly based on IoT devices such as Ultrasonic sensors and

9
controller. Management and lack of smart monitoring of the condition of the
bin. This proposed paper shows an effective solution to manage the garbage.
This garbage monitor is implemented using sensors and PIC microcontroller.

3.2 GENERAL OVERVIEW

This smart bin system is very useful in preventing overflow of dustbins and
accumulation of wastes around the dustbin. This system monitors the bins and
provide details about the level of garbage collected in the garbage bins via
sensors and Internet. This system uses a PIC microcontroller and node MCU
with a power supply. Ultrasonic sensor placed on the bin detect the people and
opens the lid of the bin and an another ultrasonic sensor placed under the bin lid
detect the garbage level and notifies the authorities when the bin reached
maximum level. IR sensor is used to sense near garbage if any.

3.3 HARDWARE REQUIREMENTS

1. PIC16F887
2. HC-SR04 Ultrasonic Sensor
3. ESP8266 WiFi module
4. LCD display

3.3.1 PIC16F887 microcontroller

This powerful yet easy-to-program (only 35 single word instructions)


CMOS FLASH-based 8-bit microcontroller packs Microchip's powerful PIC
architecture into an 40- or 44-pin package. The PIC16F887 features 256 bytes
of EEPROM data memory, self programming, an ICD, 2 Comparators, 14
channels of 10-bit Analog-to-Digital (A/D) converter, 1 capture/compare/PWM

10
and 1Enhanced capture/compare/PWM functions, a synchronous serial port that
can be configured as either
3-wire Serial Peripheral Interface (SPI™) or the 2-wire Inter- Integrated Circuit
(I²C™) bus and an Enhanced Universal Asynchronous Receiver Transmitter
(EUSART). All of these features make it ideal for more advanced level A/D
applications in automotive, industrial, appliances or consumer applications.The
PIC16F887 is one of the latest products from Microchip. It features all the
components which modern microcontrollers normally have. For its low price,
wide range of application, high quality and easy availability, it is an ideal
solution in applications such as: the control of different processes in industry,
machine control devices, measurement of different values etc. Some of its main
features are listed below.

 RISC architecture

 Only 35 instructions to learn

 All single-cycle instructions except branches

 Operating frequency 0-20 MHz

 Precision internal oscillator

 Factory calibrated

 Software selectable frequency range of 8MHz to 31KHz

 Power supply voltage 2.0-5.5V

 Consumption: 220uA (2.0V, 4MHz), 11uA (2.0 V, 32 KHz) 50nA


(stand-by mode)
 Power-Saving Sleep Mode
 Brown-out Reset (BOR) with software control option

11
Figure 3.1. PIC16F887 PD1P 40 microcontroller
 35 input/output pins

 High current source/sink for direct LED drive

 software and individually programmable pull-up resistor

 Interrupt-on-Change pin

 8K ROM memory in FLASH technology

 Chip can be reprogrammed up to 100.000 times

 In-Circuit Serial Programming Option

 Chip can be programmed even embedded in the target device


 256 bytes EEPROM memory

 Data can be written more than 1.000.000 times

 368 bytes RAM memory

 A/D converter:

 14-channels

 10-bit resolution

 3 independent timers/counters

12
 Watch-dog timer

 Analogue comparator module with

 Two analogue comparators

 Fixed voltage reference (0.6V)

 Programmable on-chip voltage reference


 PWM output steering control
 Enhanced USART module

 Supports RS-485, RS-232 and LIN2.0

 Auto-Baud Detect

 Master Synchronous Serial Port (MSSP)

 supports SPI and I2C mode

Figure 3.2. PIC16F887 QFN 44 Microcontroller

13
3.3.2 HC-SR04 ULTRASONIC SENSOR

HC-SR04 is an ultrasonic sensor which is used for measuring the


distance between the top of the lid to the top of the garbage.

PIN NO. PIN NAME DESCRIPTION


1. VCC The VCC pin powers the sensor, typically with
+5V
2. Trigger Trigger pin is an Input pin. This pin has to be
kept high for 10 us to initialize measurement
by sending US wave.
3. Echo Echo pin is an Output pin. This pin goes high
for a period of time which will be equal to the
time taken for the US wave to return back to
the sensor.

4. GND This pin is connected to the Ground of the


system.

Table 3.1. Pin number and function of Ultrasonic Sensor

3.3.2.1 HC-SR04 SENSOR FEATURES

 Operating voltage: +5V


 Theoretical Measuring Distance: 2cm to 450cm
 Accuracy: 3mm
 Measuring angle covered: <15°
 Operating Current: <15ma
 Operating Frequency: 40Hz

14
3.3.2.2 ULTRASONIC SENSOR WORKING

The HC-SR04 Ultrasonic (US) sensor is a 4 pin module, whose pin


names are Vcc, Trigger, Echo and Ground respectively. This sensor is a very
popular sensor used in many applications where measuring distance or sensing
objects are required. The module has two eyes like projects in the front which
forms the Ultrasonic transmitter and Receiver. The sensor works with the
simple high school formula that
Distance = Speed × Time.

Figure 3.3 HC-SR04 Ultrasonic Sensor

The Ultrasonic transmitter transmits an ultrasonic wave, this wave travels in air
and when it gets objected by any material it gets reflected back toward the
sensor this reflected wave is observed by the Ultrasonic receiver module. Now,
to calculate the distance using the above formulae, we should know the Speed
and time. Since we are using the Ultrasonic wave we know the universal speed
of US wave at room conditions which is 330m/s. The circuitry inbuilt on the
module will calculate the time taken for the US wave to come back and turns on
the echo pin high for that same particular amount of time, this way we can also
know the time taken. Now simply calculate the distance using a microcontroller
or microprocessor.

15
3.3.3 ESP8266(IoT)

In this report we narrate the use of ThingSpeak, an “Application


Programming Interface” (API) and web service for the “Internet of Things”
(IoT). span the explanation as to what should be understand below the term is
changing over time, here we refer to enabling objects or simple devices to be
identified and convey with via the Internet.
The ThingSpeak API is an open source interface which listens to incoming data,
time stamps it, and outputs it for both human users (along visual graphs) and
machines (along easily parse-able code). We look into practical examples using
the micro-controller as well as communication with graphical interface
operating systems through a Python script.
Our report concludes that ThingSpeak is mainly useful for smaller hardware
projects where connectivity over the Internet is need but in which the
preservation of a committed transmission server is not real. Different IOT
services exist but tend to need payment for some of their functionality and are
as a result not open source.

3.3.3.1 OVERVIEW

ESP8266EX delivers highly integrated Wi-Fi SoC solution to meet the


continuous demands for efficient power usage, compact design and reliable
performance in the industry.ESP8266EX integrates antenna switches, RF balun,
power amplifier, low noise receive amplifier, filters and power management
modules. The compact design minimize the PCB size and allows for minimal
external circuitry. Besides the Wi-Fi functionalities, ESP8266EX also integrates
an enhanced version of Tensilica’s L106 Diamond series 32-bit processor and
on-chip SRAM. It can be interfaced with external sensors and other devices

16
through the GPIOs. Software Development Kit (SDK) provides sample codes
for various applications. Espressif Systems’ Smart Connectivity Platform
(ESCP) enable sophisticated features include fast switching between sleep and
wake-up mode for energy-efficiency purpose, adaptive radio biasing for low-
power operation, advance signal processing, spur cancellation and radio co-
existence mechanisms for common cellular, Bluetooth, DDR, LVDS, LCD
interference mitigation.

Figure 3.4. ESP8266EX Block Diagram

3.3.3.2 THINGSPEAK

In this report we narrate the use of ThingSpeak, an “Application


Programming Interface”(API) and web service for the “Internet of Things”
(IoT). span the explanation as to what should be understand below the term is
changing over time, here we refer to enabling objects or simple devices to be
identified and convey with via the Internet. The ThingSpeak API is an open
source interface which listens to incoming data, timestamps it, and outputs it for

17
both human users (along visual graphs) and machines (along easily parse-able
code). We look into practical examples using the arduino micro-controller as
well as communication with graphical interface operating systems through a
Python script. Our report concludes that ThingSpeak is mainly useful for
smaller hardware projects where connectivity over the Internet is need but in
which the preservation of a committed transmission server is not real. Different
IOT services exist but tend to need payment for some of their functionality and
are as a result not open source. With the emergence and popularity of cloud
computing and IoT, the further development of industries is moving towards
cloud-based solutions in automation and control systems. New research in
industries has primarily gone into the direction of supervision, monitoring and
high-level control which is a natural path since the higher levels have less
constraints than the lower ones. Most of the existing works draw their ideas
from the service-oriented architecture (SOA) or web-based architecture (WOA)
concepts. This means that the automation functions are provided as services on
the cloud. The users then have easy access to all the different functionalities of
the system without any requirement for specialized hardware, such as HMI.
There are some solutions emerging for the L2 level as well, but very little is
done so far for L1. The problem here lies in the fact that the constraints,
especially the real-time requirements, get harder in the lower layers. This is a
problem because using an internet connection introduces unpredictability into
these systems that require predictability. Many solutions propose a local cloud
to minimize this problem and some are able to offer soft-real time guarantees.
Currently, some of the existing applications for cloud-based automation are as
follows.
 Monitoring and SCADA systems - Most commonly the system is a
user-based application that enables the operators to access the plant
and monitor it remotely form a mobile device. Different access is
provided based on user privilege.
18
 Analytics - Large systems with many devices produce a lot of
information which is useful for fault detecting analysis. Some
solutions use clouds for storage and analyses big chunks of data
later (batch computing) while others analyses it as it comes,
without storing it first (stream computing).
 Management at different levels - Most dominant is the idea of
Cloud Manufacturing, a new and advanced computing and service-
oriented manufacturing model.
 Storage - Clouds can be used for storing data that might not need
frequent use but needs to be archived, like different kinds of
documents or logs and historical data from processes and devices.
 Collaboration - Using cloud computing for collaboration in the
development of automated systems is beneficial, especially when
remote teams need to work on its development.

Figure 3.5 IoT(Internet of things)

3.3.3.3 BENEFITS OF IoT

19
Since IoT allows devices to be controlled remotely across the internet,
thus it created opportunities to directly connect & integrate the physical world
to the computer-based systems using sensors and internet. The interconnection
of these multiple embedded devices will be resulting in automation in nearly all
fields and also enabling advanced applications. This is resulting in improved
accuracy, efficiency and economic benefit with reduced human intervention. It
encompasses technologies such as smart grids, smart homes, intelligent
transportation and smart cities. The major benefits of IoT are:
 Improved Customer Engagement – IoT improves customer
experience by automating the action. For e.g. any issue in the car
will be automatically detected by the sensors. The driver, as well as
the manufacturer, will be notified about it. Till the time driver
reaches the service station, the manufacturer will make sure that
the faulty part is available at the service station.
 Technical Optimization – IoT has helped a lot in improving
technologies and making them better. The manufacturer can collect
data from different car sensors and analyze them to improve their
design and make them much more efficient.
 Reduced Waste – Our current insights are superficial, but IoT
provides real-time information leading to effective decision making
& management of resources. For example, if a manufacturer finds
fault in multiple engines, he can track the manufacturing plant of
those engines and can rectify the issue with manufacturing belt.

Nowadays, we are surrounded by lots of IoT enabled devices which are


continuously emitting data and communicating through multiple devices.
Moving ahead, let’s discuss the required hardware for building an IoT
application. We will also look at the IoT devices which we are using in our day
to day life.

20
3.3.3.4 IoT HARDWARE

Now you would be wondering what is the required hardware for


preparing an IoT solution. The answer to this question is, you’ll first require
sensors that will sense the environment, then you require a remote dashboard to
monitor your output and display it in a clearer & conceivable form. At last, you
will require a device with the capability of serving & routing. The key task of
the system would be detecting specific conditions and taking actions
accordingly. One thing to keep in mind is securing the communication between
the devices and the dashboard.
Some of the common sensors that you are surrounded by are accelerometers,
temperature sensors, magnetometers, proximity sensors, gyroscopes, image
sensors, acoustic sensors, light sensors, pressure sensors, gas RFID sensors,
humidity sensors & micro flow sensors.
Nowadays we also have many wearable devices like smartwatches, shoes & 3D
glasses. This is the best example of a smart solution. 3D glasses adjust
television’s brightness and contrast according to your eye and your
smartwatches keeps track of your daily activities and fitness.
But I feel the most important device which has tremendously contributed to IoT
are the cell phones. Mobile apps have immensely contributed to revolutionizing
the technology world. Cell phones are already encased with applications and
sensors that reveals lots of information about its user. It has Geo-location
information, it can sense and trace light condition, the orientation of your device
and a lot more information. It also comes with multiple connectivity options
like Wi-Fi, Bluetooth and cellular that helps them to communicate with other
devices. Thus, due to these default qualities of cell phones, it is the core of the

21
IoT ecosystem. Today, Smartphone can interact with smart watch and fitness
band to further ease and enhance the user experience.
IoT uses multiple technologies and protocols to communicate with devices
based on the requirements. The major technologies & protocols are Bluetooth,
wireless, NFC, RFID, radio protocols and WiFi -Direct.
IoT applications are flourishing across all industries & market. The IoT has a
multitude of expansion over various industries. It spans over all groups of users,
from those who are trying to reduce & conserve energy in their home to large
organizations who want to improve their business operations. IoT has not only
proved itself useful in optimizing critical applications in many organization , but
also have boosted the concept of advanced automation which we have imagined
a decade before. Let’s understand the capabilities of IoT across different
industries and look how they are revolutionizing them.

Figure 3.6.Node MCU

3.3.4 LCD DISPLAY

22
LCD is a type of display used in digital watches and many portable
computers. LCD displays utilize to sheets of polarizing material with a liquid
crystal solution between them. An electric current passed through the liquid
causes the crystals to align so that light cannot pass through them. LCD
technology has advanced very rapidly since its initial inception over a decade
ago for use in lap top computers. Technical achievements has resulted in
brighter displace, higher resolutions, reduce response times and cheaper
manufacturing process.

The liquid crystals can be manipulated through an applied electric voltage so


that light is allowed to pass or is blocked. By carefully controlling where and
what wavelength (color) of light is allowed to pass, the LCD monitor is able to
display images. A backlight provides LCD monitor’s brightness. Over the years
many improvements have been made to LCD to help enhance resolution, image,
sharpness and response times. One of the latest such advancement is applied to
glass during acts as switch allowing control of light at the pixel level, greatly
improving LCD’s ability to display small-sized fonts and image clearly.
Other advances have allowed LCD’s to greatly reduce liquid crystal cell
response times. Response time is basically the amount of time it takes for a
pixel to “change colors”, in reality response time is the amount of time it takes a
liquid crystal cell to go from being active to inactive.
This is due to following reasons: The declining prices of LCDs.
The ability to display numbers, characters and graphics. This is in contrast to
LEDs, which are limited to numbers and a few characters.
An intelligent LCD display of two lines, 20 characters per line that is interfaced
to the pic16f72 microcontroller.
Incorporation of a refreshing controller into the LCD, thereby relieving the CPU
to keep displaying the data. Ease of programming for characters and graphics.

23
Most of the LCD modules conform to a standard interface specification. A 14-
pin access is provided having eight data lines, three control lines and three
power lines. The connections are laid out in one of the two common
configurations, either two rows of seven pins, or a single row of 14 pins.
One of these pins is numbered on the LCD’s printed circuit board (PCB), but if
not, it is quite easy to locate pin1. Since this pin is connected to ground, it often
has a thicker PCB track, connected to it, and it is generally connected to metal
work at same point.

3.3.4.1 PIN DIAGRAM AND DESCRIPTION

Figure 3.7. Pin Diagram

Vcc, Vss and Vee: -

While Vcc and Vss provide +5V and ground respectively, Vee is used for
controlling LCD contrast.

RS Register Select: -

There are two very important registers inside the LCD. The RS pin is used
for their selection as follows. If RS=0, the instruction command code
register is selected, allowing the user to send a command such as clear

24
display, cursor at home, etc. If RS=1, the data register is selected, allowing
the user to send data to be displayed on the LCD.

R/W, read/write: -

R/W input allows the user to write information to the LCD or read
information from it.

R/W = 1 for
reading. R/W= 0 for
writing.
EN, enable: -

The LCD to latch information presented to its data pins uses the enable
pin. When data is supplied to data pins, a high–to- low pulse must be
applied to this pin in order for the LCD to latch in the data present at the
data pins. This pulse must be a minimum of 450 ns wide.

D0 – D7: -

The 8–bit data pins, DO – D7, are used to send information to the LCD or
read the contents of the LCD’s internal registers. To display letters and
numbers, we send ASCII codes for the letters A–Z, a-z numbers 0-9 to
these pins while making RS=1.There are also instruction command codes
that can be sent to the LCD to clear the display or force the cursor to home
position or blink the instruction command codes. We also use RS = 0 to
check the busy flag bit to see if the LCD is ready to receive information.
The busy flag is D7 and can be read when R/W=1 and RS=0, as follows: if
R/W = 1, RS = 0. When D7= 1 (busy flag = 1), the LCD is busy taking
care of internal operations and will not accept any information.

25
3.4 BLOCK DIAGRAM

According to block diagram, it is a smart dustbin which consists of


PIC microcontroller, Node MCU, Ultrasonic sensor, IR sensor,
servomotor, buzzer and battery. In this two Ultrasonic sensors are used.
One is used to monitor the person coming near to dustbin to throw trash .
If any person is detected the controller send signal to the motor and the
dustbin lid opens . Next sensor is used to monitor the level of the trash
filled inside the dustbin . And the IR sensors are used to monitor the
trash around the dustbin. If any trash is detected the buzzer will give
the beep sound. And this dustbin is operated through power supply.

Figure 3.8. Block Diagram

3.5 CONCLUSION

26
Thus the project is designed using the above components. This Smart
Dustbin can contribute a lot towards clean and hygienic environment in building
a smart city. But since the technology is new in India, proper awareness should
be created among the public before it is implemented on a large scale.
Otherwise, sensitive devices like sensors might be damaged due to rough action
of the users.

27

You might also like