You Are Here: Home » AVR ATmega Projects » Ard-e: The robot with an Arduino as a brain using microcontroller

Ard-e: The robot with an Arduino as a brain using microcontroller

Hopefully after reading this instructable you will be able to take your first step into robotics. Ard-e cost about $90 to $130 depending on how much spare electronics you have lying around. The main costs are:
Arduino Diecimella- $35
Bulldozer kit- $31
Servo- $10 I got mine at a local hobby store
Worm gear Motor- $12
Various other Electronics- around $10 radioshack or
Sensors- anywhere from 0 dollars to $28 depending on how many you want and how extensive your pile of junk electronics is
So with spending around $100 you get a remote control robot with a pan and tilt system that could be used to aim a camera, a hacked airsoft gun ( ) or you could attach a laser to it because thats what you have lying around. If you wanted to be really cruel you could attach a dvd laser to it and burn whatever you wanted ( )

robot with an Arduino as a brain

In addition to making the pan and tilt system that is remote controlled you can also buy about three dollars worth of chips, attach sensors to Ard-e and make him fully autonomous. For around a hundred dollars you can build your own robotics system that has most of the functionality of a roomba or a lego-mindstorms robot: It can sense when it bumps into something be programmed to avoid what it bumps into, it can follow the brightest light, smell pollutants, hear sounds, know precisely how far it has gone, and be controlled by an old recycled remote control. All of this for about half of the price of commercial units.
This is my entry into the RobotGames robot contest so if you like it make sure to vote for it!

Note- Originally I was going to enter the remote controlled version only as my entry to the contest but since the deadline was pushed back Im gonna show you how to make Ard-e run himself.

So on to how to build Ard-e

Step 1: Build your Bulldozer

So once you get your new bulldozer kit either in the mail or at your local hobby shop you have to put it together. These kits from Tamiya tend be a little on the expensive side but they are worth it. I found the worm gear box that I use to pan the laser in a box of old projects covered in dust, it hadnt been touched for maybe three years. After blowing off the dust and hooking it up it ran fine.

A pocket knife or leatherman should be all the tools you’ll need to set up the bulldozer. The instructions are step by step and easy to follow even if the English is a little shaky. Since I wasn’t planning on using Ard-e as a really weak bulldozer I didn’t attach the plow.

The dc motors that drive the bulldozer are controlled by the double pole double throw (DPDT) switches that make up the controller. I added a diagram about how to hook up your own DPDT switch to control a motor because I later end up controlling the panning motor with another DPDT switch. Hopefully the diagram makes it clear that the switch when thrown one way makes the motor turn one way and when thrown the other it turns the other way.

Step 2: Assemble the pan and tilt system

Assemble the pan and tilt system

So you now have a base for Ard-e that is engineered and constructed well (hopefully the English in the instructions didn’t throw you off too much). Now you need to build something that this base can drive around and do cool stuff with.

I chose to put another DC motor and a servo on it as a pan and tilt system that could be used to aim whatever you wanted. The servo is controlled by the Arduino and the panning motor is controlled by a DPDT switch that I bought at radio shack for around two dollars.

To control the servo I wrote some code in the Arduino software environment that reads the voltage drop off of a potentiometer and converts that to the angle that the servo should be moved to. To implement this on the Arduino you hook the servo data wire to one of the digital output pins on the Arduino and the plus voltage wire to 5V and the ground wire to ground. For the potentiometer you need to connect the outer two leads to +5V and the other to ground. The middle lead from the potentiometer should then be connected to an analog input. The potentiometer then acts as a voltage divider having possible values of 0V to +5. When the Arduino reads the analog input it reads it from 0 to 1023. To get an angle to run the servo at I divided the value that the Arduino was reading by 5.68 to get a scale of roughly 0-180.

Heres the code that I used to control the tilt servo from a potentiometer:

#include <Servo.h>

int potPin = 2; // selects the input pin for the potentiometer
Servo servo1;
int val = 0; // variable to store the value coming from the potentiometer

void setup() {
servo1.attach(8); //selects the pin for the servo

void loop() {
val = analogRead(potPin); // read the value from the potentiometer
val = val / 5.68; //convert the value to degrees
servo1.write(val); //make the servo go to that degree
Servo::refresh(); //command needed to run the servo

If you need help working with the Arduino like I did then I highly suggest going to Its a fantastic open source website that is really helpful.

So after testing the control of the servo and the switch I needed a place to put them. I ended up using a piece of scrap wood cut to about the same length as Ard-e and screwing it into the back board with a piece of aluminum bent at a 90 degree angle.

I then installed the DPDT switch and the potentiometer into the controller. It was a tight squeeze and I had to drill another hole in the top of it to run wires out of but overall it worked out pretty nicely. I also ended up soldering wires onto the existing controller circuitry to power the worm gear box.

I really probably should have used another servo for the panning but the hobby store I went to only had one of the ten dollars ones and the motor can turn 360 degrees unlike the servo. The motor is a little too slow though.

Now on to testing.

Step 3: Testing and making the remote controlled version of Ard-e

So before we start driving Ard-e we need to make the Arduino mobile. All that you need for the Decimilla to become mobile is a 9 volt battery connected to a plug that fits into the external power supply. I ended up cutting the power cord from an old transformer and got a nine volt batter clip by taking apart an old nine volt. The jumper also needs to be moved from the usb power to the ext power. If the battery is hooked up correctly the power light on the Arduino should light up. If not you probably got the polarity wrong and should switch the wires. I did this at first and it didn’t cause any damage to the chip but I would not recommend doing it for long.

Now you should test to see if everything is working as you expected. Attach something to the pan and tilt system like a camera or led. I used a laser zip-tied to the servo because it fit nicely and I had one laying around. Drive Ard-e around and try to not shine the laser into your eyes.

When I first put Ard-e together I put the Arduino behind the controller and taped it in place. With this set up every time I ran either the driving motors or the panning motor the servo would go to the 0 degree position. Apparently the running of the motors would interfere with the timing control pulse and make the servo think that it was supposed to be at 0 degrees. I figured this probably was because of how long the control wire on Ard-e’s servo was. It had to the run from Ard-e to the Ardunio behind the controller all the while being in close proximity to the wires carrying the current to the motors. These wires induced alot of noise into the control wire and made it go to 0.

To fix this problem I moved the Arduino from behind the controller to on Ard-e. Note the very professional looking duct tape mounting of both the servo and the Arduino. This eliminated the motor wires inducing noise and fixed the problem. The long wires then just carried the power to and input signal from the potentiometer instead of the power and control signal for the servo. The noise from the motor wires now affects the reading of the potentiometer which has little to no effect on the degree that the servo is driven to.

So you now have the remote controlled version of Ard-e. Basically you just made a really cool home built car that you can drive around and point at stuff with. The Arduino is underused to say the least. Ard-e right now is using 1/6th of his ability to sense the analog world and 1/14th of his digital I/O capabilities. You could save yourself some money and just take out the servo and Arduino if a home built car is all you want…. But if you want to really sink your teeth into robotics read on about how to make Ard-e drive himself.

Step 4: Ard-e on Auto: Using the Ardunio to drive the DC motors

So if you wanted to use the Arduino to control the motors you cant just hook them up to one of the output pins because the Arduino wont supply enough current to drive them. To use it to drive them you need to buy a motor driving chip or a motor shield for the arduino. has one for $20 or you can just buy the chips that she uses from digikey . The chip that is commonly used is a L293 or other similar H bridge motor driver chip. This site has the pinout of it and some details about running a program on it

The chip basically takes three inputs, one PWM input that sets the speed of the motor and turns it on and off and two inputs that determine the direction that the motor spins. The PWM pin is the Enable of the L293, the two pins that determine the direction of the motor spins are the Inputs 1A and 2A. The motors are connected to the outputs 1Y and 2Y. The L293 can control two DC motors so once you get it hooked up to the Arduino Ard-e can drive himself.
The data-sheet for the L293 can be found at

I ended up ordering two of the L293 chips from and they cost me about $7. After a few hours of trial and error I finally got the Arduino to drive both of Ard-e’s motors. I didn’t read the data-sheet carefully enough because I originally was using 3V to try and run the L293 when it obviously (now at least its obvious) needs at least five volts. So after numerous trips to here is the code I used to test drive Ard-e’s motors:

int diraPin = 10;
int dirbPin = 9; //These two have to be opposite digital values to spin the motor if they are both HIGH or both LOW then the motor is actually braked.
int enablePin = 11; //This pin sets the speed of the motor and needs to be a PWM pin.
int dira2Pin = 2;
int dirb2Pin = 3;
int enable2Pin = 5; // These are used in the same way to drive the second motor.
int val = 0; // Variable used to set the speed of the motors.

void setup() {
pinMode(diraPin, OUTPUT);
pinMode(dirbPin, OUTPUT);
pinMode(enablePin, OUTPUT);
pinMode(dira2Pin, OUTPUT);
pinMode(dirb2Pin, OUTPUT);
pinMode(enable2Pin, OUTPUT); // Declares all of the pins as outputs.

void loop() {
val = 175; //A value used for setting the speed of the motor, about 70% of its speed.

//Spin motor 1 backward for one second
analogWrite(enablePin, val); // Set the speed of the motors with PWM
digitalWrite(diraPin, LOW);
digitalWrite(dirbPin, HIGH);

//spin motor 2 backward for one second
analogWrite(enable2Pin, val);
digitalWrite(dira2Pin, LOW);
digitalWrite(dirb2Pin, HIGH);
delay(1000); // If you switch which direction pin is high and which is low the motor will spin a different direction.

//spin motor 1 forward for one second
digitalWrite(diraPin, HIGH);
digitalWrite(dirbPin, LOW);

//spin motor 2 forward for one second
digitalWrite(dira2Pin, HIGH);
digitalWrite(dirb2Pin, LOW);

// stop for a second
analogWrite(enablePin, val);
analogWrite(enable2Pin, val);

So to test this out on Ard-e I ended up putting a breadboard onto the addition that had previously held the pan and tilt system. I also moved the Arduino right next to the breadboard for easy prototyping. I also had to add another two AA batteries so the the L293 would have the 6V it needs to power the motors.

Heres a quick video of Ard-e running this program. One of the motors spins faster than the other so he veers towards the camera near the end of it. I don’t really know why this happens…

 So once you write all of the code and rearrange the components to make the Arduino boss around the L293 and get those pesky DC motors under control Ard-e’s possible uses increase dramatically. All you need now are some sensors.

Leave a Comment

You must be logged in to post a comment.

Read previous post:
Wind Energy Update: Building Turbines on Sand: More Research Needed

(PRWEB) June 08, 2011 A distinguishing feature of offshore wind turbine structures is that the turbines impose a large horizontal...

Scroll to top