Introduction: Smart Bin
Hi Friends I am Venkatesh M I am Back I am doing interesting and useful project called Smart Bin.
Materials Required:
- 4 Cardboard Boxes
- Double side Tape
- 9v Battery
- Some Thread
- Servo Motor
- Ultra Sonic Sensor
- Battery Connector
- Some Jumping Wires
- Arduino
- Scissors
- Big Transparent Tape
- Nut
Step 1: Joining
Step 1:
Cut the four Card board boxes in 6 equal parts.
Using Big Transparent Tape make like a cuboid by joining the 6 cardboard sheet.
As shown in the figure.
Step 2: Opening and Closing
Step 2:
After making like a box take the first portion (top cardboard box) cut it into 2 parts.
After cut Stick it using tape.
Make it such that it can open and close.
Then stick Servo Motor on the top portion using Glue Gun.
After take nut tie thread to the nut and take the other portion of the thread and tie that one to the first hole of the Servo Motor.
Step 3: Coding
Step 3:
Insert Code as given below:
#include //servo library
Servo servo; int trigPin = 5; int echoPin = 6; int servoPin = 7; int led= 10; long duration, dist, average; long aver[3]; //array for average
void setup() { Serial.begin(9600); servo.attach(servoPin); pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); servo.write(0); //close cap on power on delay(100); servo.detach(); }
void measure() { digitalWrite(10,HIGH); digitalWrite(trigPin, LOW); delayMicroseconds(5); digitalWrite(trigPin, HIGH); delayMicroseconds(15); digitalWrite(trigPin, LOW); pinMode(echoPin, INPUT); duration = pulseIn(echoPin, HIGH); dist = (duration/2) / 29.1; //obtain distance } void loop() { for (int i=0;i<=2;i++) { //average distance measure(); aver[i]=dist; delay(10); //delay between measurements } dist=(aver[0]+aver[1]+aver[2])/3;
if ( dist<50 ) { //Change distance as per your need servo.attach(servoPin); delay(1); servo.write(0); delay(3000); servo.write(150); delay(1000); servo.detach(); } Serial.print(dist); }
Please copy the code to
Step 4: Cricuit
Step 4:
Using jumping wires give the connections as shown in the figure.
Step 5: Finally
The project is done.
If you want you can paint using different colours.