Arduino Playground is read-only starting December 31st, 2018. For more info please look at this Forum Post

Intro

I have yet to see any build notes on the 'Net for getting this kit up and going, and it does not come with instructions other than the very basic ones at the Makershed store. This is my attempt to fill in that gap. I've tried to read-between-the-lines and figure out the intentions of the manufacturer and put together as close to a "stock" build as possible, so others can plan and implement their own builds. I would welcome corrections from those more in the know. (send to: flippy.qa76 AT gmail DOT com)

Materials

The Makershed catalog page for the 2WD kit says you need an Arduino and "Motor Shield" (though it doesn't specify which one) to get it working. Since the only motor shield Makershed carries as of this writing is the Adafruit one, I went with the following materials list:

  • the 2WD kit itself
  • Arduino Uno (the Uno was released after the 2WD kit, but as far as I can tell is form-factor compatible with earlier Arduino USB devices)
  • Adafruit Motor Shield
  • a couple extra scraps of wire
  • 4 stand-offs & screws
  • 5 NiMH AA batteries. (Get the highest mA rating you can find.)

If you choose, as I did, to give the Arduino a separate power supply from the Motor Shield, you'll also need:

  • 9-volt battery
  • 9-volt battery clip
  • 2.1 mm round male power plug

If you want to expand on the 'bot by adding sensors, etc., you will probably also want some extra header pins (breakaway-style). The Motor Shield exposes pins 2 and 14 through 19 of the Arduino, but does so with a solder hole. The header pins will give you something nicer to play with.

A word about power: According to the catalog page for the 2WD kit, each motor is 3-to-6 VDC, with a stall current of 470 mA at 6V and 270 at 3V. The Adafruit Motor Shield can supply a maximum of 600 mA per motor, more than enough to not burn out on those motors. This is another clue it is the intended controller for a stock build. Further, the battery holder that is shipped with the 2WD kit is a 5-cell AA holder. AA NiMH cells are 1.2 volts each; five wired in series gives us 6V total. This tells me the intention is to run the 'bot at 6 VDC. Again, I'm speculating on the manufacturer's intention for the kit, but so far all the pieces are leading to this conclusion.

Tools

  • small screwdriver
  • drill press
  • soldering iron
  • wire stripper
  • multi-meter
  • patience and time!

Contents of the 2WD Kit

The catalog page isn't very specific. My version of the kit had:

  • 2-piece metal frame (top & bottom). The vertical supports are one piece with the bottom frame and were shipped pre-bent into position. One of the supports on mine had a crease about 1/3 of the way up, but I easily bent it back into shape.
  • Several smaller frame pieces to use for mounting sensors, etc. These are optional to install.
  • 2 wheels
  • ball caster
  • 2 motor/gear assemblies
  • on/off switch
  • female power jack
  • battery holder with 5-AA capacity
  • short length of 2-conductor cable
  • Many assorted screws, washers, nuts

Assembling the 2WD Kit

Step 1: Attach the motors

Attach the motors to the bottom frame piece. Use the long screws with the appropriate nut & washer to attach the motors. You can go ahead and press the wheels on now if you like (I did).

Step 2: Install the ball caster

Attach the ball caster to the bottom frame piece. Hopefully it's obvious where that one goes. :)

Step 3: Install the battery housing

Install the battery housing over top of the ball caster. There should be two counter-sunk screws for doing this. The frame is pre-tapped to receive them, so no nut required.

Step 4: Wire the motors

I did it later, but now would be a good time to go ahead and solder your wires to the motor leads. Otherwise it'll be harder once you get the top frame piece on. Learn from my pain. :)

I cut the included 2-conductor cable into three roughly-equal lengths, one each for the motors and one for supplying power to the motor shield (more on this later). The cabling worked well with those lengths of wire.

Step 5: Prepare the top frame piece

Supposedly the top frame piece comes pre-drilled for everything you need. Mine had two minor problems that required surgery:

  • The hole for the on/off switch was just a little too small for the included switch. Presumably the switch sent with mine was a slightly different model than the one they used when designing the kit. I reamed it out a bit on the drill press and it worked fine.
  • The Arduino Uno has four holes for attaching stand-offs, but only three lined up with holes on the frame. I don't know if this is a design flaw or manufacturing oversight. Anyhow, I very carefully marked the position of the fourth hole and then drilled it.

(In my final version I also added a clip for a 9V battery, requiring a couple more holes, sized for 4-40 machine screws.)

Step 6: Assemble the Motor Shield

Follow Lady Ada's instructions. They're good ones.

Step 7: Assemble the top frame piece

Put the on/off switch and power jack in the appropriate holes.

Attach the Arduino Uno using the four stand-offs. If using metal standoffs (like I did), be very careful that the stand-offs don't touch anything that looks like a solder point, exposed trace, etc. If they do, you'll need to add an insulating washer between the stand-off and the board. I made some by drilling screw-size holes in a piece of polyethylene scrap, then trimming around the holes until I had a tiny washer.

Plug the Motor Shield on top of the Uno.

I recommend not attaching the boards to the frame until after you wire everything up!

Step 8: Wiring

The included wire was stranded, so, to keep the ends from fraying, I melted a little solder on the ends that go in the Motor Shield's screw terminals.

Per Lady Ada's recommendation, I'm going with a dual power supply scheme: the 5-AA pack will power the motors and a 9-volt battery will power the Arduino. For my money, wiring the 9-volt through the Arduino's power plug is the easiest way to go. You'll probably want to include a 2nd on/off switch for the Arduino (the switch included with the 2WD kit will be needed for the motor supply).

(In my latest mods, I swapped out the included switch for one that could handle two separate circuits, so now both the motor shield and Arduino turn on/off from the same switch.)

My recommended wiring setup (for the included 1-circuit switch):


        +--------+
        | switch |
        +--------+
         |   |   |
   <-----+   |   +------>to center pin on power jack
to EXT_PWR   |
on shield    |
             |
             +---[ + 5-AA battery pack - ]--->GND


CHECK AND DOUBLE-CHECK CONTINUITY WITH AN OHM-METER:

  1. Make sure the battery pack's positive terminal (red) is ultimately connected to the positive of PWR_EXT.
  2. Make sure the battery pack's negative terminal (black) is ultimately connected to the negative of PWR_EXT.
  3. Make sure the on/off switch does indeed break the path from the battery pack's positive terminal to PWR_EXT's positive terminal.
  4. Make sure the switch breaks continuity to the power jack when the motor shield is "on" and 'has' continuity when the motor shield is off.

The jack I received had three terminals, as looking at it from underneath, in the 9 o'clock, 12 o'clock, and 3 o'clock positions. 9 o'clock is the center pin and should be connected to the positive battery terminal. 12 and 3 o'clock are connected internally and should be used for ground.

Attach the wires from the motors to either the M1 and M2 jacks or the M3 and M4 jacks on the Motor Shield (M1 and M2 have more flexibility).

Step 9: Attach the top frame piece.

The vertical supports are pre-tapped for this, so no nuts required.

Step 10: Program It

Here's a basic "move in a square" test program. You'll need to install the AFMotor library to use it.



#include <AFMotor.h>

AF_DCMotor m_driver(1, MOTOR12_64KHZ); // driver-side motor
AF_DCMotor m_passenger(2, MOTOR12_64KHZ); // passenger-side motor

// which way we're facing
#define NORTH (0) /* "north" (straight ahead) */
#define EAST (1) /* "east" (right) */
#define SOUTH (2) /* "south" (backward) */
#define WEST (3) /* "west" (left) */
int facing = NORTH;

// tweak these values as needed


// these are pretty close to values that produce 90-degree turns
#define velocity (80) /* how fast the wheels spin */
#define turn_time (1000) /* how long it takes to turn 90-degrees */
#define move_time (2000) /* how long it takes to move forward 1 "space" */

void turn_90_clockwise()
{
  m_driver.run(BACKWARD);
  m_passenger.run(BACKWARD);
  delay(turn_time);
}

void turn_to(int direction)
{
  while(direction != facing)
  {
    turn_90_clockwise();
    facing = (facing + 1) % 4;
  }
}

void forward_one_unit()
{
  m_driver.run(BACKWARD);
  m_passenger.run(FORWARD);
  delay(move_time);
  full_stop();
}

void full_stop()
{
  m_driver.run(RELEASE);
  m_passenger.run(RELEASE);
}

void move_north()
{
  turn_to(NORTH);
  forward_one_unit();
}

void move_east()
{
  turn_to(EAST); 
  forward_one_unit();
}

void move_south()
{
  turn_to(SOUTH); 
  forward_one_unit();
}

void move_west()
{
  turn_to(WEST); 
  forward_one_unit();
}

void test_squaredance()
{
  // simple square movement pattern
  move_north();
  move_east();
  move_south();
  move_west();
}

void setup()
{
  m_driver.setSpeed(velocity);
  m_passenger.setSpeed(velocity);

  // for safety, wait 10 seconds before starting
  delay(10000);
  test_squaredance();
  delay(15000);
  full_stop();
}

void loop()
{

}