Huzzah ESP8266 with MPU6050 accelerometer, Arduino IDE.

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;