Build your first robot

Our completed computer-controlled robot can sense and avoid obstacles without user input.
Date:1 March 2012

Afforable parts and simple computing mean there’s never been a better time to get into robotics. By Gordon McComb

I wanted to start building robots the moment I saw the sci-fi movie classic The Day the Earth Stood Still (the original, mind you, not the remake). My initial attempt, shortly thereafter, was cobbled together from nothing more than random TV parts and scrap wire I had scrounged from my dad’s electronics junk box. The machine didn’t really do anything ““ other than get me into trouble. My father informed me that those “random” parts were actually rather pricey RCA valves.

Still, it was my first robot, and your first robot is one you never forget. Watching your creation do something as simple as scoot around the floor is exhilarating, particularly if you’ve built it from scratch.

Companies such as Lego and Vex offer inexpensive prefab robotics kits aimed at children and educators, but you’ll get far more flexibility in the long run by learning to build a true, circuits-to-servos DIY robot. Plus, it has never been cheaper or easier to put one together, and the result of your efforts will greatly exceed what was possible even five years ago. (Trust me, I’ve been at it for over 20 years.)

Best of all, robot building offers something that’s increasingly rare in the world of electronics: the opportunity to create a moving, working machine with your bare hands. I’ve worked with Popular Mechanics to design a robot project that anyone with a bit of technical skill can complete, even if you’ve never built a bot before. It’s affordable, readily expandable, and a great deal of fun.

Defining the bot
Our double-decker beginner bot uses a miniature computerised brain to move across the floor, mindful of nearby obstacles. If it (gently) hits something or someone, the robot emits an apologetic tune, backs up, and sets off in a new direction. In terms of basic behaviour, it’s a bit like a Roomba self-driving vacuum cleaner. To DIY roboticists, this style of machine is known as a roving bot.

We’ve also designed the robot to work with almost any universal remote control, so you can manually command your robot to stop, start and turn. We’ve tried to keep it to a reasonable ambition level: it should take 2 hours or less to construct, and it doesn’t require special tools. There’s no circuit assembly, and only basic soldering is needed.

At the heart of our bot is an Arduino microcontroller board that’s small enough to be powered by a 9-volt battery. This microcontroller serves as a small programmable computer that connects software to actual, real-world functions. Programs, or sketches (in Arduino-speak), tell the microcontroller what to do. You use a personal computer to create sketches; then those sketches are uploaded via USB cable to the internal memory of the micro-controller. Sketches can do things such as run motors or monitor the state of switches and sensors.

We chose the Arduino microcontroller because it is designed specifically for DIY projects such as ours, and because it’s open-source, meaning that its hardware and software designs are open for modification and free of licensing fees. Since it lowers the entry barrier to robotics in virtually every sense, from cost to difficulty, the Arduino is becoming something of a superstar in the world of bot builders.

Software for programming the microcontroller is free to download from the official Arduino site and is relatively easy to use, because it was designed not just with programmers in mind. It runs on both PCs and Macs and includes intuitive tools that allow bot-builders to download and install ready-made programs. The vibrant community of Arduino users has even designed super-simple, graphical-software-design apps, such as Modkit and Minibloq. These ease the learning curve not just for Arduino, but for basic programming in general.

The Arduino gets wired to your robot’s hardware through a breadboard. Also known as a plugboard, this device routes electronic signals from one part of the robot to another. Breadboards make it easy to wire everything quickly and reconfigure your connections on the fly without hard-soldering everything together. It’s a sort of switchboard for your robot’s servos, sensors, switches and processor. If the Arduino is the bot’s brain, this is its nervous system.

Our bot uses two gear motors for propulsion, with a free-rotating castor out front. These motors are specialised versions of radio-control servos typically used for model planes. Instead of rotating just a few degrees, they keep turning. This type of motor ““ the continuous-rotation servo ““ is both low-cost and easily screw-mountable. The servos live on the bottom of two decks, which are separated by risers. The twin-deck design leaves ample room for mounting electronics.

Building the bot
Our parts list is modest; that way, we could keep costs down and make our project simple. But you’re probably not going to find most of the bits and pieces at your local electronics store; you could try Electronics123 or Yebo Electronics. Many bot-builders do their shopping online; one local source is and Yebo, at Our build had just under 20 parts, excluding screws, bolts and wires. We’ve published full, step-by-step instructions online at, along with a complete parts and purchasing guide that, although US-oriented, should give you a good start. We also provide preprogrammed, downloadable Arduino sketches. There’s plenty of flexibility when it comes to the body material and shape: our plans use PVC sheet plastic, but almost any lightweight material about 5 mm thick will do. So feel free to modify the platform design. With a two-level robot, you’ll want to start at the bottom and work your way up.

The lower deck of our bot holds the two battery packs and all of the mechanical bits and pieces. A dedicated AA-battery pack for the servos is fixed to the top of the deck with adhesive Velcro strips for easy removal. The servos that turn the wheels are locked down with machine screws, plastic mounts and L-brackets. The whisker switches are thin leaf springs bolted to the front of the bot, each encased in aluminium tubing for protection.

The top deck is home to the Arduino microcontroller, as well as the speaker and the breadboard. The Arduino sits on a bolt-on mount; the speaker, the breadboard and the battery case are mounted with double-sided tape.

The two levels of the deck are connected by four thin deck risers. Once the decks are screwed into place, the rest of the build is a matter of wiring: connect 22-gauge wires from the servo, the switches, the infrared receiver and the speaker to the breadboard, then connect the breadboard to the Arduino.

Operating the bot
Now comes your Dr Frankenstein moment: testing the robot for signs of life. Directly connect the 9-volt battery to the Arduino, then link the AA-battery pack to the breadboard. Connect the Arduino to a PC or Mac via a USB cable and open the Arduino app on your computer. If you were writing your software from scratch, this is the point at which you’d sit down and do some programming. You can experiment, but to get you started we’ve supplied a full-featured sketch, downloadable from our Web site. Still, if you use our code, examine it in the Arduino app and you’ll start to pick up on the basic logic pretty quickly. (For a much simpler sketch, take a look at the LED-flashing Blink program included with the Arduino software.) When you’re ready to test a sketch, connect your robot to your computer via USB and click the Upload button. This will install the software, and should bring the robot to life.

As designed, our robot has three core capabilities: it can be driven with a universal remote control, it automatically senses when it hits an obstruction, and it reverses itself out of trouble. But the truly great thing about a roving robot is that it’s easy to modify and expand its behaviours. Our robot can take on new missions with simple programming and hardware changes ““ there are countless tutorials for basic Arduino programming online.

Don’t be afraid to try new things, or to dive right into the code of a sketch and start messing around with variables. If something doesn’t work or doesn’t behave as you want it to, just reload the demo program we’ve supplied and start again. In addition, robotics hobbyist sites such as SparkFun and Adafruit offer a multitude of hardware add-ons for Arduino bots. Adding infra-red sensors can enable basic object identification or collision avoidance. You can even install a small camera to record stills or video from a bot’s-eye view. These upgrades are neither expensive nor complicated.

Robots are ideal entertainers. I took a prototype of our project to my father’s 91st birthday party ““ five generations of my family were all engrossed in some red plastic scooting across the floor. Even my dad enjoyed it, though he couldn’t help himself when he asked, “So, where are the vacuum tubes?”

What’s in a robot, anyway?

Arduino microcontroller: *R270
Servomotors: R195
Precut base (optional): R150
Wheels: R90
Wires: R50
Breadboard: R50
Leaf switches: R25
Battery holder: R15
Battery clip: R15
Speaker: R15
IR module: R15
Castor: R8
Various hardware: R60
Arduino software: FREE
Total build cost: R750 – R1 000

* See or Yebo Electronics at

For information (parts list, FAQ, templates and extra goodies) and step-by-step instructions on how to build your first robot from scratch, visit

Build your second robot
So you’ve built, rebuilt, programmed and modified your first robot. Chances are it won’t be your last. Here are three next-level DIY robotics projects.

Track Bot
A track-driven robot is a fantastic follow-up project in terms of both difficulty and utility. This can be constructed with as few as two drive motors, carry heavier loads than a castor robot, and, most importantly, handle off-road (or, rather, off-floor) operations on dirt, grass or carpet.

Holonomic Bot
Holonomic bots, a type of omnidirectional bot, use a trio of specially designed wheels, each with its own set of tiny castors, to move in all directions. They are especially well suited to camera-centric projects ““ these guys can turn on the spot, move laterally, or rotate in place.

Walking Bot
Walking robots are an order of magnitude more complex than wheel- or track-based bots, but they’re not beyond the reach of a garage tinkerer. Build difficulty varies, depending on the number of legs and joints, but the payoff is huge: whether it has eight legs or two, a walking machine is a robot in the purest sense.

— Gordon McComb is the author of Robot Builder’s Bonanza. Find it online at

Latest Issue :

May-June 2022