Skip to content

Advanced Development

Leif Bloomquist edited this page Jun 29, 2015 · 15 revisions

This page contains more technical details for expert users who are creating or modifying custom Arduino sketches for SoMo. Currently it contains several links to information, be sure to check out the examples at https://github.com/SonicWear/Code to see some example implementations.

Technical Details

SoMo is 100% compatible with the Arduino Leonardo. In other words, it uses the Leonardo bootloader and the same microcontroller.

SoMo can be programmed directly from the Arduino IDE - simply select the Arduino Leonardo inside the Arduino IDE and the correct serial port. (Be careful not to select the serial port that corresponds to the USB XBee Receiver.)

Wireless Communications

SoMo uses XBee radios to communicate.

Sensor

SoMo is based on the MPU-9150 IMU (Inertial Measurement Unit) integrated circuit. The Datasheet is available in the Documentation repository at https://github.com/SonicWear/Documentation .

The IMU measures 9 "degrees of freedom":

  1. Acceleration X
  2. Acceleration Y
  3. Acceleration Z
  4. Gyroscope Rotation around X
  5. Gyroscope Rotation around Y
  6. Gyroscope Rotation around Z
  7. Magnetometer Vector X
  8. Magnetometer Vector Y
  9. Magnetometer Vector Z

The IMU is accessible through I2C at address 0x68 (default).

Libraries

There are several Arduino libraries that provide simple access to the IMU from within the Arduino environment:

Wire and I2CDev

These are required to poll the IMU over I2C.

MPU-6050

This library returns the raw IMU data with a single function call.

MPU-9150

Not tested - an upgrade to the above library explicitly for the MPU-9150.

https://github.com/jrowberg/i2cdevlib/tree/master/Arduino/MPU9150

RTIMULib

This is a more advanced library that provides Kalman Filtering (smoothing), sensor fusion and optional Quaternion output, which is useful for visualizations. It also provides a short sketch to calibrate the magnetometer - required for the sensor fusion to function correctly. The raw 9DOF data is still available.

In addition to the raw data, the sensor fusion provides an absolute pitch, roll, and yaw of the sensor orientation.

This has been confirmed to work with the SoMo V5 but has not been extensively tested.

SoftwareSerial

This library is not required by the IMU, but is used to allow the SoMo to communicate with the XBee radio using two I/O pins. (The hardware Serial is used by the USB port).

Hardware and I/O

The pinouts and GPIO for SoMo V5 are described on a separate page.

Note that the pinouts for the SoMo V4 are slightly different.

Clone this wiki locally