Smart Dust Bin Using Ultrasonic Sensor
Smart Dust Bin Using Ultrasonic Sensor
Electronics Engineering
Submitted By
--------------------
--------------------
--------------------
This is to certify that the project work entitled “Smart Dust Bin Using Ultrasonic
Sensor ” is the work done by
_______________________________________________submitted in partial
fulfillment for the award of ‘Electronics Engineering from______________ College of
Engineering affiliated to _________ University, Hyderabad .
________________ ____________
External Examiner
ACKNOWLEDGEMENT
The satisfaction that accompany the successful completion of any task would be
incomplete without the mentioning of the people whose constant guidance and
encouragement made it possible. We take pleasure in presenting before you, our
project, which is result of studied blend of both research and knowledge.
Finally, I express my gratitude to all other members who are involved either
directly or indirectly for the successful completion of this project.
INDEX
Abstract
Introduction
Hardware Description
Software Description
Schematic Diagram
Coding
Conclusion
References
ABSTRACT
Software:
Arduino IDE
Proteus Simulator
Hardware:
Servo Motor
Ultrasonic
Sensor Atmega328
Module Computer (Serial
MCU (UNO)
Monitor)
HC-SR04
Regulated Power
Supply
Working Operation :
Dustbins (or Garbage bins, Trash Cans, whatever you call them) are small plastic (or
metal) containers that are used to store trash (or waste) on a temporary basis. They are
often used in homes, offices, streets, parks etc. to collect the waste. In some places,
littering is a serious offence and hence public waste containers are the only way to
dispose small waste. We are converting ordinary dust bins to smart dust bin with
technology. It is possible to know dust bin level in a real time if we send a data to IOT
platform. User can access same data from anywhere in the world. In this application, we
have implemented a motorized mechanism to control lid of a dust bin for user
convenience.
Arduino Platform
Arduino can sense the environment by receiving input from a variety of sensors
and can affect its surroundings by controlling lights, motors, and other actuators. The
microcontroller on the board is programmed using the Arduino programming language
(based on Wiring) and the Arduino development environment (based on Processing).
Arduino projects can be stand-alone or they can communicate with software running on
a computer. The hardware reference designs (CAD files) are available under an open-
source license; you are free to adapt them to your needs. The open-source Arduino
environment makes it easy to write code and upload it to the i/o board. It runs on
Windows, Mac OS X, and Linux. In addition to all the features of the previous board, the
Uno now uses an ATmega8U2 instead of the FTDI chip.
Arduino Hardware:
At a conceptual level, when using the Arduino software stack, all boards are
programmed over an RS-232 serial connection, but the way this is implemented varies
by hardware version. Serial Arduino boards contain a simple inverter circuit to convert
between RS-232-level and TTL-level signals. Current Arduino boards are programmed
via USB, implemented using USB-to-serial adapter chips such as the FTDI FT232.
Some variants, such as the Arduino Mini and the unofficial Board uno, use a
detachable USB-to-serial adapter board or cable, Bluetooth or other methods. (When
used with traditional microcontroller tools instead of the Arduino IDE, standard AVR ISP
programming is used.)
The ATmega328 is one kind of single-chip microcontroller formed with Atmel within
the megaAVR family.
Power Supply
The Arduino Uno power supply can be given with the help of a USB cable or an
external power supply. The external power supplies mainly include AC to DC adapter
otherwise a battery. The adapter can be connected to the Arduino Uno by plugging into
the power jack of the Arduino board. Similarly, the battery leads can be connected to
the Vin pin and the GND pin of the POWER connector. The suggested voltage range
will be 7 volts to 12 volts.
The 14 digital pins on the Arduino Uno can be used as input & output with the help of
the functions like pinMode(), digitalWrite(), & Digital Read().
Pin1 (TX) & Pin0 (RX) (Serial):
This pin is used to transmit & receive TTL serial data, and these are connected to the
ATmega8U2 USB to TTL Serial chip equivalent pins.
External pins can be connected to activate an interrupt over a low value, change in
value.
SPI Pins (Pin-10 (SS), Pin-11 (MOSI), Pin-12 (MISO), Pin-13 (SCK):
Pin-13(LED):
The inbuilt LED can be connected to pin-13 (digital pin). As the HIGH-value pin, the
light emitting diode is activated, whenever the pin is LOW.
Reset Pin:
Memory
Communication
The Arduino Uno ATmega328 offers UART TTL-serial communication, and it is
accessible on digital pins like TX (1) and RX (0). The software of an Arduino has a serial
monitor that permits easy data. There are two LEDs on the board like RX & TX which
will blink whenever data is being broadcasted through the USB.
A SoftwareSerial library permits for serial communication on Arduino Uno digital pins
and the ATmega328P supports TWI (I2C) as well as SPI-communication. The Arduino
software contains a wired library for simplifying the utilization of the I2C bus.
Arduino Uno can detect the surroundings from the input. Here the input is a
variety of sensors and these can affect its surroundings through controlling motors,
lights, other actuators, etc. The ATmega328 microcontroller on the Arduino board can
be programmed with the help of an Arduino programming language and the IDE
(Integrated Development Environment).
The 14 digital input/output pins can be used as input or output pins by using
pinMode(), digitalRead() and digitalWrite() functions in arduino programming. Each pin
operate at 5V and can provide or receive a maximum of 40mA current. Out of these 14
pins, some pins have specific functions as listed below:
Serial Pins 0 (Rx) and 1 (Tx): Rx and Tx pins are used to receive and transmit TTL
serial data. They are connected with the corresponding ATmega328P USB to TTL serial
chip.
External Interrupt Pins 2 and 3: These pins can be configured to trigger an interrupt
on a low value, a rising or falling edge, or a change in value.
PWM Pins 3, 5, 6, 9 and 11: These pins provide an 8-bit PWM output by using
analogWrite() function.
SPI Pins 10 (SS), 11 (MOSI), 12 (MISO) and 13 (SCK): These pins are used for SPI
communication.
In-built LED Pin 13: This pin is connected with an built-in LED, when pin 13 is HIGH –
LED is on and when pin 13 is LOW, its off.
Along with 14 Digital pins, there are 6 analog input pins, each of which provide 10 bits of
resolution, i.e. 1024 different values. They measure from 0 to 5 volts but this limit can be
increased by using AREF pin with analog Reference() function.
Analog pin 4 (SDA) and pin 5 (SCA) also used for TWI communication using Wire
library.
AREF: Used to provide reference voltage for analog inputs with analogReference()
function.
Reset Pin: Making this pin LOW, resets the microcontroller.
Arduino Communication
Once arduino IDE is installed on the computer, connect the board with computer using
USB cable. Now open the arduino IDE and choose the correct board by selecting
Tools>Boards>Arduino/Genuino Uno, and choose the correct Port by selecting
Tools>Port. Arduino Uno is programmed using Arduino programming language based
on Wiring. To get it started with Arduino Uno board and blink the built-in LED, load the
example code by selecting Files>Examples>Basics>Blink. Once the example code (also
shown below) is loaded into your IDE, click on the ‘upload’ button given on the top bar.
Once the upload is finished, you should see the Arduino’s built-in LED blinking.
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
}
Applications
We are using 12V, 5V Voltage Regulator board to provide supply for all the
peripherals. We are using 12V 1A/2A DC Adapter as input to the voltage regulator
board.
Schematic Explanation :
We need to give 12V AC/DC power supply input to the regulator board. There is
bridge rectifier using four diodes or we can use bridge rectifier package which converts
AC/DC into fluctuating dc Supply. It is then filtered using filter capacitor. 7812 voltage
regulator IC gives constant +12V output whereas 7805 regulator IC gives +5V output.
Power LED indicator shows power status of the circuit.s
HC-SR04 Ultrasonic Sensor
d = 340 *0.5 t
Working voltage 5V DC
High-accuracy 0.3cm
Size 45*20*15 mm
Weight 25gm
SERVO MOTOR
A Servo Motor is a small device that has an output shaft. This shaft can
be positioned to specific angular positions by sending the servo a coded
signal. As long as the coded signal exists on the input line, the servo will
maintain the angular position of the shaft. If the coded signal changes, the
angular position of the shaft changes. The control wire is used to specify the
angle. The angle is determined by the duration of a pulse that is applied to
the control wire. This is called Pulse Coded Modulation.
Software Description :
IDE stands for Integrated Development Environment. It is a text editor that lets you to
write, compile and upload code on to arduino. Every program file is called a sketch
and contains all the code that you write for your projects. Every file has an extension
of .ino. The code is written in basic c++ format and is human readable. So if the code
is written in the readable form, how does the machine understand it? Well, that is
precisely what the IDE is responsible for. The internal process of compilation
translates the code that you write to a format that the machine (microcontroller)
understands. It generates a Hex File.
We can install Arduino IDE software from arduino.cc website. It is open source
and you can install it for windows / linux operating system. We need to check our
computer configuration to select proper working software.
Arduino IDE environment is mainly distributed into three sections
1. Menu Bar
2. Text Editor
3. Output Window
As you download and open the IDE software, it will appear like an image below.
As you go to the preference section and check the compilation section, the Output Pane
will show the code compilation as you click the upload button.
Edit – Used for copying and pasting the code with further modification for font
Sketch – For compiling and programming
Tools – Mainly used for testing projects. The Programmer section in this panel is
used for burning a bootloader to the new microcontroller.
Help – In case you are feeling skeptical about software, complete help is available
from getting started to troubleshooting.
Variable declaration rules:
1. A variable name cannot have a space or special characters, except for underscore(_).
2. A variable name can be alphanumeric in nature
3. A variable name cannot start with a number. It would have to start with an alphabet
character or ‘_’
4. A variable name can contain uppercase and lowercase characters
5. You cannot use a keyword (example ‘int’,’void’ and so on) as a variable name
void setup()
{
//runs once
}
void loop()
{
//repeats
}
1. void setup()
2. void loop()
Syntax:
void setup ()
Statements;
2. void loop():
After creating a setup () function which initializes and sets the initial values, the loop ()
function does precisely what its name suggests, and loops consecutively, allowing your
program to change and respond. It is used to actively control the Arduino board.
Syntax:
void loop ()
Statements;
5. Check board port connection (it will be active when board is detected by computer
automatically)
6. Upload Code if it is compiled successfully
Schematic Diagram :
Schematic Description :
Trigger Pin of HC-SR04 is connected to Pin 2 and Echo Pin is connected to Pin 3.
Servo motor’s data pin is connected to Pin number 9 of the arduino. LED indicator is
connected to Pin 13 of microcontroller. Regulated 5V supply is given to all the
peripherals. 12V 1A dc adapter is used to provide power supply for all the units.
Coding :
#include <NewPing.h>
#include <Servo.h> //header file
Servo myservo; // create servo object to control a servo
int i;
#define TRIGGER_PIN 2
#define ECHO_PIN 3
#define MAX_DISTANCE 400
int LED=13;
for(i=180;i>=0;i--)
{
myservo.write(i); // sets the servo positionto specific value
delay(15);
}
digitalWrite(LED,LOW);
}
The proposed prototype model is designed and tested with all it’s features.
Ultrasonic Sensor used gives maximum detection range upto 4 meters (13 feet). It can
be thus useful in real time for any object distance purpose.
We can also use waterproof ultrasonic sensor for robust use in real time
application. We can provide internet access to the project application so that data can
be sent to IOT server. GPS can provide location information so that we can also locate
dust bin in google map. For dust bin requiring high power for lifting, we can use dc
motor based electric linear actuators.
The prototype is inexpensive, easy to install in vehicle. It has very few electronic
components.
WEBSITES REFERENCE
1. Arduino.cc
2. Circuitdigest.com
3. Engineersgarage.com
4. Researchgate.net
5. Slideshare.net