Two Wheeled Robot

Building Robots

Here we will document our attempt to build a 2 wheeled robot.


motor shield2 wheeled platform

Parts ordered.

We are using this 2 wheeled platform from Make, along with an Arduino and a motor shield from Adafruit.


Parts received and the unpacking begins!

Bot PartsMotor Shield

As you can already see, the holes in my top shield from my Make kit are a little different than the one they have pictured.

I don’t expect this to be a problem, but won’t know until I start adding sensors and stuff.


Now to make the motor shield kit.  First check the instructions here and make sure you have all the parts.

Motor Shield 1

Here I have soldered the resistors and ceramic capacitors.

Motor Shield and tape

Next I soldered the reset button and have taped the resistor network in place, making sure it is in the correct way.

I then soldered one lead on each end, then removed the tape and finished soldering the leads.

Motor Shield 2



Now we have soldered the 2 L293D motor driver chip sockets and the 74HC595 chip.

The sockets are optional and you could solder the chips directly onto the board.  We chose to use the sockets in case we burn out a chip.

We then soldered all of the remaining capacitors.  Be careful you read which ones are which.

Ours were colored exactly the opposite of the ones in the tutorial.

You should have 3 three 100uF capacitors and 2 47uF capacitors and these are polarized.


Motor Shield Done

All done soldering the motor shield.

Good thing I had extra headers as I botched a few in cutting them.

Now to upload a sketch and test the shield.


Motor Test

I had an extra small motor lying around and the robotic platform came with this plastic five AA battery holder.

Wired the motor to M1 and hooked the battery pack to the external power source (make sure the positive and negative go in correctly).

Used a 9 volt battery to power the Arduino. Then I downloaded the AFmotor library from Adafruit and used the sample sketch MotorTest.

Yahoo – it works! This verifies that I made the motor shield correctly.  Also note the small green LED goes on when you hook up the AA battery five pack.


Robomount 1Robomount 2Robomount 3

Now we have assembled the wheels and base of the robot.

It is pretty straightforward.

Use the longs screws to mount the motors onto the base.


Robot SideRobot Top

I have added the 2 main parts together, using a 9 volt battery to power the Arduino and shield and the 5 AA battery pack that came with the robot kit.

I tested the robot with the Motor Test example sketch included with the AFMotor library.

Since this sketch only has one motor, I doubled it up and added a second motor.

For example, where it says:;

I changed it to:;;

Where MotorL is the left motor and MotorR is the right motor.  See the entire test code here.

So far it works great except for the left motor doesn’t go backwards. This will need some investigation.

I also discovered I have a Sharp GP2Y0A21 Distance Sensor I would like to try and use, but will have to figure out how they work.

We have a working robot!


Did some re-soldering and adjusting.

Moved a motor from M1 to M3 and now both motors go forward as well as backwards.

Now to get the Sharp sensor to work properly so we don’t bump into things.


It isn’t pretty and has a bad hairdo, but it works.

The robot can detect objects and back up!


Using a Maxbotix EZ1 Sonar Range finder as the main front sensor.

Switched the 9 volt battery powering the Arduino to an AA 4 pack as I want to add more sensors.

Also got some Sharp GP2Y0A41SK0F 4-30cm distance sensors.

Working on adding them as bump sensors as they detects objects between 4 and 30 cm away.


New and improved video with obligatory electronic music courtesy of Devegoo.  Of course the song is called Android Online.

Three sensors in the front and one in the back.


Arduino code


Here is a more complete parts/price list.  You may be able to find the parts elsewhere or at a better price.

1. Motor Shield from Adafruit – $19.50 Allows you to control the motors easily.

2. Arduino Uno – Under $30.00 The brains of the operation.

3. Robot Platform from Make – $45.00 Wheels, motors and the actual platform.

4. Maxbotix Range Finder From Pololu – $24.95 You could certainly buy a cheaper sensor, like this Sharp Distance Sensor for $9.95, but we had the Range Finder.

5. 9 Volt Battery Holder from Adafruit – $4.00 This is ok for powering the Arduino to start with, but if you add a lot of sensors you will need more amps than a 9 volt battery can supply.

6. Some other miscellaneous stuff you might need – 5 AA batteries, 1  9 volt battery,  extra hookup wire, an extra on/off switch, LEDs (We used a green one for when the robot when forward and a red one for when it backs up)


Also check out our four wheeled robot.


Robot Living reader Daniel G has made a robot as well. Nice Job Daniel.

Daniel’s robot onYouTube
See Daniel’s code here.


13 Responses to Two Wheeled Robot

  1. yuveer says:

    thanks dude. got my motors running at a higher voltage and they seem to be going well. cheers

  2. Chief Robot says:

    No, I did not use PWM directly. The shield from Adafruit uses a motor library.
    See the link to the rest of my code up above.
    Here is where I set up the motors

    //AF_DCMotor motor(2, MOTOR12_64KHZ); // create motor #2
    //frequency is how fast the speed controlling signal is.
    //For motors 1 and 2 you can choose MOTOR12_64KHZ, MOTOR12_8KHZ, MOTOR12_2KHZ, or MOTOR12_1KHZ.
    //A high speed like 64KHz wont be audible but a low speed like 1KHz will use less power.

    AF_DCMotor motorL(1, MOTOR12_1KHZ);
    AF_DCMotor motorR(2, MOTOR12_1KHZ);

  3. yuveer says:

    Ok thanks
    I am using the same motors as you – they with the 2WD Arduino Platform so the specs are the same as yours. Unless my motors are damaged somehow.
    I have managed to get my motors to spin but the problem is that they give “weird errors” when i try to control the speed via PWM.
    Does PWM work fine with your motors? My goal is to get the PWM speed control right.


  4. Chief Robot says:

    I’m using the motor shield from Adafruit which appears to use the L293D motor driver chip.

    4 H-Bridges: L293D chipset provides 0.6A per bridge (1.2A peak) with thermal shutdown protection, internal kickback protection diodes. Can run motors on 4.5VDC to 36VDC.

    Probably powered between 7 -8 volts (whatever the 6 AA batteries supply).
    I don’t know what regulators I’m using. All I’m doing is placing the motor shield onto the Arduino. The motor shield handles all of those requirements and is very easy to use.
    The most important factor here is what motors are you using and what are the specs and or do you have the datasheet?

  5. yuveer says:

    Hi Chief Robot
    I am using 5 rechargeable batteries (2700 mAh) which produce a voltage of 6.5V. I am using one battery pack to power both the microcontroller and the motors. I guess this is a bad idea, and i will try to use 2 separate power supplies and see if that works.

    I use an L293E motor driver and when I tell my motors to spin clockwise, all they do is “whistle”, even though i measure 3V accross the motor terminals. I think its the single power supply causing the problem.

    Was hoping you could answer the following questions:
    What is the your total battery output voltage?
    What voltage are you running your motors at: 3V or 6V?
    Are you using linear regulators or switching regulators?
    Are you using any particular motor driver? (like an L293E perhaps?)

    I’d REALLY appreciate it if i you could provide me with some kind of schematic of your power supply and motors. I have been struggling to get this to work on my 2WD arduino platform for the last 2 weeks and its driving me crazy.

    Best Regards,

  6. Chief Robot says:

    The motors should use their own power supply.
    I am using a separate power supply of 6 AA batteries just for the motors.
    Hope that helps.

  7. yuveer says:

    The motors which come with the robot platform are giving me some problems. They keep “whistling” when i power them via a motor controller.
    Please could you provide a schematic of your power supply for this robot.


  8. Alex B says:

    Looks like the Maker Shed robot is a DFRobot platform, I found these assembly pictures helpful

  9. keerthi says:

    could we get those parts required for this bot??????? the cost of it?

  10. Chief Robot says:

    I’m not sure what size 340 is. Here are the motor specs:
    2WD Mobile platform Motors: 3-6V DC
    Speed: 70cm/S
    Dimensions: 170mm (diameter)

    Gear Ratio 1:120
    No-load speed(3V):100RPM
    No-load speed(6V):200RPM
    No-load current(3V):60mA
    No-load current(6V):71mA
    Stall current(3V):260mA
    Stall current(6V):470mA
    Torgue (3V): 1.2Kgcm
    Torque (6V): 1.92Kgcm
    Size: 55mm x 48.3mm x 23mm

  11. Felix Just Hawk says:

    Hi I got one question, is the motors 340 size?? I realy need to know, so i ask PLEASE respond fast. Thx Felix

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.