Automatic Door for Smart Vacuum Robot With Arduino
by pedrofnmartins in Living > Hiding Places
9820 Views, 15 Favorites, 0 Comments
Automatic Door for Smart Vacuum Robot With Arduino
Hello, i made this project and i find it very cool so i really want to share with you guys.
The story: I have a smart home and my last acquisition was a smart vacuum cleaner robot(and its really awsome, worth every cent!). The problem is that i have a really young daughter and she is allways chasing the robot and im afraid some day she might get it broken, so i had to find a way to keep the robot way from her and still do his job right. So i decided to make my robot a home with a automatic door. Of course arduino is the right choice for this. Basicly i placed his home under my kitchen cabinets, made a frame so it stays inside of it. I also place a button to open door manually in case the robot gets stucked inside and a flashing yellow led to notice that the robot will start/doing his job.
Supplies
-Wood plates for the frame
-Arduino board(can be UNO, Nano, etc.)
-Servo Motor MG 995
-Yellow LED
-Small Switch (SPDT) or any type of switch
-10k resistor
-220 ohm resistor
-Some wires
-KY-008 Laser and Laser Detector
-Some mechanical stuff for the door opening
-2 door hinges
-Screws
-Hot glue(optional)
How It Works
I have placed the robot dock inside the frame and whenever the robot goes inside, he will block the laser light and will make the door close. While the door is opened a yellow LED will flash. (check video) For maintenance i add a button to open the door manually.
Let me tell you that this project is a bit hard because it requires a lot of testing and ajustment. It took me 2 weeks to complete it.
How to Build
I havent took pictures of the building process but i made a paint sketch. I hope you understand it.
First check if your robot fits under your cabinet. It should have your robot height plus 2 cm(minimum). The frame size depends on the space you have available under your cabinets.
Then make sure you first test your frame with the dock and robot inside to know where you going to put the laser and how far your door goes inside. Remember that you must give some space between the robot and the door. otherwise the robot will hit the door before it can be fully open.(i had this problem, i had to get more space so the door could open, luckly i still had more space to spare).
Also your must give room for your servo handle(or whatever its called) to rotate, otherwise it will hit your frame and get stucked.
Another thing your must be aware is the position of the door hinges, make sure your door stay in the same line of the side barriers.
Arduino Code
You have to ajust the servo values in the servo.write for your project.
#include<Servo.h>
Servo servo1;
int Laser = 6;
const int servoPin = 9;
int buttonPin = 4;
int buttonState = 0;
int led = 13;
int counter = 0;
//int counterValue;
#define DETECT 2 // pin 2 for sensor
void setup() {
servo1.attach(servoPin);
Serial.begin(9600);
pinMode(Laser, OUTPUT);
pinMode(DETECT, INPUT);
pinMode(led, OUTPUT);
pinMode(buttonPin, INPUT);
}
void loop()
{
digitalWrite(Laser, HIGH);
int detected = digitalRead(DETECT);// read Laser sensor
buttonState = digitalRead(buttonPin);
if( detected == HIGH || buttonState == HIGH)
{
counter = 0;
servo1.write(3); // ajust servo opening values here
delay(100);
Serial.println("Detected!");
}
if ( detected == HIGH || buttonState == HIGH && (counter <= 3)) { // if the switch is pressed then,{
digitalWrite(led, HIGH); // turn the LED on
delay(200); // wait for a second
digitalWrite(led, LOW); // turn the LED off
delay(200); // wait for a second
counter++;
}else{
servo1.write(135); // ajust servo closing values here
Serial.println("No laser");
delay(100);
}
{
delay(200);
}
}