The idea of this week's assignment is a Smart Trash Bin.
I got the Idea from Arduino Hub project site.
Smart trash link.
Review:
The Smart Trash Bin is an automated system designed to improve waste disposal by detecting hand movements for automatic lid operation and alerting users when the bin is full. The system utilizes an ultrasonic sensor to detect hand proximity, an IR sensor to detect bin full status, a servo motor to open/close the lid, and a buzzer to provide alerts.
I have used the TINKER CAD platform for simulating the electronic circuit, and be sure that every components working before start the actual circuit to avoid any damage.
That one help to write the code, and program the Arduino.
Pencil.
Cutter blade.
Scissors.
Screwdriver.
Screws
Glue gun.
Tape
cardboard
Arduino Uno.
IR sensor (Input).
Ultrasonic sensor (Input).
Servo (Output).
Piezo Buzzer (Output).
Breadboard
Jumper wires.
First I Used the TINKERCAD platform to simulate the circuit .
I used the Arduino Uno as a power source
I used the Ultrasonic sensor for the distance that has four pins, and connect left side with the V5, the other side to GND, Echo to pin 5 of the Arduino, and the Trig to pin 6 . (Input1)
I insert IR sensor to Indicate when the trash is full, First wire to GND, second to V5, and the last one(Out) to pin8. (Input2)
There is servo also to move 180, so the lid gets open, as reflection to the read of the ultrasonic sensor. connect the Brown wire to GND, Red wire to V5, and the Orange one to pin 3. (Output1)
I insert buzzer to be activated when the IR sensor feel the trash is Full. connect the long leg(+) to pin 7, and the other one (-) to the GND. (Output2)
First I upload the Servo code from the library.
Start to define the pins and the threshold values.
Inside the Void Setup, I defined the output pins and the inputs, also Ensure lid is closed at startup, In addition to the serial monitor.
to print the reading and show when the trash is full.
Inside the Void Loop, I defined the constant such as distance and bin full to print the reading and show when the trash is full.
Then start to write If condition for the first input, which when hand detected within 15 cm using the ultrasonic sensor, the lid will be open for 3 seconds and then closed again, and serial monitor print close the lid.
Second If condition, that will help to indicate when the trash is full the buzzer will be activated, else it will be low.
Then write the function, which calculates the distance using the ultrasonic sensor:
Sends a pulse from the Trig pin.
Measures the time taken for the echo to return.
Converts time to distance (cm) using duration * 0.034 / 2. If no object is detected, it returns 999 cm.
1. Ultrasonic Sensor (HC-SR04) (Input ):
left side with the V5
Right side to GND
Echo to pin 5 of the Arduino
Trig to pin 6
2. Buzzer (Digital Pin 7):
Positive (Long Leg): Connect to Pin 7 on Arduino.
Negative (Short Leg): Connect to GND on Arduino.
3. Servo Motor (Digital Pin 3):
Brown wire to GND
Red wire to V5
Orange one to pin 3.
5. IR Sensor (Digital Pin 8) (Input):
First wire to GND
second to V5
last one(Out) to pin8.
4. Arduino Power:
Connect the Arduino’s GND to the breadboard’s negative rail.
Connect the 5V pin to the breadboard’s Positive rail
Hand Detection: The ultrasonic sensor detects an object within 15 cm and triggers the servo motor to open the lid.
Lid Operation: The servo motor moves the lid to 180° (open) and closes it after 3 seconds.
Bin Full Detection: The IR sensor checks if the bin is full. If it is, the buzzer turns on.
System Monitoring: The Serial Monitor displays real-time distance and bin status for debugging.
I placed all the needed components on the breadboard
Wrote the code using Arduino IDE
Strat to check it before placing it in the cardboard.
I made a simple box looked like a trash pin, and made the lid loose so it can be moved simply using servo, which I placed near to it.
I made holes to insert the Ultrasonic sensor, in addition to the buzzer in the front of the box's body.
I used the Glue gun to fix the IR sensor inside the box.
I decide to fix the other parts to be in the back side of the box, such as Arduino and the breadboard.
Detects hand movement: Ultrasonic sensor opens the lid when a hand is near.
Lid operation: Servo motor opens the lid for 3 seconds.
Bin full detection: IR sensor checks if the bin is full.
Buzzer alert: Activates when the bin is full.
Serial Monitor: Displays sensor values for debugging.
The Arduino Uno stopped working Out of no where.
The servo motor after every movement m was not return back to the start point so the Lid wasn't open in the right manner.
For Arduino Uno, I take off all the wires and just wait around two hours and reconnect all wires again very carefully and it works, I guess there where something wrong with wiring.
For Servo, I added in the code to start from "180" position and to move "0" (It was the opposite), so the Lid will be opened enough to add the trashes, and then get back to the start position "closed (180)".
With no doubt, the skills and knowledge that I learned this week will help me to design and build the electronic circuit and coding it using Arduino for the final project.
This week was the most exciting week that I have spent during the diploma until now. I hope that the following weeks will be more exciting than this week. I really have learned a lot of things that I will mention in the next points:
Understanding the concept of Arduino.
Learning how to power every single component connected to the Arduino
Learning how to power multiple components on the same circuit in different state using code .
Understanding the basic of programing.
Be able to write code on the Arduino IDE.