Configure a WitMotion IMU
An inertial measurement unit (IMU) provides data for the AngularVelocity
, Orientation
, CompassHeading
, and LinearAcceleration
methods.
Acceleration and magnetometer data are available by using the sensor GetReadings
method, which IMUs wrap.
The imu-wit
movement sensor model supports the following IMUs manufactured by WitMotion:
Info
Other WitMotion IMUs that communicate over serial may also work with this model but have not been tested.
Navigate to the Config tab of your robot’s page in the Viam app.
Click on the Components subtab and click Create component.
Select the movement-sensor
type, then select the imu-wit
model.
Enter a name for your movement sensor and click Create.

Edit and fill in the attributes as applicable.
{
"components": [
{
"name": "<your-sensor-name>",
"type": "movement_sensor",
"model": "imu-wit",
"attributes": {
"serial_path": "<your-port>",
"serial_baud_rate": <int>
},
"depends_on": []
}
]
}
{
"components": [
{
"name": "myIMU",
"type": "movement_sensor",
"model": "imu-wit",
"attributes": {
"serial_path": "/dev/serial/by-path/<device_ID>",
"serial_baud_rate": 115200
},
"depends_on": []
}
]
}
Attributes
Name | Type | Inclusion | Description |
---|---|---|---|
serial_path | string | Required | The full filesystem path to the serial device, starting with sudo dmesg | grep tty to show relevant device connection log messages, and then match the returned device name, such as ttyS0 , to its device file, such as |
serial_baud_rate | int | Optional | The rate at which data is sent from the sensor over the serial connection. Valid rates are 9600 and 115200 . The default rate will work for all models. Only the HWT901B can have a different serial baud rate. Refer to your model’s data sheet.Default: 115200 |
Test the movement sensor
After you configure your movement sensor, navigate to the Control tab and select the dedicated movement sensor dropdown panel. This panel presents the data collected by the movement sensor. The sections in the panel include the position, orientation, angular velocity, linear velocity, and linear acceleration.

Have questions, or want to meet other people working on robots? Join our Community Discord.
Was this page helpful?
Glad to hear it! If you have any other feedback please let us know:
We're sorry about that. To help us improve, please tell us what we can do better:
Thank you!