You are on page 1of 50

INDIVIDUAL ASSIGNMENT

TECHNOLOGY PARK MALAYSIA

EE034-4-2-SNA
SENSORS AND ACTUATORS
Building Management Systems (BMS)
APU2F2002EEE-ME

LECTURER: Dr. Venkatratnam Chitturi


WEIGHTAGE: 30%

NAME: SULAIMAN AZZAN (TP054785)


HAND OUT DATE: 20 AUGUST 2020
HAND IN DATE:20 SEPTEMBER 2020
APU2F2002EEE-ME TP054785
TABLE OF CONTENTS

INTRODUCTION..................................................................................................................................................1

APPLICATION OF FUNDAMENTAL ENGINEERING AND DESIGN CONSIDERATION....................4

ILLUSTRATION OF THE HARDWARE WITH INNOVATION................................................................11

DISPLAY OF LABVIEW PROGRAM AND RESULTS................................................................................23

DISCUSSION.......................................................................................................................................................36

CONCLUSIONS..................................................................................................................................................38

REFERENCES.....................................................................................................................................................39

APPENDIX...........................................................................................................................................................41

ii
APU2F2002EEE-ME TP054785
LIST OF FIGURES

Figure 1: (OpenData Smart Building Asset Performance Management, 2020).........................1


Figure 2:(Smart waste bin, (Labs, 2020))..................................................................................2
Figure 3:(HC-SR04 circuit diagram, (Marian, 2015))...............................................................3
Figure 4:(ULTRASONIC Sensor,( HC-SR04, 2020))...............................................................4
Figure 5:(Trigger/Echo Pulse, ( HC-SR04, 2020))....................................................................5
Figure 6:(HC-SR04 distance vs time, (Pilling, 2019))..............................................................6
Figure 7:(Block diagram)...........................................................................................................7
Figure 8:(The working equation of Ultrasonic sensor)..............................................................8
Figure 9:(The expected Graph by using LabView)....................................................................9
Figure 10:(Ultrasonic graph by using excel)............................................................................10
Figure 11:(Flowchart of the system)........................................................................................11
Figure 12:(Circuit diagram of the system)...............................................................................12
Figure 13:(Schematic diagram of the system).........................................................................13
Figure 14:(Circuit diagram by using Fritzing).........................................................................14
Figure 15:(Code 1)...................................................................................................................14
Figure 16:( Code 2)..................................................................................................................15
Figure 17:( Code 3)..................................................................................................................15
Figure 18:( Code 4)..................................................................................................................16
Figure 19:(Prototype design)....................................................................................................18
Figure 20:(The components used in the system)......................................................................19
Figure 21:(30 Paper balls used in the experiment)...................................................................20
Figure 22:(Prototype testing 1)................................................................................................20
Figure 23:( Prototype testing 2)...............................................................................................21
Figure 24:( Prototype testing 3)...............................................................................................21
Figure 25:( Prototype testing 4)...............................................................................................22
Figure 26:( Prototype testing 5)...............................................................................................22
Figure 27:(Block diagram of the system in LabView).............................................................23
Figure 28:(Real time garbage can A While Loop)...................................................................24
Figure 29:( Simulated arbage can B While Loop)...................................................................25
Figure 30:(Date and time While Loop)....................................................................................25
Figure 31:(Block diagram for measurment purposes).............................................................26
Figure 32:(Front panel of the system)......................................................................................27
Figure 33:(Prototype graph).....................................................................................................30

iii
APU2F2002EEE-ME TP054785
Figure 34:(Stored readings in Excel).......................................................................................30
Figure 35:(Front panel results 1)..............................................................................................31
Figure 36:(Front panel results 2)..............................................................................................32
Figure 37:(Front panel results 3)..............................................................................................33
Figure 38:(Front panel results 4)..............................................................................................34
Figure 39:(Front panel results 5)..............................................................................................35
Figure 40:(Half full/Half empty issue).....................................................................................37
Figure 41: (HC-SR04 Datasheet, (elecfreak,2020)).................................................................41

iv
APU2F2002EEE-ME TP054785
LIST OF TABLES

Table 1:( HC-SR04 Ultrasonic Sensor technical specifications,(elecfreak,2020))....................3


Table 2:(Tabulated simulation results).......................................................................................9
Table 3:(Tabulated reading results).........................................................................................28

v
APU2F2002EEE-ME TP054785

INTRODUCTION

Figure 1: (OpenData Smart Building Asset Performance Management, 2020)

Building Management System (BMS) is needed for large areas and large number of
floors in modern buildings, which makes it difficult to monitor all spaces and floors. BMS is
also needed because there are a large number of electrical and mechanical equipment in one
building, including air conditioning, lighting, elevators, and generators, which makes it
difficult to operate, maintain, and monitor the performance of these equipment and to know
whether these equipment are in a working or malfunctioning state or if they perform the
functions which is assigned to them in proportion to the energy spent on operating this
equipment. Furthermore, BMS can also Increase the investors profits for commercial and
industrial buildings by reducing the operating costs of these buildings. From here it comes to
light the need for building management systems.

For example, it can decide when is the appropriate time for lighting work, the right
time to make air conditioning or heating, the appropriate time for the temperature to be 24
degrees and the time for the temperature to be 20 degrees, the time in which a device
malfunction occurred inside the building.

1
APU2F2002EEE-ME TP054785

And also, it can decide where the place that needs lighting, the place that needs air
conditioning or heating, the place where a device malfunctions. (Smith, 2020)

Figure 2:(Smart waste bin, (Labs, 2020))

On a daily basis, we see in large organizations that the garbage bins are full or some
garbage that distorts the surrounding environment, and causes the spread of unpleasant odors,
bacteria and harmful gases, and this in turn leads to the spread of diseases and epidemics,
hence the idea of creating a smart garbage monitoring system in order to eliminate this
problem or reduce it as much as possible.

Through the studies of the causes of this problem, It is found that when garbage
collector pass through the areas in a building according to a schedule for garbage collection,
sometimes some garbage bins are not full, and therefore there is no need to empty them, but
the employee in charge of garbage collection does not know this, and this leads to waste of
efforts and loss of time, so this project is developing a model for a system that works to alert
the main office that the garbage bin is full. This is done by placing Ultrasonic sensors in the
garbage bin to monitor the garbage status, and according to the messages issued from these
sensors, the main office sends a notification of the garbage location to the garbage collector,
to go to the garbage place. (author, 2020)

2
APU2F2002EEE-ME TP054785

Figure 3:(HC-SR04 circuit diagram, (Marian, 2015))

Ultrasonic HC-SR04-Sensor is a very common sensor that is found in many


applications where distance measurement and detection of objects are required. The HC-
SR04 Ultrasonic sensor uses sonar to determine the distance to something like bats or
dolphins. This Ultrasonic Sensor Module is a transmitter, receiver and controller circuit in
one piece as shown in figure 3 above. It has a very useful and compact build. Provides
excellent range accuracy and stable readout in an easy-to-use sensor. Its operation is
unaffected by sunlight or black materials (although acoustic materials such as fabric are
difficult to detect).

Table 1:( HC-SR04 Ultrasonic Sensor technical specifications,(elecfreak,2020))

Working Voltage DC 5 V
Working Current 15mA
Working Frequency 40Hz
Max Range 400cm
Min Range 2cm
Measuring Angle 15 degree
Trigger Input Signal 10uS TTL pulse
Echo Output Signal Input TTL lever signal and the range in
proportion
Dimension 45*20*15mm

3
APU2F2002EEE-ME TP054785

APPLICATION OF FUNDAMENTAL ENGINEERING AND DESIGN


CONSIDERATION

Figure 4:(ULTRASONIC Sensor,( HC-SR04, 2020))

Trigger and Echo are the I / O pins of this sensor, thus they can be connected to the I /
O pins of the Arduino microcontroller. When the receiver detects the return wave, the Echo
pin will go high for a certain period of time which will be equal to the time it takes for the
wave to return to the sensor. Ultrasonic HC-SR04 offers distance sensing capabilities from
2cm to 400cm, and accuracy ranging from 3mm. (Pilling, 2019)

The figure 5 below basically shows the HC_SR04 sensor and how the ultrasonic
works. For the working principles of the ultrasonic when the sound waves are sent through
the Trig port, and after the waves collide with the object, they are reflected and received
through the Echo port, and through the time between the waves being sent and the time they
are received, the distance is calculated.

4
APU2F2002EEE-ME TP054785

5
APU2F2002EEE-ME TP054785

Figure 5:(Trigger/Echo Pulse, ( HC-SR04, 2020))

To calculate the distance, we use the following mathematical equation:

Distance=time∗speed …………….. (Equation 1)

Where the speed is constant and the speed of sound is 340 meters per second, but in this
assignment the signal is calculated in centimeter, so the speed of sound will be equal to
0.0340 centimeter, but it is noticed that the sensor will send and receive a signal and this
allows the distance value to be doubled so we need to divide it by 2 to make the equation in
the final form as shown below in equation 2. (PC Services - Circuit Ultrasonic Range
Sensing, 2018)

time
Distance= ∗speed …………….. (Equation 2)
2

6
APU2F2002EEE-ME TP054785

The working equation for HC-SR04 Ultrasonic sensor is shown above in equation 2 which it
has been tested based to the data sheet and simulated by using LabView software. The
expected graph of the ULTRASONIC characteristic will be a linear line as shown in figure 6
below. Because time and distance have a proportional relationship to each other since
whenever the distance increases the time will increase. Also, this relationship is shown from
the equations above.

t ∝ s ………….. (Equation 3)

The most important applications of Ultrasonic sensor are found in submarines and radars,
collision avoidance robots.

Figure 6:(HC-SR04 distance vs time, (Pilling, 2019))

The design of ultrasonic signal simulated system by using LabVIEW software is shown in
figure 7 below. By using LabView the time values were simulated by using the Random

7
APU2F2002EEE-ME TP054785

Number function. And then the random number was multiplied by 23500 which it is the
maximum time taken range (For 400cm) for a signal for this sensor in microseconds, the
following mathematical equation shows how it was calculated:

400∗2 400∗2
Time= = =23529 μs …………….. (Equation 4)
speed of sound 0.034

Since the range of the HC-SR04 sensor is from 2cm to 400cm, the time values which are
equal or less than 2cm was ignored to get only the distance range from 2cm to 400cm. Which
it is calculated to be 117.65 microseconds by using equation 5 below.

2∗2 2∗2
Time= = =117.65 μs …………….. (Equation 5)
speed of sound 0.034

Figure 7:(Block diagram)

8
APU2F2002EEE-ME TP054785

As can be seen from figure 7 above an Array Size function was placed and connected to the
N terminal of the For loop. And a Search 1D Array function was used to look for the zero
values from the case structure. And after that a Delete From Array function was placed to
delete the 0 values, so it won’t appear in the final array. Lastly, a Sort 1D Array function was
used to arrange the array in ascending order. These steps were done twice. One for the
Distance values and one for Time Taken values. Two Arrays was placed to store the data of
Distance and Time Taken.
The following figure 8 shows the ultrasonic sensor formula:

Figure 8:(The working equation of Ultrasonic sensor)

9
APU2F2002EEE-ME TP054785

Figure 9:(The expected Graph by using LabView)

Tabulated data of simulation results from LabView:


Table 2:(Tabulated simulation results)

No. Time (µs) Distance (cm)


1 2707.56 46.0286
2 2920.92 49.6556
3 3366.4 57.2288
4 3638.78 61.8592
5 3682.77 62.6071
6 5728.1 97.3777
7 6965.24 118.409
8 6983.49 118.719
9 7898.72 134.278
10 10177 173.01
11 10214.7 173.65
12 10678.1 181.527
13 10742.7 182.626
14 11953.8 203.215

10
APU2F2002EEE-ME TP054785

15 13518.7 229.818
16 14610.2 248.373
17 14628.6 248.686
18 14789.2 251.416
19 15093 256.581
20 18233.1 309.963
21 18410.6 312.98
22 18458.7 313.797
23 18530.4 315.017
24 21110.7 358.882
25 21380.6 363.471
26 21703.1 368.952
27 22661.6 385.247
28 22693.6 385.791
29 22800.9 387.616
30 22980.8 390.673

25000

20000

15000
Time (µs)

10000

5000

0
6 8 1 9 8 5 6 8 6 1 8 7 1 7 6
28 228 607 40 27 .6 62 81 68 58 .9 01 47 24 61
6.0 7. 2. 18. 34. 173 82. 29. 48. 56. 312 15. 63. 85. 87.
4 5 6 1 1 1 2 2 2 3 3 3 3

Distance (cm)

Figure 10:(Ultrasonic graph by using excel)

The figure 10 above demonstrates the Ultrasonic sensor graph by using the simulation with
formula from the data sheet.

11
APU2F2002EEE-ME TP054785

ILLUSTRATION OF THE HARDWARE WITH INNOVATION

The flow of this smart garbage monitoring system is as follows:


1. The ULTRASONIC sensor is going to detect the trash level on the garbage can.
2. The Arduino is going to receive a digital readings from the ULTRASONIC sensor.
3. The Arduino is going to check and manage what to do depends on the readings.
4. The Arduino then is going to generate a digital signal to operate the actuators.
5. The LabView software will get the data from the Arduino and display it in the Front
Panel.
6. For the LED actuator, by the Arduino board an electrical current will be sent to the
pin which is connected to a LED to control the blinking state ON/OFF.
7. For the Lock actuator, by the Arduino board an electrical current will be sent to the
pin which is connected to a motor to lock or unlock the can.

12
APU2F2002EEE-ME TP054785

Figure 11:(Flowchart of the system)

13
APU2F2002EEE-ME TP054785

Figure 12:(Circuit diagram of the system)

As shown from the circuit diagram of the system in figure 12 above the material used in the
hardware of this system is as follows:

1. Computer / Laptop.
2. Microcontroller (Arduino uno).
3. USB cable to connect Arduino to the computer.
4. ULTRASONIC distance sensor HC-SR04.
5. Red LED.
6. 220Ω resistor.
7. Female to Female jumper wires.
8. Male to Male jumper wires.

The schematic diagram of the system is as shown in figure 13 below:

14
APU2F2002EEE-ME TP054785

Figure 13:(Schematic diagram of the system)

15
APU2F2002EEE-ME TP054785

The Hardware wiring of the system is as shown in figure 14 below:

Figure 14:(Circuit diagram by using Fritzing)

The Arduino codes of the system is as follows:

Figure 15:(Code 1)

The Ultrasonic sensor was connected to the Arduino as shown in the hardware connections.
The code shown above in figure 15 is used to define for the Arduino that pin 4 is connected

16
APU2F2002EEE-ME TP054785

to the Trigger and pin 2 is connected to the Echo port. Also, the constant MAX_DIST is used
to define that the maximum length of the garbage can is 20 cm (20*58 = 1160 µS pulse).

Figure 16:( Code 2)

The code in Figure 16 above is used for the Trigger pin to tell the sensor to range-find. The
code Serial.begin(9600) is used to set the serial monitor to view the sensor output.

Figure 17:( Code 3)

17
APU2F2002EEE-ME TP054785

The code in Figure 17 above is used to hold the Trigger pin for 10 microseconds and for the
Echo pin to wait for the reflected pulse. For the equation which includes the constants t1 and
t2 is to measure how long the Echo pin was held high (pulse width). Finally, for the cm
equation is to calculate the distance in centimeters as shown from the following mathematical
equations:

echo pulse width(μS )


Distance ( cm )= ……………..(Equation 6)
58

echo pulse width( μS)


Distance ( inch ) = ……………..(Equation 7)
148

Figure 18:( Code 4)

18
APU2F2002EEE-ME TP054785

In figure 18 above an equation was set to minus the measured distance from 20 cm because in
this case if there is no trash in the can the distance measured will be maximum (20cm) which
wanted to be displayed as ZERO which means it is empty as shown from the following
mathematical equations:

Trash Level=20−measued distance ……………..(Equation 8)

Trash Level=20−20=0 ……………..(Equation 9)

When printing out the results an IF Statement was used. First statement in any case
the measured distance is out of range (higher than 20cm even if the distance is limited to
20cm only but sometimes the Ultrasonic gives false readings) the printed result will be
ZERO, so we don’t get a negative value from equation 9 above. Second statement is basically
to print any readings passes the first condition.

Furthermore, another IF Statement was used to control LED blinking state ON or


OFF. First statement is when the trash level is higher or equal 14cm the LED will be turned
ON by using the code digitalWrite(13,1). Second statement is if the trash level is lower than
14cm the LED will be turned OFF by using the code digitalWrite(13,0).

NOTE:

1. 13 means the pin number 13.


2. 0 and 1 is considered as LOW and HIGH.

Finally, a delay code was set to delay 200 microseconds before the next measurement.

19
APU2F2002EEE-ME TP054785

Demonstration of the hardware system is as follows:

Figure 19:(Prototype design)

The idea of creating a smart garbage monitoring system has come in order to reduce
or even eliminate the garbage can that distorts the surrounding environment and causes the
spread of bacteria and harmful gases and leads to spread of diseases and epidemics. By
detecting the trash level in the garbage can which is done by using ultrasonic sensor
whenever the garbage bins are full or not full the management or the garbage collector will
get notifications about the trash status whether if there is need to empty them or no need and
according to the messages issued from these sensors, the main office sends a notification of
the garbage location to the garbage collector, to go to the garbage place. This leads to save
efforts and time as well, so basically this project is developing a model for a system that
works to alert the main office that the garbage bin is full and lock up the garbage can.

20
APU2F2002EEE-ME TP054785

Figure 20:(The components used in this system)

To simulate the trash level and to test the performance of the system a paper balls
were used to provide a constant rising level by each ball. Consequently, the readings obtained
from this experiment were more reliable.

Figure 21 below shows the paper balls used in the system to simulate the trash level.
Thirty paper balls were thrown into the bin one by one and the readings of each throw were
stored in excel software by LabView. This thirty balls experiment was done twice to get an
accurate and precise reading results.

A red LED was used in the system as an actuator so whenever the trash level is
maximum the red LED will be turned ON. This was implemented so other people in the
building will know that the garbage can is full. The LED was connected in series with 220-
ohm resistor since the LED cannot survive the power supply voltage directly which it is 5
volts.

21
APU2F2002EEE-ME TP054785

Figure 21:(30 Paper balls used in the experiment)

Figure 22:(Prototype testing 1)

22
APU2F2002EEE-ME TP054785

Below are some pictures of the prototype designed while taking the readings:

Figure 23:( Prototype testing 2)

Figure 24:( Prototype testing 3)

23
APU2F2002EEE-ME TP054785

Figure 25:( Prototype testing 4)

Figure 26:( Prototype testing 5)

24
APU2F2002EEE-ME TP054785

DISPLAY OF LABVIEW PROGRAM AND RESULTS

Figure 27:(Block diagram of the system in LabView)

Figure 27 above demonstrates the LabView front panel of the system and as can been
seen it is designed to do the needed process of the system in a simple an efficient way
(Simplicity is the ultimate sophistication).

Three While Loop functions were used in the system each one has its own specific
timing and they cannot be merged together. The larger Loop is used for the main system with
Visa tools and functions and it is implemented to the prototype designed for real time
readings by using the Ultrasonic sensor ( Garbage can A) . Second Loop is for simulating the
other can (Garbage can B) by using a Random Number function for the trash level with a

25
APU2F2002EEE-ME TP054785

Time Delay function by 5 seconds. Lastly, the smallest While Loop basically was designed to
show the exact real time and date with Wait timer function by 100 milliseconds.

Figure 28:(Real time garbage can A While Loop)

Figure 28 above demonstrates the block diagram of this system in LabView which it
is designed to get the readings from the Arduino software since we didn’t have the ability to
get a DAQ device to collect the readings from the HC-SR04 sensor.

Firstly, the main While loop shown above is implemented for real time Garbage can
A, where a VISA Clear function was used to clear the input and output buffers of the device
and VISA Open and VISA Read functions were used to collect the information from the
Arduino. The data will be collected as a string values because of this a String To Number
converter function was used to display the numbers in a Numeric Indicator. The Numeric
Indicator was replaced with a tank to give simulations as it really happening.

26
APU2F2002EEE-ME TP054785

Lastly, a Boolean LED was added and set to be ON whenever the trash level is equal
or higher than 14 centimeters. Boolean LED state is connected with a case structure to easily
display the locker state.

Figure 29:( Simulated arbage can B While Loop)

Figure 29 above demonstrates the default simulations for Garbage can B. The trash
level is simulated by using Random Number function and then it was multiplied by 20 to
produce a number from 0 – 20 centimeters (Maximum level for trash is 20cm). Then a
Boolean LED is placed and controlled with a comparison condition. Stated to be turned ON
whenever the trash level is equal or higher than 14 centimeters. A case structure is basically
used to display the locker state.

Figure 30:(Date and time While Loop)

27
APU2F2002EEE-ME TP054785

Figure 30 above demonstrates the smallest while loop. This loop is used to get the real
time and date and display them in a string indicators as a decoration. This was done by
placing Get Time/Date String function and connected to two constant string indicators. A
True/False Boolean function is placed and connected to display the seconds for the time if
needed (True with seconds/False without seconds).

Figure 31:(Block diagram for measurment purposes)

Figure 31 above demonstrates the main system with some modifications. This
different system is designed to only store the readings in an Array function to plot the Graph.
This process was done by placing a Bundle function connected with an Array function to
store the data. Shift Registers were used for the indexing tunnel with the While Loop.

28
APU2F2002EEE-ME TP054785

Figure 32 below shows the LabView front panel of the system designed.

Figure 32:(Front panel of the system)

29
APU2F2002EEE-ME TP054785

The measurements of the prototype results were tabulated as follows:

Table 3:(Tabulated reading results)

No. No. of Paper balls Trash level (cm) Locker state LED state
1 0 0 Unlocked OFF
2 0 0 Unlocked OFF
3 1 0 Unlocked OFF
4 2 0 Unlocked OFF
5 2 0 Unlocked OFF
6 3 0.28 Unlocked OFF
7 4 0.21 Unlocked OFF
8 4 0.28 Unlocked OFF
9 5 2.83 Unlocked OFF
10 5 2.83 Unlocked OFF
11 6 3.21 Unlocked OFF
12 6 3.21 Unlocked OFF
13 6 3.32 Unlocked OFF
14 7 9.03 Unlocked OFF
15 7 9.03 Unlocked OFF
16 8 8.21 Unlocked OFF
17 8 8.26 Unlocked OFF
18 8 8.26 Unlocked OFF
19 9 7.66 Unlocked OFF
20 9 7.66 Unlocked OFF
21 10 7 Unlocked OFF
22 11 7.52 Unlocked OFF
23 11 7.59 Unlocked OFF
24 11 7.59 Unlocked OFF
25 12 9.24 Unlocked OFF
26 12 9.24 Unlocked OFF
27 12 12 Unlocked OFF
28 13 13.24 Unlocked OFF

30
APU2F2002EEE-ME TP054785

29 13 13.31 Unlocked OFF


30 13 13.31 Unlocked OFF
31 14 13.24 Unlocked OFF
32 14 13.31 Unlocked OFF
33 15 13.66 Unlocked OFF
34 15 13.66 Unlocked OFF
35 16 15.44 Locked ON
36 16 15.52 Locked ON
37 17 15.86 Locked ON
38 17 15.86 Locked ON
39 17 15.86 Locked ON
40 18 15.79 Locked ON
41 18 15.79 Locked ON
42 19 15.5 Locked ON
43 19 15.6 Locked ON
44 19 15.63 Locked ON
45 20 15.9 Locked ON
46 20 15.93 Locked ON
47 20 15.93 Locked ON
48 21 16.14 Locked ON
49 22 16.14 Locked ON
50 23 15.31 Locked ON
51 24 15.24 Locked ON
52 25 15.24 Locked ON
53 26 18.2 Locked ON
54 27 18.6 Locked ON
55 28 19.1 Locked ON
56 29 19.1 Locked ON
57 30 19.7 Locked ON

31
APU2F2002EEE-ME TP054785

Graphs

Figure 33:(Prototype graph)

In figure 33 above the small line demonstrates the expected graph.

Figure 34:(Stored readings in Excel)

32
APU2F2002EEE-ME TP054785

The figures below outline some results of the LabView front panel of the system designed.

Figure 35:(Front panel results 1)

33
APU2F2002EEE-ME TP054785

Figure 36:(Front panel results 2)

34
APU2F2002EEE-ME TP054785

Figure 37:(Front panel results 3)

35
APU2F2002EEE-ME TP054785

Figure 38:(Front panel results 4)

36
APU2F2002EEE-ME TP054785

Figure 39:(Front panel results 5)

37
APU2F2002EEE-ME TP054785

DISCUSSION

In this system a HC-SR04 Ultrasonic sensor is used as a main element to sense and
detect the trash level, basically by sending a high-frequency waves which collides with an
object and then bounce back in an echo form. One important foundation thing in dealing with
this type of sensors is the need to know the speed of these waves and the difference between
the transmission time and the return time of these waves.

An interesting observation from this experiment that ultrasonic sensor cannot detect
how many individual objects. It can only state how long it took the sound waves sent out to
bounce back. It will only measure the closest object.

In addition, based on confirming the information provided with the working principles
from the data sheet, the graph in figure 1 demonstrates the linear relationship between
distance and time. When distance between the sensor and an object increases the time needed
for the waves sent to bounce back will increase. This directly confirms the operating
principles of this HC-SR04 ultrasonic sensor. And these foundations are a recall of Newton's
law:

Distance=time∗speed …………….. (Equation 10)

One of the issues were faced during conducting this system is shown in figure 33. The
graph shows several points having a deviation because the number of paper balls thrown in
the bin has increased but the trash level did not increase and even at some point has
decreased, this is because the sensor measuring angle is 10 -15 degrees (ultrasonic
specifications shown in table 1), so basically the sensor sends out waves in a cone shape, so
only the balls within the cone will bounce back the waves and it will be detected. As a rule,
this issue will increase occasionally when covering larger bins.

38
APU2F2002EEE-ME TP054785

Figure 40:(Half full/Half empty issue)

One of the recommendations to overcome this issue is to place more ultrasonic


sensors, since the larger the bin size the more ultrasonic needed. For example, in this
prototype two ultrasonic sensor will be enough to cover the whole bin.

For further improvement a locker should be added and used as an actuator to lock the
garbage can whenever the trash level is high. So, inconsiderate people cannot through the
trash recklessly this is to avoid distorting the surrounding environment, and the spreading of
unpleasant odors. Only one actuator was used in this prototype designed of this system to
prevent further complexity of the system flow.

39
APU2F2002EEE-ME TP054785

CONCLUSIONS

Briefly, to have a monitoring system in a building is necessary to control the


operations of the equipment and lighting within the building to reduce consumption in
resources and to make the most of the energy consumed, as it was found through the studies
that 40% of the consumed energy goes to waste without benefiting from it.

This waste monitoring system designed does not only monitor but also can control
and do actions, as in this system there are two actuators which are Locker and Red LED.
These two actuators operate as an indicators for the trash level on the garbage can.

In conclusion, it has been noticed that the results from this experiment are logical and
as expected with some minor errors and a recommendations to these errors were explained.
Altogether, through this assignment the characteristics of Ultrasonic sensor has been
understood, and the results were demonstrated by using LabView software and tabulated in
excel.

40
APU2F2002EEE-ME TP054785

REFERENCES

1. author:, M., 2020. Smart Garbage Monitoring System Using Internet Of Things
(IOT). [online] Instructables. Available at: <https://www.instructables.com/id/Smart-
Garbage-Monitoring-System-Using-Internet-of-/> [Accessed 3 September 2020].

2. Smith, A., 2020. [online] Melbourne.vic.gov.au. Available at:


<https://www.melbourne.vic.gov.au/SiteCollectionDocuments/bms-the-basics-
explained.pdf> [Accessed 3 September 2020].

3. Modius. 2020. Opendata Smart Building Asset Performance Management. [online]


Available at: <https://modius.com/smartbuildinganalytics/> [Accessed 3 September
2020].

4. Labs, E., 2020. Ecube Labs. [online] Ecubelabs.com. Available at:


<https://www.ecubelabs.com/ar/> [Accessed 4 September 2020].

5. Electronics Go. 2020. HC-SR04 - Electronics Go. [online] Available at:


<https://electronics-go.com/2019/03/01/hc-sr04/> [Accessed 4 September 2020].

6. Pilling, D., 2019. Making A Better HC-SR04 Echo Locator. [online] David Pilling's.
Available at: <https://www.davidpilling.com/wiki/index.php/HCSR04> [Accessed 11
September 2020].

7. Pcserviceselectronics.co.uk. 2018. PC Services - Circuit Ultrasonic Range Sensing.


[online] Available at:
<http://www.pcserviceselectronics.co.uk/arduino/Ultrasonic/electronics.php>
[Accessed 11 September 2020].

8. Instructables.com. 2020. Distance Measurement Using HC-SR04. [online] Available


at: <https://www.instructables.com/id/Distance-Measurement-Using-HC-SR04-Via-
NodeMCU/> [Accessed 11 September 2020].

41
APU2F2002EEE-ME TP054785

9. Marian, P., 2015. [online] ELECTRO SCHEMATICS. Available at:


<https://www.electroschematics.com/ultrasonic-sensor-circuit/> [Accessed 13
September 2020].

42
APU2F2002EEE-ME TP054785

APPENDIX

Figure 41: (HC-SR04 Datasheet, (elecfreak,2020))

LINK: https://www.electroschematics.com/wp-content/uploads/2013/07/HCSR04-datasheet-
version-1.pdf

43
APU2F2002EEE-ME TP054785

ARDUINO CODES:
const int TRIG_PIN = 4;
const int ECHO_PIN = 2;
const unsigned int MAX_DIST = 1624;
int data;

void setup() {
pinMode(TRIG_PIN, OUTPUT);
digitalWrite(TRIG_PIN, LOW);
pinMode(13,OUTPUT);
Serial.begin(9600);
}

void loop() {
unsigned long t1;
unsigned long t2;
unsigned long pulse_width;
float cm;

digitalWrite(TRIG_PIN, HIGH);
delayMicroseconds(10);
digitalWrite(TRIG_PIN, LOW);

while ( digitalRead(ECHO_PIN) == 0 );
t1 = micros();
while ( digitalRead(ECHO_PIN) == 1);
t2 = micros();
pulse_width = t2 - t1;
cm = pulse_width / 58.0;
cm = 28 - cm;

44
APU2F2002EEE-ME TP054785

if ( pulse_width > MAX_DIST )


{
Serial.println("0");
}

else
{
Serial.print(cm);
Serial.print("\n");

if (cm >= 16)


{
digitalWrite(13,1);
}

else
{
digitalWrite(13,0);
}
}

delay(200);
}

45

You might also like