The BMG160 is an ultra-small, digital 3-axis angular rate sensor with a measurement range up to 2000°/s and a digital resolution of 16 bit for consumer electronics applications. The BMG160 allows low-noise measurement of angular rates in 3 perpendicular axes and is designed for use in cellular phones, handhelds, computer peripherals, man-machine interfaces, virtual reality features, remote and game controllers.
With its small footprint of only 3 x 3 mm² the BMG160 is unique in the class of low-noise consumer electronics gyroscopes. The zero-rate offset and offset stability over temperature of the BMG160 are outstanding
| Parameter | Technical data |
|---|---|
| Digital resolution | 16 bit |
| Measurement ranges (programmable) |
± 125 °/s, ± 250 °/s, ± 500 °/s, ± 1000 °/s, ± 2000 °/s |
| Sensitivity (calibrated) | ± 125°/s: 262.4 LSB/°/s ± 250°/s: 131.2 LSB/°/s ± 500°/s: 65.5 LSB/°/s ± 1000°/s: 32.8 LSB/°/s ± 2000°/s: 16.4 LSB/°/s |
| Zero-g offset (typ., over life-time) | ± 1 °/s |
| Zero-rate offset over temperature | 0.015 °/s/K |
| Noise density (typ.) | 0.014 °/s/√Hz |
| Low-pass filter bandwiths (progr.) | 230, 116, 64, 47, 32, 23, 12 Hz |
| Date rates (programmable) | 2000, 1000, 400, 200, 100 Hz |
| Digital inputs/outputs | SPI, I²C, 2x digital interrupts |
| Supply voltage (VDD) | 2.4 … 3.6 V |
| I/0 supply voltage (VDDIO) | 1.2 … 3.6 V |
| Temperature range | -40 … +85 °C |
| Current consumption – full operation – low-power mode |
5.0 mA 2.5 mA |
| FIFO data buffer | 100 samples depth (each axis) |
| LGA package | 3 x 3 x 0.95 mm³ |
| Shock resistance | 10,000 g x 200 μs |
Connection
These are the only connections that are required
| Arduino Connection | CJ_MCU 160 |
| 5v | Vcc |
| Gnd | Gnd |
| SDA | SDA |
| SCL | SCL |
Code
[codesyntax lang=”cpp”]
#include<Wire.h>
// BMG160 I2C address is 0x68(104)
#define Addr 0x68
void setup()
{
// Initialise I2C communication as MASTER
Wire.begin();
// Initialise Serial Communication, set baud rate = 9600
Serial.begin(9600);
// Start I2C Transmission
Wire.beginTransmission(Addr);
// Select Range register
Wire.write(0x0F);
// Configure full scale range 2000 dps
Wire.write(0x80);
// Stop I2C Transmission
Wire.endTransmission();
// Start I2C Transmission
Wire.beginTransmission(Addr);
// Select Bandwidth register
Wire.write(0x10);
// Set bandwidth = 200 Hz
Wire.write(0x04);
// Stop I2C Transmission
Wire.endTransmission();
delay(300);
}
void loop()
{
unsigned int data[6];
// Start I2C Transmission
Wire.beginTransmission(Addr);
// Select Gyrometer data register
Wire.write(0x02);
// Stop I2C Transmission
Wire.endTransmission();
// Request 6 bytes of data
Wire.requestFrom(Addr, 6);
// Read 6 bytes of data
// xGyro lsb, xGyro msb, yGyro lsb, yGyro msb, zGyro lsb, zGyro msb
if(Wire.available() == 6)
{
data[0] = Wire.read();
data[1] = Wire.read();
data[2] = Wire.read();
data[3] = Wire.read();
data[4] = Wire.read();
data[5] = Wire.read();
}
delay(300);
// Convert the data
int xGyro = ((data[1] * 256) + data[0]);
int yGyro = ((data[3] * 256) + data[2]);
int zGyro = ((data[5] * 256) + data[4]);
// Output data to the serial monitor
Serial.print("X-Axis of Rotation: ");
Serial.println(xGyro);
Serial.print("Y-Axis of Rotation: ");
Serial.println(yGyro);
Serial.print("Z-Axis of Rotation: ");
Serial.println(zGyro);
delay(500);
}
[/codesyntax]
Output
Open the serial monitor and you should see something like this
X-Axis of Rotation: -336
Y-Axis of Rotation: 572
Z-Axis of Rotation: -1602
X-Axis of Rotation: -158
Y-Axis of Rotation: -256
Z-Axis of Rotation: 496
X-Axis of Rotation: -4916
Y-Axis of Rotation: 2098
Z-Axis of Rotation: 1128
Link
CJMCU-160 Sensortec three axis gyro attitude sensor module BMG160


