Floor Cleaning Robot
The Floor Cleaning Robot is designed to move along the floor, sweeping dirt and other particles away, while a sponge behind the brush soaks up excess debris. It is also able to detect a wall and swerve out of the way.
Engineer
Satchin N.
Area of Interest
is Mechanical Engineering
School
Leland High School
Grade
Rising junior
Third Milestone

Second Milestone

This is my second milestone for my main project, the floor cleaning robot. As I explained in my first milestone, I have completed assembling the chassis, the arduino and the motor drive shield, and all the wire connecting to the battery. Since my first milestone, I mounted the ultrasonic sensor on the front of the robot and connected the 4 wires coming out of it. The 4 wires are the Vcc, for intaking voltage, the trig pin, for emitting soundwaves, the echo pin, for receiving the soundwaves, and one for ground. I connected the trig and echo pin to digital pins 2 and 3 on the motor shield, and connected the Vcc and ground to the 5v pin and ground pin on the motor shield. For my code, I used the Adafruit motor shield v.2 library again to program the robot to turn left then right when it senses an object close to it. Here’s a demonstration. First off, I programmed the robot to calculate distance. I did this by first calculating time. One of the “eyes” of the ultrasonic sensor sends out a soundwave for 10 microseconds, or one hundred thousandth of a second. The other sets a timer until the soundwave sent out bounces off the nearest object and is received in the other eye. I used a variable to store the time. However, I needed the distance, so I multiplied the time by the rate of the soundwave, which is just the speed of sound. But this will give me the distance between the ultrasonic sensor, the object, and back to the ultrasonic sensor when I only need the distance from the object to the ultrasonic sensor. So I divided the distance by 2. I then programmed the motors. To be able to do this, I split my robots functions into 3 states. The first state is the robot moving straight if it doesn’t sense anything in front of it. The second state is the robot turning left if it senses something in front of it. And the 3rd state is the robot turning right if it senses something in front of it AND it has already turned left before. I had a lot of trouble with the code because I needed to write out all the possibilities, and the entire code wouldn’t work if I forgot something. Another setback I had was that I had to move arduino, motor shield, and the battery around because when I mounted the sensor, the USB for the arduino wouldn’t fit. Somethings I plan to do for my next milestone is add the brush and sponge, and program the robot so it acts like a lawnmower and moves along the floor and turn 180 degrees when it sees a wall.
First Milestone


