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 ads by
Signing UpStep 1: Structure - 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.










































Visit Our Store »
Go Pro Today »




beautiful is your 8 dof!!
#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.
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.
did you open up the serial monitor to see if its printing out anything?
- 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.
I would like to create a balance robot with 5 DOF and two servo parallax continuous rotation.
#include
Servo myservo;
void setup()
{
myservo.attach(9);
myservo.writeMicroseconds(1500); // set servo to mid-point
}
void loop() {}
send some pics to make this clear.