How To Make an Obstacle Avoiding Arduino Robot

Hello all! In this Instructable I’ll be showing you how to make a robot similar to the “Mobile Arduino Experimental Platform” (MAEP) that I made. It is equipped with two motors that can steer the robot and the ability to see obstacles in front of it with a PING))) ultrasonic sensor.

With the attached breadboard, you can do more electronics experiments, fool around with different sensors, etc. This project can teach you about electronics, programming, and robotics. It is also a fun toy to entertain younger siblings and pets (just be sure they don’t break it!).

Here is a video of what MAEP will do when it is done:

Step 1: Parts

Here’s everything you need to make MAEP. I tried to provide links to where you can buy these parts from, which is the official shop of EDIT: YourDuino and LMR are now separated and YourDuino is no longer giving money to LMR, however they still have pretty good prices so feel free to shop there.

– Arduino compatible microcontroller. I used an Arduino Uno, so I recommend one if you wish to follow closely along with this tutorial. There are also some Arduino based controllers that are designed specifically for robotics that may be helpful, but you’ll have to find your own method of mounting those. You can buy a copy of the Uno from YourDuino which I believe is completely compatible:

–  Breadboard. Make sure it’s not too big, or else it won’t fit. However, we want it to be as big as possible so we have more room for electronics. This is good:

– A standard old 9 volt alkaline battery (which you can probably find at home), as well as a barrel jack connector to hook it up to your Uno easily (not required, but again, easier):

– A power supply for the motors. I don’t believe the power supply I chose is the cheapest or best option, so I’m not going to recommend it to you. I used a 4.8 volt rechargeable NiCad battery, but it’s probably easier to just use a 4 AA battery holder (no need to buy a charger that way)

– A bunch of Boe-Bot hardware for the chassis. Unfortunately, you can’t get this from YourDuino, so look at Parallax, the manufacturer’s website. You can choose either to buy this: which comes with tons of extra components you don’t need (although may be useful someday), or you can buy all the components in the following list from Parallax and no, I’m not gonna provide a link for each one:

Stock # Quantity              Product Name

700-00002            8             Panhead screw, 4/40, 3/8

700-00003            8              4/40 x 3/8″ Nut

700-00009            1             Tail Wheel Ball

700-00015            2              #4 Nylon Washer

700-00022            1              Boe-Bot Aluminum Chassis

700-00023            1              Cotter Pin-1/16″ Diameter

700-00025            1              Rubber Grommet-13/32″ Hole Diameter

700-00028            4              Panhead screw, 4/40, 1/4

700-00060            2              Standoff, threaded aluminum, round 4-40

721-00001            2              Wheel, Plastic, 2.58 Dia, .3 W

721-00002            2              Rubber Band Tire for 721-00001

900-00008            2              Continuous Rotation Servo

– Wire to hook things up will be necessary. Some male-to-male jumpers will do the trick:

– Finally, the PING))) sensor and mounting bracket, so that your robot doesn’t kill itself:

As for tools, all you need is a phillips head screwdriver, a computer, and one of those standard USB printer cables. The Arduino Uno I provided a link for has a cable included.

Now lets get building!

How To Make an Obstacle Avoiding Arduino Robot

Step 2: Centering Servos

First, we need to calibrate the servos so that our robot stops when we want it too.

Actually, before you do that, you need to set up the Arduino with your computer! Go do this quick little tutorial here:, and then come back (I’ll be waiting).

Finished? Good! You should now be able to get your Arduino blinking an LED. Now, you’re going to get it to center your servo motors. Download the attached Arduino file (.ino) and open it with the Arduino IDE. Next hook up your servo motors like in the picture. The black wire should be connected to ground on your Arduino (labeled “GND”),  the red one to 5 volts (labeled “5V”), and the white one to pin 11 (labeled “~11”). Make the connections from the Arduino pins to the servo with some male-to-male jumpers.

Now, upload the program to your Arduino board. Once it runs, one of two things will happen:
1) Your motor won’t spin: You’re done! Now go back and repeat for the other motor.
2) Your motor will spin. Adjust the potentiometer (see picture 2) with a phillips head screwdriver to stop it from spinning. Slowly turn the screwdriver in either direction until you find the setting that makes it stop. Remember to be gentle and turn slowly… otherwise you’ll probably overshoot and have to turn the screwdriver the other way.

Step 3: Attach the Arduino to the Chassis

To attach the brains of the robot, you’re gonna need the four panhead screws, spacers, and nylon washers. Make a sandwich like in the picture, with this order from top to bottom: screw head, washer, Arduino board, standoff. Attach the standoffs on the two mounting holes on the right side of the Arduino (the side opposite the USB connector and barrel jack).

Once you have the standoffs firmly attached to your Arduino, line up the bottom one with the bottom of the backmost mounting strip (um… just look at the picture). Attach that into place, then line up the front standoff with the next mounting strip, and screw that in place. Yippee, you’re done!

Note: There’s a zip-tie in the picture because I did step 4 before this one… then realized that it’s easier to do this step first.

Step 4: Attach the Motor Battery

I gave you a lot of freedom in choosing a battery to power the motors (just make sure it’s from 4.8-6 volts), so I don’t have much to say here. There are various ways you can attach it/them, I’ll name some:

– If you’re using a 4 AA battery pack, use the screw holes on the chassis
– I used a zip-tie through some of the mounting slots to attach the NiCad battery I used
– Double sided tape
– Velcro
– Used chewing gum

Also, insert the little black rubber grommet into the hole in the center of the chassis and route the battery wire through that.

Step 5: Motors!!!!!

Now it’s time to make put the M in MAEP (M=Mobile, remember?). Your servos should come with black “servo horns” attached to them already. Unscrew them and pop them off. You don’t need them anymore, but be sure to save the screws! Next, put a rubber band “tire” on each wheel. This is really, really difficult, but keep trying.

Using the eight 3/8 inch panhead screws and nuts, attach the two continuous rotation servo motors to the chassis. Insert them into the cut-outs from the inside of the chassis, and then secure them firmly in place with the motor shaft towards the back of the robot. Use the pictures as a reference.

Once you have that done, thread the wires from the motors up through the hole in the middle of the chassis. Pop a wheel onto each motor shaft, and using the screw that attached the servo horn, attach the wheels to the motors.

Step 6: Tail Wheel

As of now, your robot is probably awkwardly leaning backwards… that’s why it is time to insert the tail wheel! Take the little black ball, and line the holes in its side up with the holes on the back of the robot (see pictures). Then, insert the cotter pin through all these holes, and fold up the two ends so that it can’t come out. Now you’re robot should stand level, and have a low friction caster for turning.

Step 7: De-blinding the Robot

How To Make an Obstacle Avoiding Arduino Robot circuit
Okay, here’s something else I’m not going to walk you through. Take your Parallax PING))) (yes, it is spelled with those three parentheses) sensor and mounting bracket kit and build it according to the instructions. The only thing you don’t need to do is attach the included cable (well, you can, but I’m doing something different and more efficient). Attach the whole shabaam onto the robot like they tell you too, and you’re done with this step.

Note: In the pictures you’ll see something attached to the bottom of the motor that my PING))) sensor is mounted on. Ignore it, it’s from another project I did with this robot.

Clip to Evernote

Leave a Comment

(Spamcheck Enabled)

Read previous post:
personal CNC machine
Othermill on Kickstarter: a robust, personal CNC machine for milling circuit boards and more

My friend Jonathan Ward and the rest of the team at Otherfab have posted their new CNC milling machine, the...

Scroll to top