10 DOF Sensor (SKU:SEN0140)
From Robot Wiki
Contents
1 Introduction
o 1.1 Applications
2 Specification
3 Connection Diagram
4 Example Code
Introduction
At the beginning,the inertial measurement unit is an electronic device that measures and reports
on a craft's velocity, orientation, and gravitational forces, using a combination of
accelerometers,gyroscopes, and magnetometers. Now IMUs are commonly used in the Humancomputer interaction(HCI), navigational purposes and balancing technology used in the Segway
Personal Transporter as we all known.
Applications
Aircraft
Balancing robots
Indoor inertial navigation
Altimeter
Human–computer Interaction (HCI)
Specification
Wide power input range from 3 to 8 volts
Low noise LDO regulator
Low cost IMU
Interface: I2C
M3x2 mounting holes for easily fixing in your mobile platforms,robots,HCI or UAVs
LED power indication
Integrate 10 dof sensors
o Adxl345 accelerometer
o ITG3200 gyro
o HMC5883L Compass
o BMP085 pressure sensor
Compact size design and easy‐to‐use
Compatible with Arduino controllers
Electricity gold PCB
Size: 26x18mm
Connection Diagram
10 Dof Connection Diagram
Example Code
Please download the libraries for the all the IMU sensors first!
#include
#include
#include
#include
#include
float angles[3]; // yaw pitch roll
float heading;
short temperature;
long pressure;
// Set the FreeSixIMU object
FreeSixIMU sixDOF = FreeSixIMU();
HMC5883L compass;
// Record any errors that may occur in the compass.
int error = 0;
void setup(){
Serial.begin(9600);
Wire.begin();
delay(5);
sixDOF.init(); //init the Acc and Gyro
delay(5);
compass = HMC5883L(); // init HMC5883
error = compass.SetScale(1.3); // Set the scale of the compass.
error = compass.SetMeasurementMode(Measurement_Continuous); // Set the meas
urement mode to Continuous
if(error != 0) // If there is an error, print it out.
Serial.println(compass.GetErrorText(error));
bmp085Calibration(); // init barometric pressure sensor
}
void loop(){
sixDOF.getEuler(angles);
temperature = bmp085GetTemperature(bmp085ReadUT());
pressure = bmp085GetPressure(bmp085ReadUP());
getHeading();
PrintData();
delay(300);
}
void getHeading(){
// Retrive the raw values from the compass (not scaled).
MagnetometerRaw raw = compass.ReadRawAxis();
// Retrived the scaled values from the compass (scaled to the configured sc
ale).
MagnetometerScaled scaled = compass.ReadScaledAxis();
// Values are accessed like so:
int MilliGauss_OnThe_XAxis = scaled.XAxis;// (or YAxis, or ZAxis)
// Calculate heading when the magnetometer is level, then correct for signs
of axis.
heading = atan2(scaled.YAxis, scaled.XAxis);
float declinationAngle = 0.0457;
heading += declinationAngle;
// Correct for when signs are reversed.
if(heading < 0)
heading += 2*PI;
// Check for wrap due to addition of declination.
if(heading > 2*PI)
heading -= 2*PI;
// Convert radians to degrees for readability.
heading = heading * 180/M_PI;
}
void PrintData(){
Serial.print("Eular Angle: ");
Serial.print(angles[0]);
Serial.print("
");
Serial.print(angles[1]);
Serial.print("
");
Serial.print(angles[2]);
Serial.print("
");
Serial.print("Heading: ");
Serial.print(heading);
Serial.print("
");
Serial.print("Pressure: ");
Serial.print(pressure, DEC);
Serial.println(" Pa");
}
Open the arduino IDE serial monitor, you will get:
Powered By DFRobot © 2008-2017
很抱歉,暂时无法提供与“SEN0140”相匹配的价格&库存,您可以联系我们找货
免费人工找货