How to make a Smart Rubbish Bin with Arduino
ฝัง
- เผยแพร่เมื่อ 9 ก.ค. 2023
- In this video I demonstrate how to make a motion activated smart rubbish bin / trashcan / dustbin with an Arduino uno, HC-SR04 ultrasonic sensor and a servo motor.
#diy #arduino #project #smartgadgets #smart #electronics #robotics #tutorial #servo #sensor #ultrasonic
How to make arduino controlled bin? How to use servo or ultrasonic sensor with arduino? Arduino controlled bin tutorial? This video has you covered. - แนวปฏิบัติและการใช้ชีวิต
Brilliant! I love that your daughter helped too : )
I watched another video of a bin done , but they had the stuff wired inside the bin- this is much better : )
why is the servo motors red wire and ultrasonic sensor vcc conected to the same place in the arduino 5v??how am i supposed to connect ?,also can u please show the wiring part more clearly?,ty
Hello!, can you list the materials needed for this project?, like what type of wires do I need?
Can you help me in programming.....can you send me the program of this video
/*********
SparkLabz - Motion activated bin
*********/
#include
#define TRIG 10
#define ECHO 9
#define SERVO A1
// Ultrasonic sensor variables
long duration;
float distance;
// Servo variables
Servo myServo;
void setup() {
Serial.begin(115200); // Start serial communication
pinMode(TRIG, OUTPUT); // Set trigger pin as an Output
pinMode(ECHO, INPUT); // Set echo pin as an Input
myServo.attach(SERVO); // Attach servo pin
}
void loop() {
// Clear trigger pin
digitalWrite(TRIG, LOW);
delayMicroseconds(5);
// Set triggerPin to HIGH for 10uS
digitalWrite(TRIG, HIGH);
delayMicroseconds(10);
digitalWrite(TRIG, LOW);
// Read echoPin and get sound wave travel time in microseconds
duration = pulseIn(ECHO, HIGH);
// Calculate distance
distance = (duration/2.0)/29.0;
// Prints distance to Serial Monitor
Serial.print("Distance (cm): ");
Serial.println(distance);
if (distance < 50) {
// If something is closer than 50cm, open the bin
myServo.write(180);
delay(5000);
} else {
myServo.write(0);
delay(15);
}
delay(100);
}
Hi, your video mentions that you'll pin the code in the comments, but I can see it. Are you able to provide a link?
/*********
SparkLabz - Motion activated bin
*********/
#include
#define TRIG 10
#define ECHO 9
#define SERVO A1
// Ultrasonic sensor variables
long duration;
float distance;
// Servo variables
Servo myServo;
void setup() {
Serial.begin(115200); // Start serial communication
pinMode(TRIG, OUTPUT); // Set trigger pin as an Output
pinMode(ECHO, INPUT); // Set echo pin as an Input
myServo.attach(SERVO); // Attach servo pin
}
void loop() {
// Clear trigger pin
digitalWrite(TRIG, LOW);
delayMicroseconds(5);
// Set triggerPin to HIGH for 10uS
digitalWrite(TRIG, HIGH);
delayMicroseconds(10);
digitalWrite(TRIG, LOW);
// Read echoPin and get sound wave travel time in microseconds
duration = pulseIn(ECHO, HIGH);
// Calculate distance
distance = (duration/2.0)/29.0;
// Prints distance to Serial Monitor
Serial.print("Distance (cm): ");
Serial.println(distance);
if (distance < 50) {
// If something is closer than 50cm, open the bin
myServo.write(180);
delay(5000);
} else {
myServo.write(0);
delay(15);
}
delay(100);
}
@@SparkLabz Ta very much.
fygfl
This is rubbish. AHA