INSPO:
I saw a Smart Trash can that open it's lid without even touch it, but it opens when it detect if there's any object near or at the range of 20 cm using the ultrasonic waves
Ideation:
I'm using on/off switch to open the "ultra sonic" Sensor then when the sensor detect if there's any object near or at the range of 20 cm it opens it's lid by rotating the servo motor and, it makes a buzzer sound so we can make sure that the sensor detects the movments
Arduino Uno
Tinkercad
pinterest
crafting Tools :
Pencil
cardboard
ruler
Cutter
cardboard
Toothpick
Electronics Tools :
breadboard
Jumper wires (Male_Male/Female)
arduino uno
Cable For Arduino UNO
crocodile wires
crocodile wires
I started with creating the wiring on TinkerCad.
Using the on/off switch and the ultrasonic sensor(inputs); to open and detect if there's any object near or at the range of 20 cm
and the Buzzer (output) make a sound to make sure the sensor is working ,then the servo motor (output) rotate to a specific angle
The Code Writing
-First i wrote #include <Servo.h> ,to Allows the Arduino can to control the servo motor, then i wrote : int cm = 0;
to store the distance measured by the ultrasonic sensor in centimeters.
Then used This function measures the distance using an ultrasonic sensor. It works by sending a short ultrasonic pulse from the triggerPin and then listening for the echo on the echoPin.
Then i used the fuction: void setup()to set which is input and output
pinMode(2, INPUT); sets pin 2 as the on/off switch
servo_3.attach(3, 500, 2500); attaches the servo motor to pin 3. The parameters 500 and 2500 set the minimum and maximum pulse widths in microseconds for the servo motor, which control its range of motion.
pinMode(1, OUTPUT);sets pin 1 as an output to control an Buzzer
- if (digitalRead(2) == HIGH) {
if (0.01723 * readUltrasonicDistance(9, 10) <= 20)
I used if Else Condition which means if the on/off switch is on, the ultra sonic sensor withstart working if and any thing is near by the range of 20 cm
the servo motor rotate from "90 Angle" to "160" and the Buzzer make a sound
and if the sensor don't detect anything close everythign stay stable
THE CIRCUIT PROCESS
THE MAKING PROCESS
Cutting 4 pieces of the same shape
Make a hole for the on/off switch on one of the 4 pieces
Make a hole for the "ultra sonic" sensor on other piece
Tape the Servo motor on the last piece, and attach a tooth pick to the servo motor
Glue the toothpick to the cover
finally put all the part together and attach the Ardunio & 9V Adapter
Me and my teammates helped each other to make an arduino circuit ( LDR/DHT/Fan/LED) and it's coding
And Our instructor (Ahmed khaled) helped us to run the codes properly
when i got stuck:
It's always Free Palestine until it’s actually free
I'm planing to use " LCD" in my final project
And i this week, I've learnt how to use The "LCD " and how to write any sentence
and learnt how to do the coding in "Arduino Uno"
so i hope it'll help me ( إن شاء الله ).
How to use the Motor Driver to control the "DC Fan" which was very hard yet very interesting