Stabilized Platform using Arduino And Bioloid

Bioloid robot kit from Korean company Robotis; CM5 controller block, AX12 servos..
6 postsPage 1 of 1
6 postsPage 1 of 1

Stabilized Platform using Arduino And Bioloid

Post by alasi89 » Wed Sep 12, 2012 6:51 pm

Post by alasi89
Wed Sep 12, 2012 6:51 pm

After 7 months working, I put my graduation project between your hands,


the Arduino mega 2560 board works as the controller of the stabilazation system, while the cm5 controls the robotic car. the tilt angle comes from the acceleration sensor witch is fixed on the top of the Arduino board, the sensor's signal was filtered and underwent linearity adjustment process to get the correct tilt angle between the car plane with respect to the gravity vector.

this is the video segment :

http://www.youtube.com/watch?v=xmYzwiYQERg&feature=player_detailpage


the code in java for the arduino board :



Code: Select all
/* Auther : Eng. Alaa Alasi
All Rights reserved for Mechatronics Engineering Department.
University of Aleppo.
Syrian Arab Repuplic.

 This code is in the public domain.*/

#include <CDS5500>

CDS5500 SERVO;
word z ,z_k_1 , z_k_3 , z_k_2 ;
word y,y_k_1,y_k_3 , y_k_2 ;
word z_avg , y_avg;
float x,Y;
int Sdelay = 2 ;
int Adelay = 10 ;
int z_zero;
int Tsam=0.0001;
int Wcut=30;
int i;
word sampels=40;
void setup(){
  Serial.begin(1000000);         //init Serial baudrate for the servo command
   Serial3.begin(9600);          // serial communaction with PC
 analogReference(INTERNAL2V56);  // ADC Vref init
  pinMode(2, OUTPUT);            // RX Buffer
  pinMode(3, OUTPUT);            // tx
  pinMode(13, OUTPUT); 
  digitalWrite(3, HIGH);   // TX Buffer enable
 
}

void loop(){
digitalWrite(13, HIGH);    // Flag to measure the sampling time 1

  //Digital filtring ::
     
  z_avg = analogRead(1);  // 10 KHz ... 100 u sec
  y_avg = analogRead(3); 
 
   
  for(i = 0;i <sampels; i++){
   z_avg = z_avg + analogRead(1);
   y_avg = y_avg + analogRead(3);
  }
  z_avg = z_avg/sampels;
  y_avg = y_avg/sampels;
 

 
 
 // Normalization
 
  float(x);
 x=z_avg ;
 Y=y_avg ;
 x=x-340;              // bias in sensor signal: angle (0)= 0.85 volt = 340 in decimal
 Y=Y-340;
 x=(x/640)*1023;       // max value: angle(180) = 2.45 volt = 980 - 340
 Y=(Y/640)*1023;
 
x = (512 - x)/512;     // cos (z)  from -1 to 1
Y = (512 - Y)/512;
 
  // LINERIZATION :
 
x = (3.1416/2) - (x + (0.1666 *pow(x,3))+(0.075*pow(x,5))+0.0446*pow(x,7)+0.03*pow(x,9)+0.0223*pow(x,11)+0.0173*pow(x,13)+0.0139*pow(x,15)+0.01151*pow(x,17)) ; // arc cos z formula
Y = (3.1416/2) - (Y + (0.1666 *pow(Y,3))+(0.075*pow(Y,5))+0.0446*pow(Y,7)+0.03*pow(Y,9)+0.0223*pow(Y,11)+0.0173*pow(Y,13)+0.0139*pow(Y,15)+0.01151*pow(Y,17)) ;
x=x*180/3.1416;        // converting Radian to degrees , angle rang [0  180]
Y=Y*180/3.1416;   

x=x+60;                // addin 60 digree bias for the range to be  [60 240]
Y=Y+60; 

x=(x/240)*818;         // converting from digree to decimal rang   [205 818]
Y=(Y/240)*818;   
Y=1023-Y;              // invers the Direction of Rotation

 
  word(x);
  word(Y);
 
  // SERVO COMMAND :

  SERVO.WritePos(1,x,0);// Servo ID:1, rotate to the position:0x2FF, rotate speed:0x1FF (Roll Angle)
  SERVO.WritePos(6,512,0);
  SERVO.WritePos(5,Y,0); // Roll angle
  SERVO.WritePos(13,Y,0);

//delay(1);

   // SENDING DADTA TO OBSERV SENSOR SIGNSL :
 
  Serial3.println(x,DEC);
  Serial3.print(",");
  digitalWrite(13, LOW);     // sampling time flag low
}



I want to take advantage of this occasion to tell you that we are being killed and tormented every day in Syria from the Syrian dictator Bashar Al Assad .

SOS
After 7 months working, I put my graduation project between your hands,


the Arduino mega 2560 board works as the controller of the stabilazation system, while the cm5 controls the robotic car. the tilt angle comes from the acceleration sensor witch is fixed on the top of the Arduino board, the sensor's signal was filtered and underwent linearity adjustment process to get the correct tilt angle between the car plane with respect to the gravity vector.

this is the video segment :

http://www.youtube.com/watch?v=xmYzwiYQERg&feature=player_detailpage


the code in java for the arduino board :



Code: Select all
/* Auther : Eng. Alaa Alasi
All Rights reserved for Mechatronics Engineering Department.
University of Aleppo.
Syrian Arab Repuplic.

 This code is in the public domain.*/

#include <CDS5500>

CDS5500 SERVO;
word z ,z_k_1 , z_k_3 , z_k_2 ;
word y,y_k_1,y_k_3 , y_k_2 ;
word z_avg , y_avg;
float x,Y;
int Sdelay = 2 ;
int Adelay = 10 ;
int z_zero;
int Tsam=0.0001;
int Wcut=30;
int i;
word sampels=40;
void setup(){
  Serial.begin(1000000);         //init Serial baudrate for the servo command
   Serial3.begin(9600);          // serial communaction with PC
 analogReference(INTERNAL2V56);  // ADC Vref init
  pinMode(2, OUTPUT);            // RX Buffer
  pinMode(3, OUTPUT);            // tx
  pinMode(13, OUTPUT); 
  digitalWrite(3, HIGH);   // TX Buffer enable
 
}

void loop(){
digitalWrite(13, HIGH);    // Flag to measure the sampling time 1

  //Digital filtring ::
     
  z_avg = analogRead(1);  // 10 KHz ... 100 u sec
  y_avg = analogRead(3); 
 
   
  for(i = 0;i <sampels; i++){
   z_avg = z_avg + analogRead(1);
   y_avg = y_avg + analogRead(3);
  }
  z_avg = z_avg/sampels;
  y_avg = y_avg/sampels;
 

 
 
 // Normalization
 
  float(x);
 x=z_avg ;
 Y=y_avg ;
 x=x-340;              // bias in sensor signal: angle (0)= 0.85 volt = 340 in decimal
 Y=Y-340;
 x=(x/640)*1023;       // max value: angle(180) = 2.45 volt = 980 - 340
 Y=(Y/640)*1023;
 
x = (512 - x)/512;     // cos (z)  from -1 to 1
Y = (512 - Y)/512;
 
  // LINERIZATION :
 
x = (3.1416/2) - (x + (0.1666 *pow(x,3))+(0.075*pow(x,5))+0.0446*pow(x,7)+0.03*pow(x,9)+0.0223*pow(x,11)+0.0173*pow(x,13)+0.0139*pow(x,15)+0.01151*pow(x,17)) ; // arc cos z formula
Y = (3.1416/2) - (Y + (0.1666 *pow(Y,3))+(0.075*pow(Y,5))+0.0446*pow(Y,7)+0.03*pow(Y,9)+0.0223*pow(Y,11)+0.0173*pow(Y,13)+0.0139*pow(Y,15)+0.01151*pow(Y,17)) ;
x=x*180/3.1416;        // converting Radian to degrees , angle rang [0  180]
Y=Y*180/3.1416;   

x=x+60;                // addin 60 digree bias for the range to be  [60 240]
Y=Y+60; 

x=(x/240)*818;         // converting from digree to decimal rang   [205 818]
Y=(Y/240)*818;   
Y=1023-Y;              // invers the Direction of Rotation

 
  word(x);
  word(Y);
 
  // SERVO COMMAND :

  SERVO.WritePos(1,x,0);// Servo ID:1, rotate to the position:0x2FF, rotate speed:0x1FF (Roll Angle)
  SERVO.WritePos(6,512,0);
  SERVO.WritePos(5,Y,0); // Roll angle
  SERVO.WritePos(13,Y,0);

//delay(1);

   // SENDING DADTA TO OBSERV SENSOR SIGNSL :
 
  Serial3.println(x,DEC);
  Serial3.print(",");
  digitalWrite(13, LOW);     // sampling time flag low
}



I want to take advantage of this occasion to tell you that we are being killed and tormented every day in Syria from the Syrian dictator Bashar Al Assad .

SOS
alasi89 offline
Robot Builder
Robot Builder
Posts: 11
Joined: Mon Mar 05, 2012 1:56 am

Post by limor » Wed Sep 12, 2012 7:58 pm

Post by limor
Wed Sep 12, 2012 7:58 pm

The video looks great!
With AX18 servos you could easily upgrade the speed response
The video looks great!
With AX18 servos you could easily upgrade the speed response
limor offline
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1845
Joined: Mon Oct 11, 2004 1:00 am
Location: London, UK

Post by siempre.aprendiendo » Wed Sep 12, 2012 9:25 pm

Post by siempre.aprendiendo
Wed Sep 12, 2012 9:25 pm

It's absolutly admirable and very very encouraging that you have the capacity and strength to do this great work in that horrible situation. I hope you can get peace and freedom very soon.
It's absolutly admirable and very very encouraging that you have the capacity and strength to do this great work in that horrible situation. I hope you can get peace and freedom very soon.
siempre.aprendiendo offline
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 559
Joined: Wed Aug 08, 2007 9:13 pm
Location: Barcelona

Post by alasi89 » Wed Sep 12, 2012 11:41 pm

Post by alasi89
Wed Sep 12, 2012 11:41 pm

The video looks great!
With AX18 servos you could easily upgrade the speed response


well, I told the professors that, but they were not convinced by the answer, I knew I was right and they were stupid

any way thanks for the advice.

:)


It's absolutly admirable and very very encouraging that you have the capacity and strength to do this great work in that horrible situation. I hope you can get peace and freedom very soon.


thanks man your words means too much to me, guys I wonder if we can communicate more easier by Facebook or Skybe, it is agreat pleasure for me to have you as friends.
The video looks great!
With AX18 servos you could easily upgrade the speed response


well, I told the professors that, but they were not convinced by the answer, I knew I was right and they were stupid

any way thanks for the advice.

:)


It's absolutly admirable and very very encouraging that you have the capacity and strength to do this great work in that horrible situation. I hope you can get peace and freedom very soon.


thanks man your words means too much to me, guys I wonder if we can communicate more easier by Facebook or Skybe, it is agreat pleasure for me to have you as friends.
alasi89 offline
Robot Builder
Robot Builder
Posts: 11
Joined: Mon Mar 05, 2012 1:56 am

Post by Abdelali » Fri Jan 11, 2013 7:43 pm

Post by Abdelali
Fri Jan 11, 2013 7:43 pm

Hi Dear Alaa

I'm Ali from morocco and I'm working on the same project as yours and I need your help on the programmation of the arduino.

can You please give me your facebook or your e-mail adress

thanks a lot
Hi Dear Alaa

I'm Ali from morocco and I'm working on the same project as yours and I need your help on the programmation of the arduino.

can You please give me your facebook or your e-mail adress

thanks a lot
Abdelali offline
Newbie
Newbie
Posts: 1
Joined: Fri Jan 11, 2013 7:36 pm

Post by UncleBob » Sat Feb 02, 2013 3:56 am

Post by UncleBob
Sat Feb 02, 2013 3:56 am

Hi Just wonder whether CDS5500 class is written by yourself ?

thkx
Hi Just wonder whether CDS5500 class is written by yourself ?

thkx
UncleBob offline
Savvy Roboteer
Savvy Roboteer
Posts: 398
Joined: Sun Dec 27, 2009 5:25 am


6 postsPage 1 of 1
6 postsPage 1 of 1