Page 2 of 2

Re: Balancing Robot (Minimalist Design Using Only Accelerometer)

PostPosted: Thu Jan 06, 2011 7:35 pm
by gilbertgan
Hi. Im new here. :lol:

My project differs with TS. My project require me to build a autonomous mobile robot to balance a full cup of water (cap opened) when it's going up a 30degree slope. Im thinking to use a servomotor to turn a acrylic platform, to adjust its angle whenever the inclination changes.

There're other feature as well. Might discuss them at another thread. :)

I have already bought ADXL335 from Cytron. Want to ask, do i need to get gryoscope and involve kaiman filter as well? Seen some tutorial at website that claim kaiman filter not necessary, as it's too complicated. :?

I'm using Pic18f452 and 20Mhz oscillator. And...i got not much knowledge and experience on programming.

But I found out a website. They share their source code. Was thinking to move on from there actually. Then saw this, and worry gyro and kaiman will have to come into the picture. @@

CODE: SELECT_ALL_CODE
#include <p18f452.h>
#include <adc.h>
#include <stdlib.h>
#include <delays.h>

int result;
int flash;
void main(void)
{

         //Set Port B Output & Clear
TRISB = 0x00;
PORTB = 0x00;


         //Initialize The A/D Converter
OpenADC( ADC_FOSC_32
      & ADC_RIGHT_JUST
      & ADC_8ANA_0REF,
      ADC_CH0 & ADC_INT_OFF );

while(1)
{
         //Flash At The Determined Rate
PORTB = 0x00;
Delay1KTCYx(flash);
PORTB = 0x01;
Delay1KTCYx(flash);

         //Get A/D Converted Value
Delay10TCYx(5);
ConvertADC();
while( BusyADC() );
   result = ReadADC();

   
            //If Within Normal Range Blink Slowly
if(result > 506 && result < 518)
   flash = 200;
   
            //If Slightly Tilted Blink Faster
if(result > 518 && result < 550)
   flash = 100;

if(result > 545 && result < 506)
   flash = 100;
   
            //If Really Tilted Blank FAST!   
if(result >= 550)
   flash = 25;

if(result <= 450)
   flash = 25;

}

}


Any advice? :)

Re: Balancing Robot (Minimalist Design Using Only Accelerometer)

PostPosted: Fri Jan 14, 2011 6:27 pm
by A380
For Kalman filter code, this may help you.. http://www.rotomotion.com/downloads/tilt.c
It is free of charge.

Re: Balancing Robot (Minimalist Design Using Only Accelerome

PostPosted: Sat Jan 29, 2011 11:12 pm
by SnowLeopard
Ok. Thank u very much. ^^

Re: Balancing Robot (schematic)

PostPosted: Thu Oct 20, 2011 2:10 pm
by ycwong
Hi!

May I know where can get the two wheel balacing schematic diagram that build by cytron.