Skip to content

viam-modules/wit-motion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This wit-motion module implements a WitMotion imu movement sensor, including the HWT905-TTL IMU model using the rdk:component:movement_sensor API.

The imu-wit movement sensor model supports the following IMUs manufactured by :

  • BWT61CL
  • BWT901CL
  • HWT901B-TTL

The imu-wit-hwt905 movement sensor model supports the HWT905-TTL IMU manufactured by WitMotion.

Other WitMotion IMUs that communicate over serial may also work with this model but have not been tested.

Configure your imu-wit movement_sensor

Note

Before configuring your movement_sensor, you must create a machine.

Navigate to the CONFIGURE tab of your machine in the Viam app. Add movement_sensor / wit-motion:imu-wit to your machine.

On the new component panel, copy and paste the following attribute template into your movement_sensor's attributes field:

{
    "serial_path": "<your-port>",
    "serial_baud_rate": <int>
}

Attributes

The following attributes are available for viam:wit-motion:imu-wit movement_sensors:

Attribute Type Required? Description
serial_path string Required The full filesystem path to the serial device, starting with /dev/. To find your serial device path, first connect the serial device to your machine, then:
  • On Linux, run ls /dev/serial/by-path/* to show connected serial devices, or look for your device in the output of sudo dmesg | grep tty. Example: "/dev/serial/by-path/usb-0:1.1:1.0".
  • On macOS, run ls /dev/tty* | grep -i usb to show connected USB serial devices, ls /dev/tty* to browse all devices, or look for your device in the output of sudo dmesg | grep tty. Example: "/dev/ttyS0".
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

Example configuration

viam:wit-motion:imu-wit

  {
      "name": "<your-wit-motion-imu-wit-movementsensor-name>",
      "model": "viam:wit-motion:imu-wit",
      "type": "movement_sensor",
      "namespace": "rdk",
      "attributes": {
          "serial_path": "/dev/serial/by-path/usb-0:1.1:1.0",
          "serial_baud_rate": 115200
      },
      "depends_on": []
  }

viam:wit-motion:imu-wit-hwt905

  {
      "name": "<your-wit-motion-imu-wit-hwt905-movementsensor-name>",
      "model": "viam:wit-motion:imu-wit-hwt905",
      "type": "movement_sensor",
      "namespace": "rdk",
      "attributes": {
          "serial_path": "/dev/serial/by-path/usb-0:1.1:1.0",
          "serial_baud_rate": 115200
      },
      "depends_on": []
  }

Next Steps

  • To test your movement_sensor, expand the TEST section of its configuration pane or go to the CONTROL tab.
  • To write code against your movement_sensor, use one of the available SDKs.
  • To view examples using a movement_sensor component, explore these tutorials.