Introduction: Arduino ROOMBA + Autonomous Steam Cleaner
So from high demand on reddit, I guess I’m making a tutorial for this! Here we go,
Step 1: Cutting Cardboard or If You Have a Chassis Use That.
Cut however but you want it to be!
I used 4x5 inches,
Next you’ll want to cut 2 small pieces of cardboard 3 inches long and 1 inch wide. Glue them together
Afterwards you’ll need a plastic vase for your cloth or rag.
Step 2: Assembly
You can use your Zip ties or Hot glue here
Step 3: Circuitry
Just follow the schematic I made for you and ask questions in the comments if you need!
Step 4: Programming
Just copy paste the code I gave you and if you need to change around the motor speeds to even the turns out go ahead!
#include //Adafruit Motor Driver Shield library
AF_DCMotor motor1(3); //motor1 connected to M3
AF_DCMotor motor2(4); //motor 2 connected to M4
long duration; //duration of ultrasonic pulse
int distanceCm; //distance in cm
pinMode(A1, OUTPUT); //Analog pin A1 connected to TRIG
pinMode(A0, INPUT); //Analog pin A0 connected to ECHO
motor1.setSpeed(255); //motor speed set to max. range:0-255
motor1.run(RELEASE); //stop both motors
digitalWrite(A1, HIGH); //give a pulse of 10us on TRIG
duration = pulseIn(A0, HIGH); //check time elasped in receiving back the pulse on ECHO
distanceCm = duration*0.034/2; //convert to distance in cm
if(distanceCm <= 20) //if distance less than 20cm make the turn
motor1.run(FORWARD); //to turn motor to righ change to motor1.run(BACKWARD)
motor2.run(BACKWARD); //and motor2.run(FORWARD)
delay(500); //play with delay to set the angle of turn
else //else keep moving forward
Step 5: Troubleshooting
So I’m guessing these will be your problems
-Wheels aren’t moving
Use a higher power battery, 9V will work for a little while but you’ll have to tweak the code to set the motor powers to 255.
Make sure your ultrasonic sensor is connected correctly!
Your motors may be on backwards, if so change them or change the directions in the code.
-Wheels don’t move but you hear a buzzing
Use more power!!!!!
Leave it in the comments below!
Step 6: Finished
Put some water or windex in front of the cloth and you get this!
Participated in the
Arduino Contest 2020
1 Person Made This Project!
- Samir52187 made it!