DIY Smart Vacuum Cleaning Robot using Arduino

Arduino based Obstacle Avoiding Vacuum Cleaning RobotArduino based Obstacle Avoiding Vacuum Cleaning Robot
Hi guys, are you a newbie to the world of Robotics or Electronic? OR Are you looking for a simple yet powerful project to make your friends and teachers impressed? Then this is the place.

In this project we will use the power of Embedded Systems and Electronics to make our own robot which could help us in keeping our home or work place neat and tidy. This robot is simple four wheeled Vacuum Cleaner which could smartly avoid obstacles and vacuum the floor at the same time. The idea is inspired by the famous vacuum cleaner Robot Roomba which is shown in the image below.
irobot-roomba-vacuum-cleaner
Our Idea is to make a simple robot right from the scratch which can automatically avoid the obstacles while cleaning the floor. Trust me people it's fun!!

Required Material and Components:

Okay so now we have the Idea of our Automatic Vacuum Cleaner Robot in mind and we know what we are up to. So let's look where we should start our execution. In order to build a robot of our idea we would first need to decide on the following:
  • Microcontroller type
  • Sensors required 
  • Motors required
  • Robot chassis material
  • Battery capacity
Now, lets us decide on each of the above mentioned points. This way it will be helpful for you to not only build this home cleaning robot but also any other robots which strikes your imagination.

Microcontroller Type:
Selecting the Microcontroller is a very important task, as this controller will act as the brain of your robot. Most of the DIY projects are made around Arduino and Raspberry Pi, but doesn't have to be the same. There is no specific Microcontroller that you can work on. It all depends upon the requirement and cost.
Like a Tablet cannot be designed on 8 bit Microcontroller and there is no worth of using ARM cortex m4 to design an electronic calculator.
Microcontroller selection totally depends upon the requirements of the product:
1. Firstly technical requirements are identified like number of I/O pins required, flash size, number/type of communication protocols, any special features etc.

2. Then list of controllers are selected as per the technical requirements. This list contains controllers from different manufacturers. Many application specific controllers are available.
3. Then a controller is finalized based upon cost, availability and support from manufacturer.

If you don't want to do lot of heavy lifting and just want to learn the basics of microcontrollers and then later get deep into it, then you can choose Arduino. In this project we will be using an Arduino. We have previously created many types of Robots using Arduino:
  • DTMF Controlled Robot using Arduino
  • Line Follower Robot using Arduino
  • Computer Controlled Robot using Arduino
  • WiFi Controlled Robot using Arduino
  • Accelerometer Based Hand Gesture Controlled Robot using Arduino
  • Bluetooth Controlled Toy Car using Arduino

Sensors Required:
There are a lot of sensors available in the market each having its own usage. Every robot gets input via a sensor, they act as the sensory organs for the Robot. In our case our robot should be able to detect obstacles and avoid them.
There a lot of other cool sensor which we will be using in our future projects, but now let us stay focused on IR sensor and US (Ultrasonic sensor) as these two guys will be providing the vision for our robo-car. Check out the working of IR sensor here. Below showing pictures of IR sensor Module and Ultrasonic Sensor:
IR-sensor Module Ultrasonic-Sensor
Ultrasonic Sensor consists of two circular eyes out of which one is used to transmit the US signal and the other to receive the US rays. The time taken by the rays to get transmitted and received back is calculated by the microcontroller. Now, since the time and speed of sound is known we can calculate the distance by the following formulae.

  • Distance = Time x Speed of Sound divided by 2
The value is divided by two since the ray travels forward and backward covering the same distance. Detailed explanation of using Ultrasonic sensor is given here.

Motors required:
There are quite a lot a motors used in the field of robotics the most used ones are the Stepper and Servo motor. Since this project does not have any complicated actuators or rotary encoder we will be using a normal PMDC Motor. But our battery is a bit bulky and heavy hence we use four motors to drive our robot all four being the same PMDC motors. But it is advisable to set into stepper and servo motors once you get comfortable with PMDC motors.

Robot chassis material:
As a student or hobbyist the most difficult part while making a robot is to prepare the chassis of our robot.  The problem is with the availability of tools and material. The most ideal material for this project will be Acrylic, but it requires drillers and other tools to work with it. Hence wood is chosen that everyone can work on it with ease.  

This problem has totally vanished from the field after the introduction of the 3D printers. I am planning to 3D print parts someday and update you people with the same. So for now let’s use wooden sheets to build our robot.

Battery capacity:
Selecting the battery capacity should be our last part of work because it purely depends on your chassis and motors. Here our battery should drive a vacuum cleaner which draws about 3-5A and four PMDC motors. Hence we will require a heavy battery. I have chosen 12V 20Ah SLAB (Sealed lead acid battery) and its pretty bulky making our robot get four PMDC motors to pull this bulky guy.

Now that we have selected all our Required Components lets list them down
  • Wooden sheets for chassis
  • IR and US sensors
  • Vacuum cleaner which runs on DC current
  • Arduino Uno
  • 12V 20Ah battery
  • Motor driver IC (L293D)
  • Working tools
  • Connecting wires
  • Enthusiastic energy to learn and work.

Most of our components are covered in the description above, I will explain the left outs below.
DC vacuum cleaner:

Since our robot runs on a 12V 20Ah DC system. Our vacuum should also be a 12V DC vacuum cleaner. If you are confused on where to get one then you can visit eBay or Amazon for car cleaning vacuum cleaners.
vacuum-cleaner
We will be using the same as shown in above picture.


Motor driver (L293D):
A motor driver is a intermediate module between Arduino and the Motor. This is because Arduino microcontroller will not be able to supply the current required for the motor to work it and can just supply 40mA, hence drawing more current will damage the controller permanently. So we trigger the motor driver which in turn controls the motor.

L293D-Motor-Driver-IC
We will be using L293D Motor Driver IC which will be able to supply up to 1A, hence this driver will get the information from Arduino and make the motor work as desired.

Thats it!! I have given most of the crucial information but before we start building the robot it is recommended to go through the datasheet of L293D and Arduino. If you have any doubts or problems you can contact us through the comment section.

Building and Testing the Robot:

The Vacuum Cleaner is the most crucial part in placement of Robot. It has to be placed at tilted angle as shown in the picture, so that it can provide proper vacuum action.  The vacuum cleaner is not controlled by the Arduino. Once you power on the robot the vacuum is also turned on.
One tiring process of building our Robot is the wooden works. We have to carve our wood and drill some holes to place the sensors and vacuum cleaner.

It is recommended to Test Ride your Robot with the following code once you arrange the Motor and Motor driver, before connecting the Sensors.
void setup()
{
Serial.begin(9600);
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);
pinMode(11,OUTPUT);
pinMode(12,OUTPUT);
}

void loop()
{
delay(1000);
Serial.print("forward");
digitalWrite(9,HIGH);
digitalWrite(10,LOW);
digitalWrite(11,HIGH);
digitalWrite(12,LOW);
delay(500);
Serial.print("backward");
digitalWrite(9,LOW);
digitalWrite(10,HIGH);
digitalWrite(11,LOW);
digitalWrite(12,HIGH);
}


Arduino-vacuum-cleaner-robot-using-IR-and-ultrasonic-sensor

If everything works fine then you can connect the sensors with Arduino as shown in Circuit Diagram and use the Full Code given at the end. As you can see I have mounted an Ultrasonic sensor to the front and two IR sensors on both the side of the robot. The heat sink is fitted on to the L293D just in case the IC heats up fast.

You can also add few extra parts like this one
sweeping-arrangement-for-arduino-vacuum-cleaner-robot Arduino-robot-vacuum-cleaner-with-sweeping-arrangement
This is a Sweeping Arrangement can be placed on both ends of the front part that will push the dust along the sides into the suction area.

Further, you also have an option of making a Smaller Version of this Vacuum Cleaning Robot like this
Arduino-based-obstacle-avoiding-robot
This smaller Robot is made on cardboard and runs on ATMega16 development board. The vacuum cleaner part was done by using a BLDC fan and enclosed in a box. You can adopt this if you want to keep your budget low. This idea also works but it's not efficient.

Circuit Diagram:

Arduino-obstacle-avoiding-robot-vacuum-cleaner-circuit
The Code for this Vacuum Cleaner Robot can be found in the Code Section below. Once the connection is done and program is dumped into Arduino, your robot is ready to get into action. The working of the code is explained using the comments. If you want to see this robot in action, check out the Video below.

Further, I am also planning to completely 3D Printed the parts in its next version. I am also going to be adding few cool features and complex algorithms so that it covers the whole carpet area and easy to handle and compact in size. So stay tuned for future updates.
Code: 
#define trigPin 12 #define echoPin 13 #define ir1 7 #define ir2 6
void setup() {   Serial.begin(9600);   pinMode(8,OUTPUT);   pinMode(9,OUTPUT);   pinMode(10,OUTPUT);   pinMode(11,OUTPUT);   pinMode(trigPin, OUTPUT);   pinMode(echoPin, INPUT);   pinMode(ir1, INPUT);   pinMode(ir2,INPUT); }
void loop() {   int duration, distance;   int flag,val1,val2;   val1=digitalRead(ir1);   val2=digitalRead(ir2);   Serial.println(val1);   Serial.println(val2);   digitalWrite(trigPin, HIGH);   delayMicroseconds(1000);   digitalWrite(trigPin, LOW);   duration = pulseIn(echoPin, HIGH);   distance = (duration/2) / 29.1;   if (distance >= 200 || distance <= 0){     Serial.println("Out of range");   }   else {     Serial.print(distance);     Serial.println(" cm");   }   delay(500);
if (distance >=20) {   delay(100);   Serial.println("forward");   digitalWrite(8,HIGH);   digitalWrite(9,LOW);   digitalWrite(10,HIGH);   digitalWrite(11,LOW);   delay(150);   Serial.println("STOP");   digitalWrite(8,LOW);   digitalWrite(9,LOW);   digitalWrite(10,LOW);   digitalWrite(11,LOW); }
if (distance<=20) {   if (val1==1 )   {       Serial.print("turn right");     digitalWrite(8,LOW);     digitalWrite(9,LOW);     digitalWrite(10,HIGH);     digitalWrite(11,LOW);     delay(2000);   }   if (val2==1)   {     Serial.print("turn left");     digitalWrite(8,HIGH);     digitalWrite(9,LOW);     digitalWrite(10,LOW);     digitalWrite(11,LOW);     delay(500);   } }
if(distance<=10) {     Serial.print("rearrange back");     digitalWrite(8,LOW);     digitalWrite(9,HIGH);     digitalWrite(10,LOW);     digitalWrite(11,HIGH);     delay(1000);       Serial.print("rearranged left");     digitalWrite(8,LOW);     digitalWrite(9,LOW);     digitalWrite(10,HIGH);     digitalWrite(11,LOW);     delay(100); }
if (distance<=20) {    Serial.print("Algorithum");    Serial.print("free right");    digitalWrite(8,HIGH);    digitalWrite(9,LOW);    digitalWrite(10,LOW);    digitalWrite(11,LOW);    if(val2==0)    {     Serial.print("smart adjust");     digitalWrite(8,LOW);     digitalWrite(9,HIGH);     digitalWrite(10,LOW);     digitalWrite(11,LOW);     delay(500);    }  } }
Video: 


Hi, I`m Sostenes, Electrical Technician and PLC`S Programmer.
Everyday I`m exploring the world of Electrical to find better solution for Automation. I believe everyday can become a Electrician with the right learning materials.
My goal with BLOG is to help you learn Electrical.

Share this

Related Posts

Previous
Next Post »
My photo

Hi, I`m Sostenes, Electrical Technician and PLC`S Programmer.
Everyday I`m exploring the world of Electrical to find better solution for Automation. I believe everyday can become a Electrician with the right learning materials.
My goal with BLOG is to help you learn Electrical.