Sending OSC data from M5StickCPlus2 over local network
Projects have Arduino IDE sketches structure
To make a project work you will need to create wifi_config.h file in this projects folder.
The file must have the following structure:
#define SSID "your-wifi-network-name"
#define PASS "your-wifi-network-password"
#define OUT_IP { 127, 0, 0, 1 }Where SSID and PASS reflect your WiFi's name and password and OUT_IP matches IPv4 address of the device that should receive the OSC data.
Receiving device is expected to listen for incoming data on port 8000
Script that will send M5StickCPlus2 onboard IMU (MPU6886) data via OSC messages.
Keep in mind that the MPU6886 IMU does not have geomagnetic sensor so the AHRS data and quaternions are calculated using Mahony's AHRS algorithm
Created based on: Edinburgh-College-of-Art/m5stickc-plus-introduction/.../SendFloat_IMU.ino
There is a calibration routine for setting the 'zero' (no rotation) positon - it can be started by pressing the A button.
During this calibration (1 second) the M5StickCPlus2 should be stationary
The following data is transmitted:
/ypr- calculated attitude and heading reference system (AHRS) - formatted for SPARTA Rotator/SceneRotator/quaternions- calculated quaternions representing rotation - formatted for IEM Scene Rotator
It's also possible to transmit:
/gyro- gyroscope data/acc- accelerometer data
Script that will send M5 IMU Pro (BMI270, BMM150 and BMP280) data via OSC messages.
The AHRS data and quaternions are calculated using Mahony's AHRS algorithm
This sketch has one more dependecy:
Once you install the above library you should make a change in it so that the magnetometer data will have a float type
There is a calibration routine for setting the 'zero' (no rotation) positon - it can be started by pressing the A button.
During this calibration (1 second) the M5StickCPlus2 should be stationary
There is also a magnetometer calibration routine. It is used to normalize the data comming from magnetometer. It can be started by pressing the B button.
During this calibration (30 seconds) the M5 IMU Pro sensor should be gradually rotated and turned so that each side of the sensor is facing 'up' at least once.
Keed in mind that there is a magnet inside of the M5StickCPlus2, so try to move the sensor away from the M5StickCPlus2
The following data is transmitted:
/ypr- calculated attitude and heading reference system (AHRS) - formatted for SPARTA Rotator/SceneRotator/quaternions- calculated quaternions representing rotation - formatted for IEM Scene Rotator
It's also possible to transmit:
/gyro- gyroscope data/acc- accelerometer data/mag- magnetometer data