Hi, I'm @techlhab and today I would be sharing with us how to make is DIY Smart Waste Bin using Arduino Uno microcontroller, Ultrasonic Sensor, and Servo Motor as the major hardware components and other hardware components which include a TP4056 lithium battery charging module, control switch, LED (Light Emitting Diode), Resistor, and connecting wires. While the software components are; the Arduino IDE, Embedded C/C++ programming language, and fritzing for circuit design and simulation.
- Arduino Uno
- Ultrasonic Sensor (HC-SR04)
- Servo Motor (SG90)
- 3.7v Rechargeable Lithium Battery x2
- TP4056 Lithium Battery Charging Module
- LED (Light Emitting Diode)
- Resistor (220 ohms)
- Control Switch
- Connecting Wires
- Arduino IDE (Integrated Development Environment)
- Embedded C/C++
- Fritzing
The Arduino Uno is a popular open-source microcontroller that uses the ATMEGA328P PIC (Programmable Integrated Circuit) chip developed by Arduino.cc. It has 14 digital I/O (Input / Output) pins and 6 analog I/O pins.
In this project, that is the smart waste bin, the Arduino Uno microcontroller serves as the brain of the device, with which other components connected to it sends and receives instructions to and from respectively based on the code or instructions programmed to the microcontroller.
The ultrasonic sensor is a sensor used in measuring distance or proximity. It transmits and receives sound waves and then converts the reflected sound wave over a distance from an object into electrical signals.
It has 4 pins which are:
- Vcc
- Gnd
- Trig
- Echo
In this project or tutorial, the HC-SR04 ultrasonic sensor is used and it is been used to sense the proximity of a person intended to dump waste into the bin at a programmed distance. Then sends the instruction to the Arduino Uno for other decision makings.
It is a micro motor that converts electrical signals to produce rotary effects, with which the speed, angular or linear position, velocity and acceleration can be controlled precisely with a microcontroller like the arduino uno.
In this project or tutorial, the servo motor is used in opening and closing the top lid of the waste bin.
The TP4056 lithium battery recharging module helps in recharging the lithium batteries through an external 5v voltage source. It has two LEDs on it with which one of them indicates a red light to notify that the battery is charging and the other one is a blue LED which indicated when the battery if fully charged.
Two 3.7v rechargeable lithium batteries are used and are connected in parrallel in to other to maintain the voltage of 3.7v and double the current by two in other to make the batteries power the smart waste bin for longer or hours.
The resistor is an electronics component that is used in reducing, limiting or varying the electric current following through a path or other components in an electric circuit.
In this project, the 220 ohms resistor helps in limiting the current that goes into the LED (Light Emitting Diode) due to the higher voltage coming from the microcontroller which is needed to be reduced before getting to the LED in other to protect it from damaging as it requires only 3.3v. And from ohm's law current is directly proportional to voltage, a decrease in current would lead to a decrease in voltage as V = IR
.
The LED (Light Emitting Diode) is a highly utilized electronic component that converts electrical energy into light energy. That is produces light when voltage is been applied to its two terminals. It is polarized which means on like the resistor the LED has positive and negative terminals and must be checked appropriately before applying voltage to its terminals.
In this project, the LED is used to indicated that electric power supply has been supplied to the circuit.
The switch is an electronics component that is used to make or break electric connections in an electric circuit.
In this project or tutorial, it is used in switch on and off power supply to and from the smart waste bin.
- Conneting the ultrasonic sensor to the Arduino Uno
Arduino Uno | Ultrasonic Sensor | |
---|---|---|
1 | 5v | Vcc |
2 | Gnd | Gnd |
3 | D4 | Trig |
4 | D3 | Echo |
- Conneting the Servo Motor to the Arduino Uno
Arduino Uno | Servo Motor | |
---|---|---|
1 | 5v | Vcc |
2 | Gnd | Gnd |
3 | D5 | Pulse or Signal Pin |
#include <Servo.h>
Servo servoMain; // Define our Servo
int trigpin = 4;
int echopin = 3;
int distance;
float duration;
float cm;
void setup()
{
servoMain.attach(5); // servo on digital pin 5
pinMode(trigpin, OUTPUT);
pinMode(echopin, INPUT);
}
void loop()
{
digitalWrite(trigpin, LOW);
delay(2);
digitalWrite(trigpin, HIGH);
delayMicroseconds(10);
digitalWrite(trigpin, LOW);
duration = pulseIn(echopin, HIGH);
cm = (duration/58.82);
distance = cm;
if(distance<30)
{
servoMain.write(180); // Turn Servo back to center position (90 degrees)
delay(3000);
}
else{
servoMain.write(0);
delay(50);
}
}
When the device is been switched on using the control switch, the red LED comes on to indicate that power has been supplied to the circuit.
The microcontroller has been programmed that whenever the ultrasonic sensor radiated sound wave is been reflected or obstructed within a distance of 30cm then, it instructs the servo motor open the lid of the smart waste bin and wait for 3 seconds then closes smart waste bin lid when the distance between the person intending to dump a refuse or waste and the smart waste bin is more than 30cm. But as long as the person intending to dump the refuse into the waste bin is still within 30cm distance the lid would remain open waiting for the person to dump the refuse and close itself automatically after the person as dumped the refuse and moved away from the smart waste bin.
The TP4056 lithium battery charger module recharges the batteries easily and ensure that the device keep on functioning and that the batteries are having adequate potential to power the device.
Thanks for reading and visiting my blog 🤝. Kindly support this post by reblogging, upvoting, and commenting, it would be highly appreciated.
Images used in this post were all designed by me using fritzing, a circuit design and simulation software.
Posted with STEMGeeks
I would have loved to try this but I don't think I am smart enough 😆
Thanks for commenting @khaleesii 🤝. We can actually do anything we put our minds to @khaleesii and most times it's not about being smart. Its a matter of interest, dedication, commitment and consistency.
Thank you, maybe ill put my mind to it and give it a try.
👍
Do you have a picture of a finished product for reference?
!discovery 37
Thanks for commenting @enforcer48 🤝. Yeah I do have an image of the finished product, and here it goes...
Nice.
Thanks @enforcer48 🤝. I so much love and enjoy Building solutions by applying my acquired skills in making life easier and smarter. And also sharing the knowledge for other to benefit from.
This post was shared and voted inside the discord by the curators team of discovery-it
Join our community! hive-193212
Discovery-it is also a Witness, vote for us here
Delegate to us for passive income. Check our 80% fee-back Program
Your content has been voted as a part of Encouragement program. Keep up the good work!
Use Ecency daily to boost your growth on platform!
Support Ecency
Vote for new Proposal
Delegate HP and earn more
Congratulations @techlhab! You received a personal badge!
Wait until the end of Power Up Day to find out the size of your Power-Bee.
May the Hive Power be with you!
You can view your badges on your board and compare yourself to others in the Ranking
Check out the last post from @hivebuzz:
Support the HiveBuzz project. Vote for our proposal!
This is a really cool device. I noticed that you shared a picture of the finalised project. Would it be possible to also share a small video to see it in action? Thanks in advance ^^
Cheers!
Thanks for the nice comment @lemouth 🤝. I'm currently not within where I installed the device and I don't have the video of it on my phone, I only took pictures of it after development. But I would send the video of it working when I get to it as soon as possible. Thanks.
Cool cool! I am looking forward to see it. You managed to trigger my curiosity quite a bit ;)