Configure an MPU-6050 Gyroscope/Accelerometer
The gyro-mpu6050
movement sensor model supports a combination gyroscope and accelerometer manufactured by TDK InvenSense.
Navigate to the Config tab of your robot’s page in the Viam app.
Click on the Components subtab and navigate to the Create component menu.
Enter a name for your movement sensor, select the movement-sensor
type, and select the gyro-mpu6050
model.
Click Create Component.
Edit and fill in the attributes as applicable.
{
"components": [
{
"name": "<your-sensor-name>",
"type": "movement_sensor",
"model": "gyro-mpu6050",
"attributes": {
"board": "<your-board-name>",
"i2c_bus": "<your-i2c-bus-name-on-board>",
"use_alt_i2c_address": <bool>
},
"depends_on": []
}
]
}
{
"components": [
{
"name": "local",
"type": "board",
"model": "pi",
"attributes": {
"i2cs": [
{
"name": "default_i2c_bus",
"bus": "1"
}
]
}
},
{
"name": "my_accelgyro",
"type": "movement_sensor",
"model": "gyro-mpu6050",
"attributes": {
"use_alt_i2c_address": true,
"i2c_bus": "default_i2c_bus",
"board": "local"
}
}
]
}
Attributes
Name | Type | Inclusion | Description |
---|---|---|---|
board | string | Required | The name of the board to which the device is wired. |
i2c_bus | string | Required | The name of the I2C bus configured on your board wired to this device. |
use_alt_i2c_address | boolean | Required | Depends on whether you wire AD0 low (leaving the default address of 0x68) or high (making the address 0x69). If high, set true . If low, set false .Default: false |
Have questions, or want to meet other people working on robots? Join our Community Discord.
Was this page helpful?
Glad to hear it! If there is anything we could be doing better, please create an issue.
We're sorry about that. If you'd like to talk to us for help, please join the Community Discord. To ensure we know what's wrong with this page, you can also open an issue.