Simple 2WD Robot
Last Modified: 2007-10-04
find:

basket

Acroname Robotics  
 

Contents

Photo of assembled 2WD robot.
Assembled Version of the 2WD Robot.

Building Your First Robot

Being the web and design guy at Acroname, I thought it was about time for me to make a robot.  I knew the actual building part would be a piece of cake for me, but the programming part had me scratching my head.  About the closet thing to programming I had done was some semi-advanced action scripting in Flash.  The question plagued me, "Can a guy with an art degree program a robot?" Well, lets take a look at how easy it was!

Parts List

I wanted to make this first robot simple and quick to build.  I started by modifying two Standard Servos for continuous rotation .  I added two black wheels , a Sharp GP2D12 IR Ranger , a 4-AA battery pack , four AA NiMH batteries and I topped it off with a BrainStem GP 1.0 controller .  Add to that a little double-side foam tape to stick things together, and a robot is born!

Building the Robot

I'll skip the detail of the servo modification since you can find that info in our ideas section or in the PPRK assembly section.  Or, you can simply buy a pre-made continuous rotation servo . 

Start by sticking a piece of double-sided foam tape onto each servo. 

Servo motors with sticky tape attached.
The servos with foam tape.

After the foam double-sided tape is on the servos, you can stick the battery pack to them.  The pack fits nicely on the servos and you can use it as a guide to attach the servos squarely with the edge. 

Battery pack attached to the servo motors.
Attaching the battery pack to the servos.

Next came the BrainStem GP 1.0 controller.  In order to have clearance to plug the servos and sensors into the controller, I raised it up about 3/4" with a couple spark plug boxes I had laying in my tool chest. 

Attach the BrainStem.
The BrainStem is added to the stack.

Next came the wheels.  With these attached, you'll see why you needed to raise the BrainStem up to clear them. 

Robot with the wheels attached.
The wheels are attached to the servos.

Basic two-wheel drive robots need some sort of caster wheel or skid in the back to keep it from dragging the back-end.  Again, I grabbed some odd part from my tool chest, and made it into a simple skid for the back end. 

Adding a skid plate for balance.
The skid in place.

Well, now that is about it for the simple robot design.  I plugged the battery into the Logic Power on the BrainStem GP 1.0, and then to power the servos, I "borrowed" some power from the IIC bus.  Here's how you do that.  On the IIC bus, next to the Logic Power, plug one end of your jumper wire into the third pin (as shown in the photo), the other end plogs into the power side of the servo power. 

Bridging power to the servo motor from the I2C bus.
Adding a power jumper wire.

Now, you can plug in the servos and Sharp GP2D12.  The servo pins are numbered 0 through 3.  I plugged my left servo into 0, and the right into 1.  The Sharp ranger can be plugged into analog port 0.  To attach the Sharp sensor, you can see in the photo that I just folded and taped a a piece of cardboard onto the front of the battery pack.  The sensor is aimed at an angle to sense a wall.  Adjusting the angle will be needed to get the best reading.  Trail and error, that seems to be the name of the game. 

Source Code

This is the part that struck fear in my heart.  (Well, not really.) I started off by reading Mark Whitney's Follow example .  I would recommed reading over this example, as it will help you to see how I modified the code to work with my wall following robot, and it has the instructions on how to configure the servos.  The servos will need to be configured first. 

If you are totally new to the BrainStem controller, you'll also want to read over the Getting Started Guides for the BrainStem GP 1.0, the Console, and TEA.  These guides will help you get started with the BrainStem, the GP application, and the Console. 

Ok, have you read all that other stuff I just directed you to? Good! Now I can explain how I modified the code from Mark's Follow example.  You might want to open a second browser window and have the the Follow example code in one window and the Wall Follow code in this. 

Source Code - TEA Include File

/* filename: followdef.tea */ /* modified copy of aMo_Def.tea library file */ #define AMO_SRVL 0 /* index of left servo */ #define AMO_SRVR 1 /* index of right servo */ #define AMO_CFGL 0xC0 /* invert and enable left servo */ #define AMO_CFGR 0x80 /* enable right servo */ #define AMO_POS0L 0x13 /* left servo position 0 offset */ #define AMO_POSRESL 0x20 /* left servo positioning resolution */ #define AMO_POS0R 0x24 /* right servo position 0 offset */ #define AMO_POSRESR 0x22 /* right servo positioning resolution */ /* WALL HUG PARAMETERS */ /* increase gain for quicker response */ /* decrease minv to turn more sharply when no wall is present */ /* decrease maxv to slow down wall-hug */ /* minv should probably not be more than 0.5*maxv */ #define AMO_WHUGGAIN 1 #define AMO_WHUGMAXV 30 #define AMO_WHUGMINV 5

Source - TEA Program

/* filename: wallhug.tea */ /* wall hug program */ #include "followdef.tea" #include <aCore.tea> #include <aMo.tea> #include <aA2D.tea> #include <aPrint.tea> #define AFRONT 0 /* wall-looking GP2D12 input */ #define THRESH 150 /* wall threshold */ /* (determined experimentally) */ void main() { int f; int nflag; /* wall-follow */ while(1) { /* measure and scale wall distance */ f=aA2D_ReadInt(AFRONT); /* follow wall */ /* (acts just like wall-hugging, maybe) */ aMo_HugIter(f,THRESH,AMO_RWHUG); /* aPrint_IntDec(f); aPrint_Char('\n'); aCore_Sleep(2000); */ } }

Revision History:

  • 2002-10-20: Idea Article Created
 
 
voice: 720-564-0373, email: sales@acroname.com, address: 4822 Sterling Dr., Boulder CO, 80301-2350, privacy
© Copyright 1994-2012 Acroname, Inc., Boulder, Colorado. All rights reserved.