The previous post featured a code for the LSM9DSO0 accelerometer in combination with the Huzzah ESP8266. Since the LSM9DSO0 is not produced anymore, here is an alternative: Using the MPU-6050 acceleration and gyroscope sensor. Thanks for Jennifer Sykes for suggesting this alternative and assembling and testing the code.

When setting the Target IP in the ESP code to the network settings of Parat+, moving, tilting and rotating the sensor will send the sensor reading as OSC bundles (i.e. packages of separate OSC messages) to Parat+. These will appear as Source Faders:

/esp/accelX /esp/accelY /esp/accelZ

/esp/gyroX /esp/gyroY /esp/gyroZ

Use the range learn functions of the Parat+ Source faders to calibrate the data streams to the movements you wish to use.

Connect the ‘Value controlled by Source’ in the Fader Edit view of any Parat+ Fader to have that OSC and MIDI controller controlled by your sensor.

// uncomment “OUTPUT_BINARY_ACCELGYRO” to send all 6 axes of data as 16-bit // binary, one right after the other. This is very fast (as fast as possible // without compression or data loss), and easy to parse, but impossible to read // for a human. //#define OUTPUT_BINARY_ACCELGYRO int16_t ax, ay, az; int16_t gx, gy, gz;

This post describes the assembly of a wireless sensor transmitter suitable for music and art performance and installation setups. It has been very reliable for performance. At the time of writing I had to learn that the sensor used here (LSM9DS0 with i2c) is not produced anymore. I will update this post in the near future with a more up-to-date sensor breakout board.

void getMag() { // To read from the magnetometer, you must first call the // readMag() function. When this exits, it’ll update the // mx, my, and mz variables with the most current data. dof.readMag();

// Now we can use the mx, my, and mz variables as we please. // Either print them as raw ADC values, or calculated in Gauss. mX = dof.calcMag(dof.mx); mY = dof.calcMag(dof.my); mZ = dof.calcMag(dof.mz); }

void getGyro() { // To read from the gyroscope, you must first call the // readGyro() function. When this exits, it’ll update the // gx, gy, and gz variables with the most current data. dof.readGyro(); gX = dof.calcGyro(dof.gx); gY = dof.calcGyro(dof.gy); gZ = dof.calcGyro(dof.gz);

}

void getAccel() { // To read from the accelerometer, you must first call the // readAccel() function. When this exits, it’ll update the // ax, ay, and az variables with the most current data. dof.readAccel();

// If you want to print calculated values, you can use the // calcAccel helper function to convert a raw ADC value to // g’s. Give the function the value that you want to convert. aX = dof.calcAccel(dof.ax); aY = dof.calcAccel(dof.ay); aZ = dof.calcAccel(dof.az);