Project

The Zambroombi: Roomba’s Next Ultrasonic Competitor

November 21, 2016 by Ryan Jones

The Zambroombi is the next step up from your neighbor's fancy Roomba. Set it and forget it!

The Zambroombi is the next step up from your neighbor's fancy Roomba. Set it and forget it!

"It changed my life. I don't know where I'd be today without it. I used to just have to clean everything once, but thanks to The Zambroombi, I get to clean everything twice!"  —Real Zambroombi© Customer

BOM:

The Zambroombi Bill of Materials

Why?

With the holidays approaching, I began to look at the calendar, and I became overwhelmed with stress. How am I supposed to host family gatherings AND cook and clean all by myself!? I knew something had to be done. Digging through my workbench for spare parts, I discovered the ultrasonic sensor and immediately went to work. Minutes later (easy project, try it out!), I held a new and fabulous household appliance, The Zambroombi!

The appearance leaves a bit to be desired, and the scooping design perhaps has an imperfection or two, but there is so much potential! The Zambroombi serves many functions: it sweeps up popcorn, it gives your dog a pal, it is even a friend to talk to at night. Add some bristles to a sweeping servo and give it a functioning tail, collecting and spreading dust across your house!

How?

The Zambroombi is such a great design because I can turn it on and let it run free. Its ability to calculate an object's distance and correct its own driving path means it can drive endlessly on its own—at least until it gets stuck on a potato.

Its astonishing ability to operate autonomously is based on the bot's ultrasonic sensor. The ultrasonic sensor functions by emitting high-frequency sound waves (too high for the human ear to detect), waiting for those sound waves to reflect off an object, and then calculating how long it takes for the sound to return to the sensor. The sensor has included send and receive pins labeled "trigger" and "echo," respectively, which perform most of the work for us. You can find more details about interfacing to the sensor module by looking through the code, found below in the orange code download button.

 

Notice the "T" for transmit and the "R" for receive

 

We need to control the high-frequency emission of the sensor. To do so, we need to send the sensor module a logic HIGH signal at least 10µs wide to the trigger pin. We first write the pin LOW, then HIGH, wait at least 10µs, and then write it LOW again. This will tell the sensor to emit the signal. When the sound has reflected off of an object and returned to the sensor, the sensor sends a digital signal to the Arduino, indicating the round-trip travel time of the ultrasonic signal.

digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);

To convert this distance in microseconds into a distance in centimeters, we need to do a few things. First of all, considering that the echo pin indicates how long it takes for sound to reach an object and return, we must first divide the echo-pin pulse width by 2 to determine the one-way travel time.

Sound travels at 340 m/s under typical conditions and with some simple math we find that this corresponds to 29 µs/cm. So far so good! To convert travel time to a distance in centimeters, we must divide the one-way travel time, in microseconds, by 29. Here is the code:

duration = pulseIn(echoPin, HIGH);
distance = (duration/2) / 29;

Now that we have our Arduino doing some basic math to convert the echo-pin pulse width into distance in centimeters, we can tell it to turn any time it is within 25cm of an object. To do so, we will use an If/Else statement. If the sensor is within 25cm of an object, turn; if not (else), drive forward. This could be considered a crude "obstacle avoidance" system, but it also ensures that the Zambroombi will drive right off the table if nothing is in its way!

To get the bot to turn, we will need to spin the wheels in opposite directions. Thanks to our handy Adafruit Motor Shield and the accompanying library, we can do this pretty easily by just telling one motor to spin forward and the other to spin backwards.

if(distance < 25){
 myMotor->run(FORWARD);
 myMotor2->run(BACKWARD);
}
 else{
  delay(40);
  myMotor->run(FORWARD);
  myMotor2->run(FORWARD);
 }
}

That's it! Find some bristles, scoops, squeegees, whatever you have lying around, and create a highly sophisticated household cleaning bot. As I mentioned earlier, attaching a servo with a sweeping mechanism would be funny and probably more useful than my scooper—so get out there and create The Zambroombi's next competitor!

 

Add a mustache like I did!

Obstacle_Avoidance.zip

Other MIT-i Innovations: 

 

Give this project a try for yourself! Get the BOM.

1 Comment