IMU combo board 3 DOF - ADXL203/ADXRS614.. Coding Help Needed !!!

erm .. Hi, i got this project here involving IMU Combo Board 3 DOF - ADXL203/ADXR614 from Sparkfun http://www.robot-r-us.com/vmchk/sensor-inertia/imu-combo-board-3-degrees-of-freedom-adxl203/adxrs614.htmland my due deadline is next friday. i need help in the Coding ! this forum provide me some really useful information but because i just started this project for 3 weeks so i don't understand how to write and so i cant write out the code. I am really frustrated by it, and i need to connect it with Joystick and Servo, but that part can save it for later. I use an Arduino Pro Mini, I connect my IMU combo board - 3 DOF Vcc to my Arduino ProMini and Gnd to Gnd. den my X-acc to A0, Yacc to A1 and Gyro Z to A2. At 1st , my Gyro Z is showing nth, den i try connecting a 5v supply to it, the whole program stop, den when i pluck out the 5v supply, everything resume and even my Gyro start working alr. I do not know why this is happening. I hope there is someone here that is able to write a sample here for me to write the code . PLEASE HELP ME ! thank you very much. At least please reply ..

*Sorry to AWOL, ur replies was useful, i really love it. Sorry for the whining, I wasn't feeling good that day because of the project. I am really sorry if i offended u.

At 1st , my Gyro Z is showing nth, den i try connecting a 5v supply to it, the whole program stop, den when i pluck out the 5v supply, everything resume and even my Gyro start working alr.

That doesn't make a lot of sense to me. I don't speak txt. Can you show your program, and a drawing of how things are connected?

sure . i will show u the connection and program tml. My things is currently in school now. My lecturer doesn't allow us to bring back home.

I’m sorry - I don’t understand your abbreviations.
What do “nth”, “tml”, “den” “alr” mean?

Start simple:

void setup ()
{
  Serial.begin (9600);  
}

void loop ()
{
  for (int i = 0; i < 3; ++i) {
    Serial.print (analogRead (i));
    Serial.print (" ");  
  }
  Serial.println ();
  delay (100);
}

Wire your three axes to the first three analogue inputs on the Arduino, and see if the results look sensible.
Don’t forget to common the grounds.

sorry , those are short form .. nth = nothing . tml = tomorrow. alr = already.

this is the result i got from using the program u gave. i don’t know if it’s right or wrong…
i connect Vcc to 5v, Gnd to Gnd, A0 to RATE, A1 to ACCEL_X, A2 to ACCEL_Y…

1 489 480 
1 488 480 
1 490 484 
1 489 476 
2 488 488 
1 489 473 
1 488 491 
2 488 470 
1 489 493 
1 489 469 
2 489 492 
1 489 470 
1 489 490 
2 489 474 
1 489 485 
1 489 478 
1 489 482 
1 489 483 
1 489 477 
1 489 487 
1 489 473 
1 489 491 
1 490 471 
1 488 493 
1 489 469 
1 489 493

My program is this … took it from a certain post…
// Main module K_bot angles in Quids, 10 bit ADC -------------
// 4 - Checking sensor data format display raw sensors data

// Main module   K_bot               angles in Quids, 10 bit ADC  -------------
// 4 - Checking sensor data format    display raw sensors data            

#include <math.h>

#define   GYR_Z                 2                              // Gyro Z (IMU pin #7)
#define   ACC_X                 0                              // Acc  X (IMU pin #1)
#define   ACC_Y                 1                              // Acc  Y (IMU pin #2)

int   STD_LOOP_TIME  =          9;            

int sensorValue[3]  = { 0, 0, 0};
int sensorZero[3]   = { 0, 0, 0};
int lastLoopTime = STD_LOOP_TIME;
int lastLoopUsefulTime = STD_LOOP_TIME;
unsigned long loopStartTime = 0;


void setup() {
  analogReference(DEFAULT);                                   // Aref 5V
  Serial.begin(115200);                                                
  calibrateSensors();
}

void loop() 
{  
// ********************* Sensor aquisition & filtering *******************
  updateSensors();
  
// ********************* print Debug info *************************************
  serialOut_raw();

// *********************** loop timing control **************************
  lastLoopUsefulTime = millis()-loopStartTime;
  if(lastLoopUsefulTime<STD_LOOP_TIME)         delay(STD_LOOP_TIME-lastLoopUsefulTime);
  lastLoopTime = millis() - loopStartTime;
  loopStartTime = millis();
}

void serialOut_raw() {
static int skip=0;
  if(skip++==40) {                                                        
    skip = 0;
    Serial.print("ACC_X:");           Serial.print(sensorValue[ACC_X]);          
    Serial.print("  ACC_Y:");         Serial.print(sensorValue[ACC_Y]);
    Serial.print("  GYR_Z:");         Serial.println(sensorValue[GYR_Z]);
  }
}

// Sensors Module  ---------------------------------------------------------------------

void calibrateSensors() {                                       // Set zero sensor values
  long v;
  for(int n=0; n<3; n++) {
    v = 0;
    for(int i=0; i<50; i++)       v += readSensor(n);
    sensorZero[n] = v/50;
  }                                                          
  sensorZero[ACC_X] -= 205;                        
}

void updateSensors() {                                         // data acquisition
  long v;
  for(int n=0; n<3; n++) {
    v = 0;
    for(int i=0; i<5; i++)       v += readSensor(n);
    sensorValue[n] = v/5 - sensorZero[n];
  }
}

int readSensor(int channel){
  return (analogRead(channel));
}

and the result i get before putting in the 5v supply. by the way, i am using Arduino Pro Mini which doesn’t come with a Aref pin. so my connection is
Arduino Pro Mini : IMU combo board - 3 DOF
Vcc : 5v
GND : GND
A0 : ACC_X
A1 : ACC_Y
A2 : Gyro_Z
… that’s all the connection i made. nothing more nothing much

ACC_X:209  ACC_Y:0  GYR_Z:1
ACC_X:210  ACC_Y:1  GYR_Z:1
ACC_X:209  ACC_Y:1  GYR_Z:1
ACC_X:209  ACC_Y:0  GYR_Z:1
ACC_X:210  ACC_Y:0  GYR_Z:0
ACC_X:210  ACC_Y:-1  GYR_Z:1
ACC_X:209  ACC_Y:0  GYR_Z:0
ACC_X:209  ACC_Y:0  GYR_Z:1
ACC_X:209  ACC_Y:0  GYR_Z:1
ACC_X:209  ACC_Y:0  GYR_Z:1
ACC_X:209  ACC_Y:0  GYR_Z:1
ACC_X:209  ACC_Y:0  GYR_Z:1
ACC_X:209  ACC_Y:0  GYR_Z:1
ACC_X:209  ACC_Y:-1  GYR_Z:1
ACC_X:209  ACC_Y:0  GYR_Z:1
ACC_X:209  ACC_Y:0  GYR_Z:1
ACC_X:210  ACC_Y:0  GYR_Z:1
ACC_X:209  ACC_Y:0  GYR_Z:1
ACC_X:210  ACC_Y:0  GYR_Z:1
ACC_X:209  ACC_Y:0  GYR_Z:1
ACC_X:209  ACC_Y:0  GYR_Z:1
ACC_X:210  ACC_Y:0  GYR_Z:0
ACC_X:209  ACC_Y:0  GYR_Z:1
ACC_X:209  ACC_Y:0  GYR_Z:1

as u can see, my YAW gyro is not moving when i turn it. den the weird thing is after i try connecting a 5v power supply into my IMU Combo Board 5v.
I get this result when i turn my Gyro.

ACC_X:205  ACC_Y:0  GYR_Z:3
ACC_X:205  ACC_Y:1  GYR_Z:2
ACC_X:205  ACC_Y:0  GYR_Z:3
ACC_X:205  ACC_Y:0  GYR_Z:2
ACC_X:205  ACC_Y:1  GYR_Z:-2
ACC_X:205  ACC_Y:0  GYR_Z:0
ACC_X:205  ACC_Y:1  GYR_Z:-1
ACC_X:205  ACC_Y:1  GYR_Z:1
ACC_X:221  ACC_Y:6  GYR_Z:73
ACC_X:206  ACC_Y:-1  GYR_Z:0
ACC_X:195  ACC_Y:6  GYR_Z:-96
ACC_X:170  ACC_Y:12  GYR_Z:-19
ACC_X:214  ACC_Y:-4  GYR_Z:148
ACC_X:195  ACC_Y:-8  GYR_Z:-85
ACC_X:211  ACC_Y:14  GYR_Z:-173
ACC_X:184  ACC_Y:-8  GYR_Z:223
ACC_X:205  ACC_Y:1  GYR_Z:1
ACC_X:205  ACC_Y:1  GYR_Z:2
ACC_X:205  ACC_Y:0  GYR_Z:1
ACC_X:205  ACC_Y:1  GYR_Z:0
ACC_X:205  ACC_Y:0  GYR_Z:4

and it remain somehow abit constant when i’m not moving… this confuse me. why must i always connect a 5v supply to my 5v on my IMU combo board to make my gyro work ?
and feel free to alter the code. I welcome ppl to tell me what’s my mistake were … Please help ! My due is coming …!!

Well apart from the dubious timing control, this:sensorZero[ACC_X] -= 205; pops out. What about the other axes? Where does 205 come from?

Have you measured the supply voltages? From the program I gave you, the rate reading looks completely wrong, but the accelerometer values look OK, if a little low.

Have you read this: http://www.sparkfun.com/datasheets/Accelerometers/IMU_Combo_Board-v1.pdf

You explained the other abbreviations, but what is "den"?

sorry for the late reply, had some meeting and briefing to do today for some event. den is = then or than. we just like to use it for short.

the -=205 i got it from a post, i also din really think about it, i will go check it to see what is that 1 about.

My accelerometer is perfectly fine. i'm just confuse about my gyro. and the method to converting the RATE into Angle degree at a range of 0-180 for my servo.

i will measure the voltage tml when i return to my school. thks for ur advice. this project is causing me headache to forget common things.

hi .. i measured the supply voltage. it's 3.4v, my ACCEL X is 2.14v and ACCEL Y is 2.13v while my Gyro is onli 14.4mV.. what's wrong with my voltage .. is it right ? i'm confuse..

i measured the supply voltage. it's 3.4v

That datasheet says it should be 5V.

What's the supply voltage of the Arduino? (just for completeness, and the fact that it supplies the reference)

while my Gyro is onli 14.4mV.. what's wrong with my voltage .. is it right ?

From what I've read from the datasheet, that is wrong.

sorry. i think i mention wrongly. it's not the supply voltage. it's the voltage that come out from Arduino is 3.4v, i'm using the USB cable connected to FTDI Basic Breakout board to Arduino. so i dunno my supply voltage to Arduino ..

i dunno my supply voltage to Arduino ..

I don't know (note spelling) the voltage either, but [u]you[/u] could measure it.

it's the voltage that come out from Arduino is 3.4v

Which supply are you using? You should be using the 5V supply pin.