Using SoMo by SonicWear as a MIDI Controller

I’ve been working with the SoMo by SonicWear, a cool little device that generates sound through movement, and I had some input into its design.  SonicWear is a Toronto-based startup, and the project itself originated with Loretta Faveri at OCAD University’s Social Body Lab.

Photo Credit:Asma  Khanani Caporaletti
Photo Credit: Asma Khanani Caporaletti

The main target platform for SoMo is Max/MSP on a Mac, but I was interested in using SoMo in other platforms, notably FL Studio in Windows.  So I set out to adapt SoMo into a more general-purpose MIDI controller that could be used with any music software, using some freely available tools.

The main ingredients are:

  1. My custom code for the SoMo (Arduino compatible) – this is for V4.0 of the device, and the accompanying XBee profile.
  2. The amusingly named “Hairless MIDI Bridge“.
  3. (For Windows) The “loopMIDI” virtual MIDI loopback cable application.

Read on for details.

Part 1: Arduino Code

SoMo is compatible with the Arduino Leonardo, so you can reprogram it using the standard Arduino IDE.

  1. Download my sketch (code) from here.  You’ll see this initial version only works with the accelerometer (x/y/z axes), but it can be extended to incorporate the gyro and magnetometer easily enough.
  2. Load the sketch into the Arduino IDE.
  3. Ensure you have the SoftwareSerial, i2c, and MPU6050 libraries imported.
  4. Plug in the SoMo to your computer with the USB cable.  It should appear on a virtual COM port – Check that you have the right one selected in the Arduino IDE.
  5. Select “Arduino Leonardo” as the target board.
  6. Upload the code, and confirm there are no errors.
  7. Unplug the SoMo.

Part 1a: XBee Programming

  1. Configure both XBees to 38,400 baud, 8 Data bits, No Parity, 1 Stop bit, no flow control.  (In theory this will allow bidirectional communication with the SoMo, which could be useful for feedback or remote configuration in future.)
  2. To do this, you can use Digi’s X-CTU software to load my predefined XBee Profile.

Part 2: loopMIDI (Windows Only)

  1. Download and install the “loopMIDI” virtual MIDI loopback cable application.
  2. Run it, and create a new virtual port called “SonicWear SoMo V4”.
  3. This creates a virtual MIDI port that can be accessed by name from your music software.

loopmidi

Part 3: Hairless MIDI Bridge

  1. Download the Hairless MIDI Bridge version for your Operating System and run it.
  2. Under File->Preferences, under Serial Port Settings, make sure the settings match those of the XBee above.
    prefs
  3. Ensure “Serial<->MIDI Bridge On” is selected.
  4. Select the COM port (or ttyS port for Mac/Linux) that the receiver XBee is connected to.
  5. (For Windows) Select the “SonicWear SoMo V4” under MIDI Out.  (I’ve not tested this setup on a Mac or Linux.  If you have, please leave a comment with the port you should use!).
  6. Switch on the SoMo.
  7. You should see data streaming in the Debug window, with green LEDs flashing several times a second.

midibridge

You’re done!

Load up your music software and activate the  “SonicWear SoMo V4” port as an input.  You should see data appearing in the following Continuous Controllers:

  • CC #20: Accelerometer X   (These include gravity, so you can use them to sense SoMo’s angle.)
  • CC #21: Accelerometer Y
  • CC #22: Accelerometer Z
  • CC #23: Accelerometer Magnitude  (Gravity removed)
  • CC #24: Gyroscope X
  • CC #25: Gyroscope Y
  • CC #26: Gyroscope Z
  • CC #27: Magnetometer X
  • CC #28: Magnetometer Y
  • CC #29: Magnetometer Z

Move the SoMo around (or start dancing!)  From here, you can map the CC’s to filters, pitch bend, etc. and/or extend the code to possibly generate MIDI notes based on different thresholds.   It’s up to you!  

Please share your creations!

Update: The additional CCs for Gyro and Magnetometer have been implemented now.

Leave a comment