NodeMagazine.jpg
Photo 30-03-2012 11 16 50.jpg
Photo 01-04-2012 12 14 07.jpg
IMG00175-20120326-1230.jpg
IMG00176-20120326-1230.jpg
Photo 02-04-2012 12 31 47.jpg
Photo 04-04-2012 22 44 49.jpg


A robot is defined as a mechanical or virtual intelligent agent that can perform tasks automatically or with guidance .
Typically a robot is an electro -mechanical device that is guided by computer and electronic programming .

So I decided to try my hand at robotics, and what appealed to me the most was the Biped as it involves movement and balance. For this Ide be able to incorporate servos and accelerometers.

The Final Biped is a two legged Arduino controlled actuated robot with 8 Degrees of Freedom (DOF) and accelerometer feedback.

This is my first time using Arduino, servos and accelerometers so this may not be the best way to go about the final robot but it seems to be working as intended.

Supplies:

After much research I decided to go with the Arduino as it has Servo libraries which makes life a lot easier. Instead of creating 8 different PWM (pulse width modulation) signals for each servo, one can just set the rotation using a single command. (I will post code later). The Arduino I went with is the MEGA250 which has 14 PWM pins , Im only using 8 for the servos, also more than enough Analogue inputs for the accelerometer. 

The Arduino does not come with an istallation cd so the software can be found at the following link:

Arduino Software

It also doesn't come with the USB cable.
You will have to install the Arduino drivers, they come with the download. A "how to" google search should help.

The servos I used are HD-1501MG which have the minimum torque I would suggest for a biped of this size as it struggles in some positions. I purchased 8 from microRobotics. Heres the link to the product, you can also view the specs:

SERVOS

As far as precision is concerned, these are probably not the best option, but anything more high end was too expensive considering I needed 8.

The accelerometre is an ADXL330 which I picked up off an old project. A gyroscope from a broken WII remote works well too.

The structure of the BOT is Perspex, I cut it from a single sheet and rounded the edges.

I used many nuts and bolts, and a glue gun to hold it together.

An example of a biped with serial communication, Also has a nice GUI which I adapted to work with mine:
http://www.projectbiped.com/prototypes/fobo

A similar Project, which I used the code as a template for my code:
http://lars.roland.bz/biped-arduino-robot/

A nice tutorial on how to get the robot walking:
http://www.youtube.com/watch?v=Xhz6m6fu494
 
Remove these adsRemove these ads by Signing Up

Step 1: Structure - Perspex

IMG00148-20120314-1521.jpg
IMG00149-20120314-1600.jpg
IMG00150-20120315-1314.jpg
layout.jpg
Cutting the Perspex:

- I used a Table saw for the long cuts and a jig saw for the short ones.

- I used a grinder to round the edges.
peraz91 says: Aug 23, 2012. 1:39 AM
My robot.... (work in progress!)
IMG_1866.JPG
peraz91 says: Aug 17, 2012. 2:50 PM
I can use the accelerometer as 5 dof of SparkFun? thanks
bluebean (author) in reply to peraz91Aug 18, 2012. 4:32 PM
It shouldn't make a difference which accelerometer you use. just make sure you check the datasheet for the correct pin layout. If im not mistaken, the 5 DOF Sparkfun is a combination of Gyroscope and accelerometer, measuring Rotation aswel as acceleration would result in a more accurate feedback.
peraz91 in reply to bluebeanAug 19, 2012. 8:02 AM
Could you help me if You want to use it as you did with your robot?
beautiful is your 8 dof!!
bluebean (author) in reply to peraz91Aug 19, 2012. 11:20 AM
thank you, The Accelerometer im using is only a 3axis (X,Y,Z) , the 'servo motion' is 8DOF, so feedback compared to movement is not the best ratio. So if you are to use Gyros and accelerometers it would be best. I am glad to help you as far as my knowledge extends, and can provide some basic code if you require. I initially got my biped as stable as possible in the code of the walk and the structure of the bot without feedback and then added the sensors for extra stability. I recommend this method. checkout my other proj for an idea of gyro control: http://www.instructables.com/id/Intro-53/
peraz91 in reply to bluebeanAug 19, 2012. 3:29 PM
thank you! with the interface can control all 8 servo. but in the sketch of the robot finished I have not figured x commands him to walk.
peraz91 in reply to peraz91Aug 19, 2012. 3:30 PM
I'm not good at communicating with the Arduino serial monitor: (
bluebean (author) in reply to peraz91Aug 19, 2012. 11:57 PM
here's some basic code to use with the serial monitor, simply upload the code, open up serial monitor, wait for it to respond, then either type 'x' or 'z': (attach a servo to pin 13)

#include

Servo MyServo;
int data = 0;
----------------------------------------------------------------
void setup()//initialising the servo pin and the serial communication
{

Serial.begin(9600);

MyServo.attach(13);

}
---------------------------------------------------------------
void loop()
{
if (Serial.available() > 0) {

data = Serial.read(); // read the incoming byte:

switch(data)
{
case 'x' : Left(); break;
case 'z' : Right(); break ;

}
}

--------------------------------------------------------------
void Left()
{
Serial.print("Function Left() activated ");
MyServo.write(90);
}
void Right()
{
Serial.print("Function Right() activated ");
MyServo.write(0);
}

//END OF CODE

so a function such as 'Left()' would contain your steps for walking.

my walking code thats posted on this instructable isnt up to date, so i will upload the lastest version soon.
peraz91 in reply to bluebeanAug 20, 2012. 11:31 AM
when you have time can you tell me how to connect my 5 dof to use it as your own 3-axis? thank you!
bluebean (author) in reply to peraz91Aug 20, 2012. 12:31 PM
Ok, on your accelerometer chip you should have pins labelled X-acc,Y-acc, Z-acc, (NOT the ones with rotational arrows, those are for the gyroscope) , There should also be pins labled "GND" and , either "VCC" (or 3V3 or 3.3V OR 5V)

x,y ,z are your axis
GND is your ground/zero/earth
vcc or 3.3v is what powers the accelerometer

for now lets use the x axis only:

- connect the x-acc pin to the analogue 'pin 0' of the arduino.
- connect the GND to the GND pin of the arduino
- Connect the 3.3v to the 3.3 pin of the arduino (or vcc to vcc)

its as simple as that.

now use this code as a very basic example:

//START OF CODE

  int potpin = 0;
  int val;
 
  void setup()
  {
  Serial.begin(9600);
  }
 
  void loop()
  {
    val = analogRead(potpin);            // reads the value of the accelerometer //(value between 0 and 1023)
    val = map(val, 0, 1023, 0, 179);//

   
        if (val > 90) {
        Serial.Print("the value is above 90");
        } 
         else
  {
     Serial.Print("the value is below 90"); 
  } 
    delay(15);                           // waits for the servo to get there
 
  }

//END OF CODE

if you want to use it on a graph like in 1 of my clips you will need the software "processing" i think ive posted the code for that aswel, but try this first.

peraz91 in reply to bluebeanAug 21, 2012. 7:22 AM
will not load because it says "Invalid use of class print"
bluebean (author) in reply to bluebeanAug 20, 2012. 12:35 PM
Found a pic on the web, labelled the pins for you:
5DOFPINS.jpg
142536789 in reply to bluebeanAug 23, 2012. 6:28 AM
at www.sparkfun.com
peraz91 in reply to bluebeanAug 21, 2012. 6:26 AM
ok, my 5 dof instead of 3.3v has written RAW ....
peraz91 in reply to peraz91Aug 21, 2012. 6:46 AM
my 5 dof don't working :(
bluebean (author) in reply to peraz91Aug 21, 2012. 7:10 AM
RAW just means unregulated supply, its the same as 3.3v or 5v.
did you open up the serial monitor to see if its printing out anything?
peraz91 in reply to bluebeanAug 21, 2012. 7:17 AM
thanks for raw, but the servant does not rotate in both directions as your own. my servant rotates in one direction only if I delete the raw and gnd!!
bluebean (author) in reply to bluebeanAug 21, 2012. 7:14 AM
if you want to test the 5dof by itself, u can...

- plug in RAW to the +ve on a power supply.
- GND to the -ve on power supply @3.3v
- X-acc to an oscilloscope pin (GND of oscilloscope must go to GND of power supply)

And when you tilt the accelerometer you should see the voltage rise on the oscilloscope. can maybe even try with a multimeter.
peraz91 in reply to bluebeanAug 21, 2012. 7:27 AM
the 5 dof works because in the sketch of example works ... I do not know why he does that.
I would like to create a balance robot with 5 DOF and two servo parallax continuous rotation.
bluebean (author) in reply to peraz91Aug 21, 2012. 7:50 AM
is the servo acting as a joint or a wheel?
bluebean (author) in reply to bluebeanAug 21, 2012. 7:56 AM
I dont think you can use continuous rotation servos as joints. eg: 'servo.write(90)' As far as I know you need bi-directional ,(0->180)
bluebean (author) in reply to peraz91Aug 21, 2012. 7:48 AM
(removed by author or community request)
bluebean (author) in reply to bluebeanAug 21, 2012. 7:51 AM
If you using the servo as a wheel then perhaps you can use something like this:

#include

Servo myservo;

void setup()
{
myservo.attach(9);
myservo.writeMicroseconds(1500); // set servo to mid-point
}

void loop() {}
peraz91 in reply to bluebeanAug 21, 2012. 10:51 AM
I finished my 8 dof but after a few minutes I do move through the gui resets continuously: (
bluebean (author) in reply to peraz91Aug 21, 2012. 12:25 PM
I'm not sure what you mean? '8 dof' the robot? which gui, the one I posted 'FOBO'?
send some pics to make this clear.
peraz91 in reply to bluebeanAug 21, 2012. 3:05 PM
yes yes, I did the robot similar to yours! I'm trying to do with the gui Fobo walk!
bluebean (author) in reply to peraz91Aug 21, 2012. 4:18 PM
The whole gui resets? Or the servo resets?Wen i connected my robot to Fobo gui, the prob i had was that Fobo gui is made for servos from 0->120 whereas my servos were 0->180 so if i slide the bar over too much, it goes back to zero, this may be what you are reffering to, if so you must limit your range of motion.
peraz91 in reply to bluebeanAug 22, 2012. 3:28 AM
I use one arduino and when placed on the ground shortly after my robot is reset. Overload problems?
bluebean (author) in reply to peraz91Aug 22, 2012. 6:09 AM
Sometimes the serial monitor gets overloaded, so try not to write to much to the monitor. send me a pic of the bot, or a link to a video, im keen to see your progress
peraz91 in reply to bluebeanAug 27, 2012. 10:48 AM
how do I export the movements created by the gui to an arduino sketch? with the key export the sketch gives me errors!
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!