Go Down

Topic: how i calibrate acceleration of accelerometer lsm303dlm-ARDUINO UNO....SOS!!!!!! (Read 991 times) previous topic - next topic

zizi

I use this code to calibrate the LSM303 compass:

#include <Wire.h>
#include <LSM303.h>

LSM303 compass;
LSM303::vector running_min = {2047, 2047, 2047}, running_max = {-2048, -2048, -2048};

void setup() {
  Serial.begin(9600);
  Wire.begin();
  compass.init();
  compass.enableDefault();
}

void loop() { 
  compass.read();
 
  running_min.x = min(running_min.x, compass.m.x);
  running_min.y = min(running_min.y, compass.m.y);
  running_min.z = min(running_min.z, compass.m.z);

  running_max.x = max(running_max.x, compass.m.x);
  running_max.y = max(running_max.y, compass.m.y);
  running_max.z = max(running_max.z, compass.m.z);
 
  Serial.print("M min ");
  Serial.print("X: ");
  Serial.print((int)running_min.x);
  Serial.print(" Y: ");
  Serial.print((int)running_min.y);
  Serial.print(" Z: ");
  Serial.print((int)running_min.z);

  Serial.print(" M max "); 
  Serial.print("X: ");
  Serial.print((int)running_max.x);
  Serial.print(" Y: ");
  Serial.print((int)running_max.y);
  Serial.print(" Z: ");
  Serial.println((int)running_max.z);
 
  delay(100);
}

and i take maximum and minimum values for X,Y,Z ....how to use after these values???how i can use this code or this value to calibrate the acceleration value????i want code for calibrate acceleration value please....and then what can i do....???/[font=Verdana][/font]

AWOL

Gravity is a cheap and plentiful source of calibration data for accelerometers.

Please use code tags when posting code.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

zizi

I want a code to calculate the acceleration and then speed please!!!!!

AWOL

Quote
I want a code to calculate the acceleration and then speed please!!!!!

I don't have one, sorry.

(Is there something wrong with your punctuation keys?)
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy