Introduction: ICBob - a Bob Inspired Biped Robot

We are the Teen Imagineering Club from the Bridgeville Delaware Public Library. We make cool projects while learning about electronics, computer coding, 3D design and 3D printing.

This project is our adaptation of BoB the BiPed an Arduino based robot. We redesigned the body to take advantage of our favorite Arduino power source, the Powerbot phone power bank. This inexpensive rechargeable 5 volt power source is great for powering our Arduino projects and it recharges with any USB wall charger. We also adapted the 3 toed feet from the Arduped biped robot just because they look AWESOME. We will show you where to get the parts you need, how to assemble the robot and even give you some easy Arduino code to get it walking.We had a great time making our eleven ICBob robots. Keep reading if you want to learn how to make one for yourself.

Step 1: Parts and Tools You Will Need

ICBob is designed for the following set of parts. While substitutions are possible you may need to modify the body to make them work. Our favorite supplier is Yourduino.com but for some items you will need to go to Amazon or Ebay.

Product Availability Update- Yourduino no longer carries the Micro Magician and says they are being discontinued by Dagu. The Dagu website still has them available http://www.dagurobot.com/goods.php?id=137 and if they are not available the S4A EDU controller is a drop in replacement and operates at 5 volts.

Parts

3D prints - The stl files are available on Thingiverse thing:1313344

  • 1x- body
  • 1x- shell
  • 2x- knee
  • 1x- left foot
  • 1x- right foot

Tools

  • computer with Arduino IDE
  • Arduino add on library VarSpeedServo
  • MICRO Magician Driver (needed for some operating systems)
  • 3D printer (or have the parts made)
  • 3D part cleaning tools
  • Soldering kit (only for the pins on the USB adapter)
  • Hot glue gun
  • Small Philips screwdriver
  • usb charger

This Instructable assumes you have a basic knowledge of Arduino use. If you are new to Arduino you can learn more at https://www.arduino.cc/ .

For the MICRO Magician choose Board - Arduino Pro or Pro Mini(3.3V, 8MHz) w/ ATmega328

You will need Korman's VarSpeedServo library to use our sketches. You can find out more about his library here but use our download below which is compatible with the newer IDE. Download the VarSpeedServo.zip file below and unzip to your arduino/libraries folder.

You may need to install the MICRO Magician CP210x driver if your system does not recognize the controller. This site may help with the driver install https://www.pololu.com/docs/0J7/all

Step 2: Let's Start Building - Assemble the Legs

For this step you will need 2 - 3D printed knees and 4 servo packages.

Start by cleaning the knees. The 2 servo horn holes need to fit the single sided servo horns. We cleaned them with a letter L (.290) sized drill bit.The one pivot hole needs to fit the pivot on the foot. We cleaned them with a # 2 (.220) sized drill bit.

Fit the 4 servo horns into the knees. Attach the horn using one of the larger screws that came with the servo package. Put the screw through from the knee side and tighten into one of the small holes on the servo horn. For the one screw you will have to tighten with the screwdriver at an angle but it is doable. You can clip the screw points that stick out with side cutter pliers if you want.

The 4 servo spindles have to be centered before they are attached to the knees. You can do this manually by gently moving the spindle through its rotation to find the half way point. A better way is to attach a servo to pin 12. Download the icbob_servo_center.zip file below. Unzip to your Arduino directory. Then run this Arduino sketch for each servo.

Start by assembling the hip (upper) servos to the knees. Without moving the spindle attach the hip servo parallel to the knee with the wires facing the other servo horn (front). Secure with one small screw from the servo package. Repeat for other knee.

Now for the ankle servos. REMEMBER you are going to have right and left ankles so the legs will be mirror images of each other. You will have to spread the knee slightly to assemble the ankle servo so orient the servo as in the photo before squeezing it in. Remember not to rotate the spindle. Secure with a small screw. Repeat with other knee so you finish with a right and left leg.

Step 3: Building - Attach Legs to Body

You will need the 2 leg assemblies and the 3D printed base for this step. You will also need (4) 2-56x3/8 self tapping screws or hot glue.

The leg assembly attaches to the base by way of the hip servos. First route the 2 servo wires up through the bottom of the base. Mind the rights and lefts. As the drawing shows the ankle wire ends up in the half moon cutout but you have to have the ankle wire in before the servo is attached. You have to tilt the servo so that the hip wire (where it enters the servo) goes through the rectangular hole first (to the front). Its a tight fit but the back end should just slip in. Now turn the base over and secure the servo with 2 screws or alternatively hot glue should work. Repeat the process for the other leg.

Step 4: Building - Attach the Feet

For this step you will need a left foot and right foot to add to your assembly. They are hot glued on so fire up the glue gun.

Make sure you clean the slots in the feet well. Gently test fit the servo to the foot after cleaning. Make sure the pivot hole in the knee fits into the pivot pin on the foot. It is best to use a thin screwdriver between the servo and foot to pry the foot back off if it is tight. After you get a good test fit place a dime size glob of hot glue on the foot then press the servo to the foot. Avoid getting glue near the pivot area. Repeat for the other side so that your bot can stand on its own two feet.

Step 5: Wiring - Servos and Power

In this step you will need the MICRO Magician controller, the micro USB adapter board with header pins, the flat cable and your standing bot. You will be soldering and hot gluing in this step so have those tools ready.

The Powerbot power bank comes with a short USB to micro USB cable. For charging the battery the micro USB is plugged into the charging slot on the battery and the USB goes to the wall charger. You will reuse this cable to power the ICBob. Battery output is through the USB so we connect through the micro USB adapter board to get power to the bot.

First lets get the adapter assembled. Refer to photo for the next steps. You will only use the 2 outside pins (gnd and V+) to power the bot. Carefully slide the 2 outside pins in the header so the short side protrudes about 3/16 in. With pliers bend the 2 long pins 60 degrees or so. Bend before soldering as the boards are fragile. Insert header as shown and solder all pins on back for strength. Clip all unused pins as short as possible both front and back. Before we glue the adapter to the barrel attach the micro USB cable so that you end up with enough clearance. Put a large glob of hot glue on the back of the adapter then place it in the position shown on the barrel. Hold until it hardens.

Next attach the 4 servo connectors to the controller. We like the MICRO Magician because it has the 3 pin connectors onboard for easy servo wiring. The darker color wire (brown?) goes toward the board edge. The included Arduino sketches use the following pins.

  • Right Hip (RH) - pin 9
  • Right Ankle (RA) - pin 10
  • Left Hip (LH) - pin 11
  • Left Ankle (LA) - pin 12

For the power connection to the board pull off a pair of wires from the flat cable. You will use more of this flat cable for sonar wiring. Connect one end of the pair to the micro USB adapter. The pin that is closer to the front of the bot is ground and the other V+. The other end attaches to the controller near the switch. The V+ wire connects to the pin labeled 'Battery IN' in the documentation. Connect the ground wire to the 'gnd' pin just a little above the 'Battery IN' pin.

IMPORTANT! - There is a 'V+ select' jumper just above the D1 pin set. This jumper has to be on the INSIDE set of pins or the servos will not work.

Finally clean the controller slot on the base so that the controller has a snug fit. You can attach the battery and switch 'on' the controller to make sure it powers up.

Step 6: Programming - Home Calibration Code

A few words about our programming choices

When we built the prototype for this project we used the How to teach your BoB Biped to move tutorial over at Let's Make Robots. The Bob Poser software was cool and we had fun playing with it. The problem was the 600+ lines of code in the Navigation sketch were well above the teens knowledge level. To make this project more of a learning experience for them we decided to glean a few ideas from the Poser code and then start over with a blank page. The teens had already been using the VarSpeedServo library while learning about servos in our Arduino labs. We decided to see if VarSpeedServo could handle the timing and speed duties for the servos so that we could just concentrate on the positions. The resulting code works great and the full walk_avoid_turn sketch has less than 100 lines of code. The only new concepts the teens needed to learn about were 2 dimensional arrays and how to access that data with code. Enjoy!

Home Calibration

You centered the servo spindles when you assembled them. Now you will see how close you got and fine tune their home positions. Make sure you have the VarSpeedServo library from step 1 installed. Download the icbob_home_calibration.zip file below and unzip to your Arduino directory. Open the sketch in the Arduino IDE. Power up the MICRO Magician with the battery. Connect the computer to the board and upload code. Chances are the servo home positions will not be perfect. Find the following section in the code. Continue to adjust and upload until you get it right.

//.............................................................
// Start with the 4 hm array memmbers set to 90 deg. then adjust
// these setting so the knees are straight forward and the feet are flat
int hm[4] = {90,90,90,90}; //array to hold home position for each servo RH,RA,LH,LA
//.............................................................

If any of your numbers are less than 50 or greater than 130 you need to backtrack and disassemble the legs and get the spindles closer to center.

Once you have a good home position, write the numbers down. You will need these numbers for the rest of the sketches.

Step 7: Programming - Move Generator Code

Now to get your bot moving. Download the icbob_move_generator.zip file below and unzip to your Arduino directory. Open the sketch in the Arduino IDE. Find the following section of code. Put the home positions you recorded for your bot in the sketch.

//set the members for the array hm to the home positions for your robot
//they can be found by using the icbob_home_calibration sketch
const int hm[4] = {95,95,85,90}; //array to hold home position for each servo RH,RA,LH,LA

The following section of code is where the move sequences are entered. Each line has positions for the 4 servos (RH,RA,LH,LA) relative to the home position.

//mv array data. Each line is a 'frame' or position set for the 4 servos
//Multiple lines create a group of movements that can be looped to
//create walking, turning, dance or other movements
const int mvct = 6;  //Make this number equal to the number of lines in the array
const int mv[mvct][4] =  
{
  {0,-40,0,-20},        //These preloaded numbers should give a forward walk
  {30,-40,30,-20},
  {30,0,30,0},
  {0,20,0,40},
  {-30,20,-30,40},
  {-30,0,-30,0},
};

This is the code that turns the mv array data into servo slowmoves

void loop()  //loop repeats forever
{ 
  // Do move sequence
  for(int x=0; x<mvct; x++) {                   //cycle through the number of   
    RH.slowmove (hm[0] + mv[x][0] , svsp);      //lines 'frames' in the array
    RA.slowmove (hm[1] + mv[x][1] , svsp);
    LH.slowmove (hm[2] + mv[x][2] , svsp);
    LA.slowmove (hm[3] + mv[x][3] , svsp);
    delay(framedelay);
  }
}

Upload to the bot. The bot will go to the home position for 2 seconds then start a walk forward loop. It works best if the table is not too slippery.

Once you get tired of seeing him walk you can try your own moves. Use 'save as' to rename the sketch. Then play with the numbers and see what you can do. Keep the numbers between +50 and -50 or you may strain the servos. Remember if you add or subtract lines you have to change the mvct value to reflect the change. Have fun!

Step 8: Wiring - HC-SR04 Sonar Sensor (Eyes)

For this step you will need the icbob_shell 3D print, the HC-SR04 ultrasonic sensor, the female flat cable and one 10k ohm resistor. This should finish up the parts on our list. Yeah!

First clean the sensor holes in the shell for a medium tight fit. Don't put too much pressure on the sensor when test fitting. Remove from shell for wiring.

Next pull off 4 strands from the flat cable. Plug the 4 wires into the HC-SR04 sensor pins.

The MICRO Magician internally works on 3.3 volts and the pins can only take a 3.3 volt signal. The problem is the HC-SR04 operates at 5 volts. It can use a 3.3 volt input as the 'trigger' signal but when it sends an 'echo' signal it is 5 volts and it will damage the controller input if hooked up directly. We need to put a 10k ohm current limiting resistor on the 'echo' wire to protect the input.

UPDATE: Although we have not had any issues with just the 10K resistor inline, it was pointed out in the comments that best practice indicates a voltage divider circuit should be used here. In addition to the 10K resistor a 15K resistor should be placed between 'echo' and 'ground'.

Cut the resistor leads to .5 inches. The resistor goes into the 'echo' wire on your flat cable. We put a drop of super glue on the connection to help it stay put.

The sketch uses pin 13 for trigger and pin 3 for echo. Use the pin 13 group on the controller for the 'gnd', 'vcc', 'trig' in that order working from the edge toward the center. You will have to crisscross some wires here to get it right. The 'echo' wire with the resistor plugs into the female pin 3 socket.

If you want to check out the sensor before you move on to the next step you can use the first sketch on this page http://arduino-info.wikispaces.com/UltraSonicDistance to test it out.You will need the battery connected. You can see the distance readout on the serial monitor. Make sure you set the 'trigger_pin' to 13 and the 'echo_pin' to 3 in the sketch.

The best way to install the sensor in the shell is with the pins pointing toward the top and the wires folded and routed between the sensor 'eyes' and the shell.

Step 9: Programming - Walk_Avoid_Turn Code

Putting it all together. All the parts are assembled. We are ready load the full code, put the shell on and watch it do its thing.

You know the routine. Download the icbob_walk_avoid_turn.zip file below and unzip to your Arduino directory. Open the sketch in the Arduino IDE. Find the following section of code. Put the home positions you recorded for your bot in the sketch.

//set the members for the hm array to the home positions for your robot
//they can be found by using the icbob_home_calibration sketch
const int hm[4] = {95,95,85,90}; //array to hold home position for each servo RH,RA,LH,LA

This sketch adds a second move array and a second set of slow move code for the 'turn' move.

//forward array data
const int fwdmvct = 6;  //Make this number equal to the number of lines in the array
const int fwdmv[fwdmvct][4] =  
{
  {0,-40,0,-20},        //walk forward move frames
  {30,-40,30,-20},
  {30,0,30,0},
  {0,20,0,40},
  {-30,20,-30,40},
  {-30,0,-30,0},
};
//turn array data
const int trnmvct = 5;  //Make this number equal to the number of lines in the array
const int trnmv[trnmvct][4] =  
{
  {-40,0,-20,0},        //turn move frames
  {-40,30,-20,30},
  {0,30,0,30},
  {30,0,30,0},
  {0,0,0,0},
};

We added sonar obstacle detection code as well as a 'if' 'else' statement to decide if we are going straight or turning.

Final Assembly and start-up

Leave the battery unplugged and upload the sketch. Disconnect the programming cord. Make sure the power switch on the controller is in the down 'on' position. Carefully slide the shell onto the base with the USB power cord sticking through the top hole. Put in the battery. Plug it in. Your ICBob should start moving and turning to avoid obstacles closer than 7 inches.

Step 10: Wrap-up

We hope you have as much fun building your ICBob as we did building ours. Let us know if you have any questions or comments. If you build one let us know here or over on Thingiverse.