-
Notifications
You must be signed in to change notification settings - Fork 0
Advanced Development
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.
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.)
SoMo uses XBee radios to communicate.
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":
- Acceleration X
- Acceleration Y
- Acceleration Z
- Gyroscope Rotation around X
- Gyroscope Rotation around Y
- Gyroscope Rotation around Z
- Magnetometer Vector X
- Magnetometer Vector Y
- Magnetometer Vector Z
The IMU is accessible through I2C at address 0x68 (default).
There are several Arduino libraries that provide simple access to the IMU from within the Arduino environment:
These are required to poll the IMU over I2C.
This library returns the raw IMU data with a single function call.
- https://github.com/jrowberg/i2cdevlib/tree/master/Arduino/MPU6050 (also supports the MPU-9150)
Not tested - an upgrade to the above library explicitly for the MPU-9150.
https://github.com/jrowberg/i2cdevlib/tree/master/Arduino/MPU9150
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.
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).
The pinouts and GPIO for SoMo V5 are described on a separate page.
Note that the pinouts for the SoMo V4 are slightly different.