Introduction: DIY Vacuum Robot
This is my first Vacuum Robot, which it's main purpose is to allow anyone to have a cleaning robot without paying so much money, to learn how they work, to build a nice robot that you can modify, update and program as much as you want, and of course to vacuum all that annoying fluff.
This project is intended to be as easy to build as possible since all the elements and parts are easy to find on Digikey, eBay, Amazon, etc.
The whole chassis was designed in Solidworks so that it could be 3d printed.
Currently it uses an Arduino Uno (if you don't like it too much you can easily change it for another micro controller, I decided to use this since my objective is that anyone could actually build it), micro-metal motors, fan propeller, infrared sensors and respective driver modules.
Another one bites the dust!
Step 1: Materials
So, first I will define all the materials that I used and later I will suggest other options with a similar behavior.
- 1 x Arduino Uno Board (or similar) (DigiKey)
- 1 x IRF520 MOS FET Driver Module (Aliexpress)
- 1 x H-bridge L298 Dual Motor Driver (Aliexpress)
- 2 x Micro Metal Gearmotor HP 6V 298:1 (DigiKey)
- 1 x Micro Metal Gearmotor Bracket Pair (Pololu)
- 1 x Wheel 42×19mm Pair (DigiKey)
- 2 x Sharp Distance Sensor GP2Y0A41SK0F (4 - 30cm) (DigiKey)
- 1 x ZIPPY Compact 1300mAh 3S 25C Lipo Pack (HobbyKing)
- 1 x LiPo Battery Charger 3s (Amazon-Charger)
- 1 x 1k Ohm resistor
- 1 x 2k Ohm small potentiometer
- 3D printer with a minimum printing size of 21 L x 21 W cm .
- PLA Fillament or similar.
- If you don't have, you can print your file on 3DHubs.
- 20 x M3 bolts with (3mm diameter)
- 20 x M3 nuts
- 2 x #8-32 x 2 IN bolts with nuts and washer.
- 1 x Vaccum bag filter (cloth type)
- 1 x Ball Caster with 3/4″ Plastic or Metal Ball (Pololu)
- 2 pushbuttons
- 1 x On/Off Switch
- Screw driver
- Soldering Iron
- Cable (3m)
Step 2: How Does It Work?
The majority of the vacuums have a motor with a fan. As the fan blades turn, they force air forward, toward the exhaust port. At the exhaust port it has a filter which prevents the dust particles being thrown away again.
How does a vacuum robot work?
The principle is pretty similar but as you can see in the second picture, the fan motor is at the last step which means that the dust is not driven through it. The air that is being sucked is first filtered and then pushed toward the exhaust port.
The main difference between each of the vacuums is that the robot one has a microcontroller and sensors which let the robot make decisions so that it can vacuum your room autonomously. Most of the vacuum robots nowadays have really nice algorithms built-in, for instance, they can map your room so that they can plan a path and perform a faster cleaning. They also have other features like side brushes, collision detection, return to its charging base, etc.
Step 3: About the Ingredients...
As I said at the beginning, I'm going to explain as much as I can so that anyone can understand, but If you already know the basics, feel free to skip this step.
The most important thing of a vacuum is to choose the appropiate fan with a decent CFM (Airflow cubic feet per minute), it is the force of this airflow across a surface that picks up the dirt and moves it to the dust bag or container. Therefore, the more airflow, the better the cleaning ability of the vacuum cleaner [BestVacuum.com]. Most of the big vacuums use more than 60 CFM but since we are using a small battery, we are ok with at least 35 CFM. The AVC fan that I will use has 38 CFM [AVC link] and it actually has a lot of power, but you can use any with the same dimensions (See picture 1).
The Fan Driver
Since we need a way to control whenever the Fan is On or Off, we need a Driver. I will use the MOS-FET IRF520 which basically works as a switch, whenever it receives a signal from the microntroller it will supply the input voltage to the output (Fan).(See picture 2)
For the motors we'll need something a bit different from the Fan driver since now we will need to control the direction of each motor. The H-bridge is an array of transistros which allows us to control the current flow, and by controlling that, we will be able to control the motors direction. The L298 is a pretty decent H-bridge that can supply 2A per channel so for our motors it will be perfect! Another example is the L293D but that only gives us 800mA per channel. (The picture 3 depicts the concept of an H-bridge)
Step 4: The Design
The design of the robot was done in SolidWorks, it consists of 8 files.
This step was the most time consuming since all the robot was made from scratch considering the bumper, the container, the filter, etc.
The total size of the robot is 210mm x 210 mm x 80mm.
Step 5: 3d Printing
The design was done so that all the parts could be 3d printed. In case you don't have a 3d printer, you can use the 3DHubs wherever you are.
The robot consist of 12 parts (it takes a some time). It was printed on a Robo3d R1 plus using Blue Gray Colorfabb filament.
My printing settings were:
- 0.2 mm layer height
- 1.2 mm shell thickness
- 30% fill density
- 215 C printing temperature
- 70 C bed temperature
- Support type everywhere
- Retraction (Very important!!) 50 mm/s 0.7mm
- Printing Speed 60mm/s
Before doing all the prints I recommend to print the test samples that I attached so you can calibrate and modify the parameters. I took me a lot of time since the prints are big.
Note: Remove all the support filament with caution.
Look for the files here: Thingiverse Files
Step 6: Setting the Sensors Up
For each of the two sensors I soldered cables but in case you have the connector, you can skip this step.
Once we have the sensors support, we will assembly them as it is showed on the picture above using the M3 bolts. It is important to mention that one sensor should be flipped because it will help us when we assembly them.
Step 7: Connecting the Motors and H-bridge
The first objects that are going to be mounted, are the motors. Mount them using their brackets.
Once you have set them, you can start mounting the H-bridge as it is showed. After that, we shall start connecting the motors on the dual terminals. Don't worry about how the motors shall be connected, you can connect them in any polarity and we can modify the direction of the motors with the code. They should look like the last image.Mo
Step 8: Mounting the Ball Caster
The ball caster will help the robot to tilt it to the front so that robot can vacuum much better.
The Pololu Ball Caster has already its bolts but unfortunately they're too large. So, we shall cut them for about 3mm. Use a knife or a saw being really careful.
An image above shows the ideal length of the bolt.
Step 9: The Bumper
So what happens when the infrared sensors can't see the object?
Well I have designed a bumper so that it can detect when it touched a close object.
The first image shows the concept and the way it shall be connected.
Mount the push button pushButtonSupport and connect it to the small cilinder (see pictures).
Once both of the buttons are mounted, you can paste the bumper (use a small amount of glue).
Note: I will only use one of the buttons since one push button got broken :( But it still works really nice!
Step 10: Connecting the Sharp Sensors
In order to supply the Sensors I made a small board which will supply the power for each of the sensors.
Cut a small surface 3x3 cm then mount the connectors as it is showed on the second picture. Do the proper soldering being careful. Once it is done, mark the board so that you can know the polarity. I use by convention that the right side is always voltage.
Connect the Grounds of each of the sensors and also one terminal of the push button to GND, and the Red wires from the sensors to VCC (Right connectors).
Once they are all connected, fix the wires and set them nicely.
Step 11: Voltage Divider
We need a way to monitor the battery voltage because the if the voltage of a LiPo cell is dropped lower than 3.0 it can permanently damaged it. Our battery is a 3S LiPo battery which means that it has 3 cells of 3.7V each.
Since we can't connect the battery voltage directly to the Arduino (because you will kill the board), we should find a way to proportionally get the voltage of the battery within the range of the ADC (Analog Digital Converter).
Cut 12cm of wire (Red, Black and White. Use always white or other color for signals but not black nor red)
The Voltage Divider will help us to reduce the voltage proportionally and thus we can connect it to one of the analog inputs.
For this we will need to Resistors. R1 and R2. I recommend to use one fixed and the other one use as a potentiometer so you can manipulate your circuit and calibrate it carefully.
Use an R2 of 1k Ohms and set the Potentiometer to 1536 ohms. See the theory behind that so that you can probe the voltages (Or you can trust me Wiki Theory). I set my desired output to be Vout = 5V and my input was the battery voltage when it was fully charged = 12.68 V.
Once you have finished the circuit, test it! Use a Voltmeter and verify that the Vout is actually 5V when your battery is fully charged, otherwise adjust the potentiometer. (Don't set it above 5V or you can kill the Arduino!)
Step 12: Get Your Hands Dirty
We are going to start connecting a lot of wires right now so we should be really careful or we can make a short circuit.
The Battery will supply 3 different things:
- Voltage Divider
And everything will be connected to the MOS-FET board (it is not really ideal but it is a thing to improve)
We will need 2 male to male wires one to supply the motors driver and the other for the connector to the switch.
- 21.5cm Red wire for the motors driver to the MOS-FET
- 15 cm Red wire with male connector for the switch to MOS-FET
I had to modify the batterys wires since its connector was really big, so I added two new wires, the positive one is a male connector for safety. (see the battery picture)
- First we will connect the fan. Cut the wires 12cm length. We will only use the Yellow and the black wires. Connect the Yellow to the V+ and the Black to the V- as it is showed on the picture.
- Then we wiil connect 3 red wires to Vin of the MOS-FET: The one of 21.5cm for the H-bridge, the 15cm one for the switch and the Vin for the voltage divider.
- Connect the GNDs: Connect the Ground of the battery and the GND of the voltage divider.
See the notes of the pictures for more help.
Make sure everything is well connected! Hold this connection since we are going to use it later.
Step 13: Keep Connecting (Terminals, Fan and Motor Driver)
We can start connecting everything together.
Mount the Arduino first with its respective bolt.
Then follow the steps showed on the picture. Connect the Corresponding wires to the terminals.
Place the Fan.
And connect the Voltage divider wire signal to the A4 analog input of the Arduino.
Step 14: Connecting the Motors Signal Inputs
We will need 4 wires Male to Female 27cm length because they are to be connected from the Motor Driver to the Arduino pins.
They should be connected to the Arduino inputs 3,5,6 and 9 respectively. (See the pictures for help).
Step 15: Connecting the Sensors to the Microcontroller
Start connecting the sensors as following:
- Left Sharp sensor to A0
- Right Sharp sensor to A1
- Pushbutton to Digital pin 10
Using female to mal jumpers, connect the Mosfet Terminasl "Signal" and "GND" pins. The signal must be connected to the digital pin 12 and the "GND" pin to one of the Grounds on the Arduino. (See the pictures)
Step 16: Almost Done
We will need a switch tu turn our robot on so I attached a male and female connectors so that it could be connected to the battery.
I also wanted to use an indicator LED (optional) connected to the digital pin 13 and GND. See the pictures for help.
Step 17: Assembling the Container
Once you have all the Container parts printed we need to assembly it.
Mark the cloth filter to the dimension of the FilterTap then ad 1mm on each side and cut the rectangle.
Joing the pieces as it is showed on the pictures and put the filter inside the containter.
Step 18: Close It!! and Program It!
Close it carefully and make sure everything fits nicely.
You can charge the robot by just pulling the charging cable and connect it directly to the charger without having to take the battery apart from the robot.
I have uploaded an Arduino Code that you can use, it is pretty simple but it works really nice. Download the Arduino IDE, compile the software and program your robot!.
The code includes:
1.- Battery monitor:
* It is constantly measuring the voltage and if the battery voltage is below the threshold it will turn off all the motors and the LED will start blinking.
* When starting it tries to turn on the Fan and if the battery voltage is below the threshold it won't start.
2.- Collision avoidance:
* It measures the distance from the sensors to an object and when it is close it turns to the opposite side.
* It senses when it is on a corner and turn 180 degrees.
* When the bumper touches it turn right.
3.- Fan control
* Turn on/off the fan
4.- Motor control
* With PWM it moves the motors in both directions.
I encourage anyone who wants to improve this to do it and share so that we can enhance our knowledge!
I have added a test code (VaccumCode_test_Motors_1.0.0) to make sure that the motors are wired correctly. If you run this code and the robot is not moving forward you must swap the motor wires on the L298 Driver.
I have also added a Beta Code for side sensors.(VaccumCode_SideSensorsBeta_1.0.0)
Step 19: What's Next?
What about adding encoders to the motors so that you can predict the position of the robot?
Adding more sensors? you can follow edges to ensure a better cleaning
Mapping? Once you have the encoders you can save the objects that the sensors see and create a map!
This is a nice project to start building complex codes and complex navigation algorithms so I encourage you to do it!
- Code updated to use Pololu motor encoders with PD controller
- Almost all the code was modified to be more easy to understand
- Code updated (just some comments were erased)
- Circuit diagram added
- A better explanation for the battery was written
Step 20: Contribute
The project is now available on Github where you can share all your improvements: