In this project, I have created a smart trash bin based on Arduino. Why did I choose to create such a project? Because as we know, trash bins are among the dirtiest objects, especially their lids. This often discourages people from opening the bin, leading them to litter improperly.
βοΈ Required components:1. Arduino UNO
2. Motor Servo (Tower Pro SG90)
3. Obstacle Avoidance Sensor Module
4. USB B wire (USB Printer)
5. Jumper wire (Male-Male)
6. Jumper wire (Male-Female)
7. Pin Header Male
8. Trash bin
π₯οΈ Software used:- Arduino IDE
1. Connection from the Obstacle Sensor to Arduino UNO:
- OUT β Digital Pin 2
- GND β GND
- VCC β 5V
- Connect using Male-Female Jumper Cables or Male Pin Headers.
2. Connection from the Servo Motor to Arduino UNO:
- Brown wire β GND
- Red (middle) β 5V
- Yellow/orange β Digital Pin 8
- Connect using Male-Male Jumper Cables or through the built-in adapter on Arduino.
3. After connecting the Arduino UNO, Servo Motor, and Obstacle Sensor with jumper cables and/or pin headers, the next step is to assemble them onto the prepared trash bin.
4. Next, upload the program code to the Arduino by connecting the Arduino to your PC/Laptop using a USB Printer cable.
5. Open the Arduino IDE on your PC/Laptop. If you haven't downloaded the Arduino IDE yet, you can download it from Official website and choose the appropriate version for your operating system (Windows/Linux/MacOS).
6. Open the Arduino IDE, go to Select Board > Select other board and port... > Scroll down and choose Arduino UNO > click "OK".
7. Copy and paste the following code:
#include <Servo.h>
Servo myservo;
int angle =0;
int angleStep =50;
void setup() {
myservo.attach(8);
pinMode(2,INPUT_PULLUP);
}
void loop() {
if (digitalRead(2) == HIGH){
myservo.write(180);
}
else {
myservo.write(-180);
}
}8. Click on the "β" (Upload) button in the Arduino IDE.
9. Disconnect the USB Printer cable from your computer/laptop and replace it with a regular phone charger head, then plug it into a power outlet. Test the system by approaching your hand or an object near the Obstacle Sensor. You're done!
π This sequence of steps guides you through assembling the components, programming the Arduino, and testing your smart trash bin project.
πΉ The following video is expected to facilitate your work in creating a smart trash bin.
ππ» MATUR NUWUN


_ztBMuBhMHo.jpg?auto=compress%2Cformat&w=48&h=48&fit=fill&bg=ffffff)












Comments