Node-RED MCU　で　BNO055を使う

これはメモです。
ArduinoのAdafruit BNO055のライブラリのread_all_data.inoを移植

# はじめに
## 組み合わせ
~~M5StickC Plus~~ (不安定でした。)
M5Stack Core2
秋月のBN055 https://akizukidenshi.com/catalog/g/gK-16996/
PullUP抵抗を付けないと動作不安定かも？（秋月のQ&A参照）
(4.7kΩtつけても不安定。。。。<--M5StickC Plus使用時）

https://learn.adafruit.com/adafruit-bno055-absolute-orientation-sensor/overview
によると、実装にも問題があるとのこと？

:::note warn
BNO055 I2C インプリメンテーションは、状況によっては I2C プロトコルに違反します。これにより、特定のチップファミリではうまく機能しません。Espressif ESP32、ESP32-S3、およびNXP i.MX RT1011ではうまく機能せず、I2Cマルチプレクサではうまく機能しません。SAMD51、RP2040、STM32F4、およびnRF52840での動作の信頼性が向上します。
:::

## Node-RED MCUのI2CIn
- msg.addressがあればそれを優先、ない時にI2CInのプロパティのアドレスを利用し、msg.addressで出力。
- I2CInのプロパティのComanndがあればそれを、なければmsg.commandを実行します。出力のmsg.commandには使用した方が入ります。
- 結果はmsg.payloadにUint8Array()で出力されます。

## Node-RED MCUのI2COut
- msg.addressがあればそれを優先、ない時にI2CInのプロパティのアドレスを利用し、msg.addressで出力。
- コマンドは次の順で実行（どちらか）
　1. I2CInのプロパティのComannd
　2. I2CInのプロパティのpayload 　

## BNO055について
- Address 40(0x28)
- Speed　400kHz (p.91)　50kHzのサンプルもあり

# 初期化部分
1.MCU 起動後 0.1秒後に起動(Injection)

2.setMode(OPERATION_MODE_CONFIG); //write8(BNO055_OPR_MODE_ADDR(0x3d:61), _mode(0x00:0));

3.write8(BNO055_SYS_TRIGGER_ADDR(0x3f:63), 0x20:32); //System Reset

4.Delay(600ms) 再起動に必要な時間　400msでは足りなかった。
本当は
```
  /* Delay incrased to 30ms due to power issues https://tinyurl.com/y375z699 */
  delay(30);
  while (read8(BNO055_CHIP_ID_ADDR) != BNO055_ID) {
     delay(10);
  }
  delay(50);
```

5.write8(BNO055_PWR_MODE_ADDR(0x3e:62), POWER_MODE_NORMAL(0x00:0));  // Set to normal power mode

6.delay(10);

7.write8(BNO055_PAGE_ID_ADDR(0x07:7), 0);

8.write8(BNO055_SYS_TRIGGER_ADDR(0x3f:63), 0x0);

9.delay(10);

10.setMode(mode);//defalt=OPERATION_MODE_NDOF
  //write8(BNO055_OPR_MODE_ADDR(0x3d), OPERATION_MODE_NDOF(0x0c));

11.delay(20); //実際には要らない

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/97061/be346cc5-5da3-4ee8-b2ca-516c07e6f9a5.png)


# 確認用
## GetMode
14が返ってくれば、OPERATION_MODE_NDOF
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/97061/b16d6a4d-7daa-f1ee-a5b1-f02808a970b2.png)

# データ収集部分


## 温度　(0x34:52)
温度は、チップ内なので高めですね。

## キャリブレーションData（0x35:53）

## OrientationData(0X1A:26)
```
    VECTOR_EULER = BNO055_EULER_H_LSB_ADDR,
   /* Euler data registers */
    BNO055_EULER_H_LSB_ADDR = 0X1A(26),
    BNO055_EULER_H_MSB_ADDR = 0X1B(27),
    BNO055_EULER_R_LSB_ADDR = 0X1C(28),
    BNO055_EULER_R_MSB_ADDR = 0X1D(29),
    BNO055_EULER_P_LSB_ADDR = 0X1E(30),
    BNO055_EULER_P_MSB_ADDR = 0X1F(31),
```
```
    /* 1 degree = 16 LSB */
    xyz[0] = ((double)x) / 16.0;
    xyz[1] = ((double)y) / 16.0;
    xyz[2] = ((double)z) / 16.0;
```
## angVelocityData(0X14:20)
```
    VECTOR_GYROSCOPE = BNO055_GYRO_DATA_X_LSB_ADDR,
    /* Gyro data registers */
    BNO055_GYRO_DATA_X_LSB_ADDR = 0X14(20),
    BNO055_GYRO_DATA_X_MSB_ADDR = 0X15(21),
    BNO055_GYRO_DATA_Y_LSB_ADDR = 0X16(22),
    BNO055_GYRO_DATA_Y_MSB_ADDR = 0X17(23),
    BNO055_GYRO_DATA_Z_LSB_ADDR = 0X18(24),
    BNO055_GYRO_DATA_Z_MSB_ADDR = 0X19(25),
```
```
    /* 1dps = 16 LSB */
    xyz[0] = ((double)x) / 16.0;
    xyz[1] = ((double)y) / 16.0;
    xyz[2] = ((double)z) / 16.0;
```
## linearAccelData(0X28:40)
```
    VECTOR_LINEARACCEL = BNO055_LINEAR_ACCEL_DATA_X_LSB_ADDR,
    /* Linear acceleration data registers */
    BNO055_LINEAR_ACCEL_DATA_X_LSB_ADDR = 0X28(40),
    BNO055_LINEAR_ACCEL_DATA_X_MSB_ADDR = 0X29(41),
    BNO055_LINEAR_ACCEL_DATA_Y_LSB_ADDR = 0X2A(42),
    BNO055_LINEAR_ACCEL_DATA_Y_MSB_ADDR = 0X2B(43),
    BNO055_LINEAR_ACCEL_DATA_Z_LSB_ADDR = 0X2C(44),
    BNO055_LINEAR_ACCEL_DATA_Z_MSB_ADDR = 0X2D(45),
```
```
    /* 1m/s^2 = 100 LSB */
    xyz[0] = ((double)x) / 100.0;
    xyz[1] = ((double)y) / 100.0;
    xyz[2] = ((double)z) / 100.0;
```
## magnetometerData(0X0E:14)
```
    VECTOR_MAGNETOMETER = BNO055_MAG_DATA_X_LSB_ADDR,
    /* Mag data register */
    BNO055_MAG_DATA_X_LSB_ADDR = 0X0E(14),
    BNO055_MAG_DATA_X_MSB_ADDR = 0X0F(15),
    BNO055_MAG_DATA_Y_LSB_ADDR = 0X10(16),
    BNO055_MAG_DATA_Y_MSB_ADDR = 0X11(17),
    BNO055_MAG_DATA_Z_LSB_ADDR = 0X12(18),
    BNO055_MAG_DATA_Z_MSB_ADDR = 0X13(19),
```
```
    /* 1uT = 16 LSB */
    xyz[0] = ((double)x) / 16.0;
    xyz[1] = ((double)y) / 16.0;
    xyz[2] = ((double)z) / 16.0;
```
## accelerometerData(0X08:08)
```
    VECTOR_ACCELEROMETER = BNO055_ACCEL_DATA_X_LSB_ADDR,
    /* Accel data register */
    BNO055_ACCEL_DATA_X_LSB_ADDR = 0X08(08),
    BNO055_ACCEL_DATA_X_MSB_ADDR = 0X09(09),
    BNO055_ACCEL_DATA_Y_LSB_ADDR = 0X0A(10),
    BNO055_ACCEL_DATA_Y_MSB_ADDR = 0X0B(11),
    BNO055_ACCEL_DATA_Z_LSB_ADDR = 0X0C(12),
    BNO055_ACCEL_DATA_Z_MSB_ADDR = 0X0D(13),
```
```
    /* 1m/s^2 = 100 LSB */
    xyz[0] = ((double)x) / 100.0;
    xyz[1] = ((double)y) / 100.0;
    xyz[2] = ((double)z) / 100.0;
```
## gravityData(0X2E:46)
```
    VECTOR_GRAVITY = BNO055_GRAVITY_DATA_X_LSB_ADDR
    /* Gravity data registers */
    BNO055_GRAVITY_DATA_X_LSB_ADDR = 0X2E(46),
    BNO055_GRAVITY_DATA_X_MSB_ADDR = 0X2F(47),
    BNO055_GRAVITY_DATA_Y_LSB_ADDR = 0X30(48),
    BNO055_GRAVITY_DATA_Y_MSB_ADDR = 0X31(49),
    BNO055_GRAVITY_DATA_Z_LSB_ADDR = 0X32(50),
    BNO055_GRAVITY_DATA_Z_MSB_ADDR = 0X33(51),
```
```
    /* 1m/s^2 = 100 LSB */
    xyz[0] = ((double)x) / 100.0;
    xyz[1] = ((double)y) / 100.0;
    xyz[2] = ((double)z) / 100.0;
```
## 未使用(保留)
```
    /* Quaternion data registers */    BNO055_QUATERNION_DATA_W_LSB_ADDR = 0X20,
    BNO055_QUATERNION_DATA_W_MSB_ADDR = 0X21,
    BNO055_QUATERNION_DATA_X_LSB_ADDR = 0X22,
    BNO055_QUATERNION_DATA_X_MSB_ADDR = 0X23,
    BNO055_QUATERNION_DATA_Y_LSB_ADDR = 0X24,
    BNO055_QUATERNION_DATA_Y_MSB_ADDR = 0X25,
    BNO055_QUATERNION_DATA_Z_LSB_ADDR = 0X26,
    BNO055_QUATERNION_DATA_Z_MSB_ADDR = 0X27,
```

# フロー
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/97061/c5045d74-ea96-74b2-441e-1766a6cbf39c.png)


```
[
    {
        "id": "38ae423eee7f1136",
        "type": "tab",
        "label": "BNO055",
        "disabled": false,
        "info": "",
        "env": [],
        "_mcu": {
            "mcu": true
        }
    },
    {
        "id": "652addc0c5307be8",
        "type": "inject",
        "z": "38ae423eee7f1136",
        "name": "",
        "props": [
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": true,
        "onceDelay": "0.1",
        "topic": "",
        "_mcu": {
            "mcu": true
        },
        "x": 90,
        "y": 100,
        "wires": [
            [
                "be6e4d4742b263a7"
            ]
        ]
    },
    {
        "id": "d6599073c13aa157",
        "type": "comment",
        "z": "38ae423eee7f1136",
        "name": "Initialize",
        "info": "",
        "_mcu": {
            "mcu": true
        },
        "x": 70,
        "y": 40,
        "wires": []
    },
    {
        "id": "cbca276a5a26f4fd",
        "type": "debug",
        "z": "38ae423eee7f1136",
        "name": "Not Found",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "_mcu": {
            "mcu": true
        },
        "x": 610,
        "y": 80,
        "wires": []
    },
    {
        "id": "ce19c3c52e12d654",
        "type": "switch",
        "z": "38ae423eee7f1136",
        "name": "",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "neq",
                "v": "160",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "160",
                "vt": "num"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "_mcu": {
            "mcu": true
        },
        "x": 430,
        "y": 100,
        "wires": [
            [
                "cbca276a5a26f4fd"
            ],
            [
                "0c460a385ab03209",
                "1599c89dafcfe0c0"
            ]
        ]
    },
    {
        "id": "0c460a385ab03209",
        "type": "debug",
        "z": "38ae423eee7f1136",
        "name": "Found",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "_mcu": {
            "mcu": true
        },
        "x": 590,
        "y": 120,
        "wires": []
    },
    {
        "id": "37981dd64e75c6e6",
        "type": "delay",
        "z": "38ae423eee7f1136",
        "name": "",
        "pauseType": "delay",
        "timeout": "650",
        "timeoutUnits": "milliseconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "_mcu": {
            "mcu": true
        },
        "x": 630,
        "y": 240,
        "wires": [
            [
                "abc420a10f70ec04"
            ]
        ]
    },
    {
        "id": "1232a072885e5227",
        "type": "delay",
        "z": "38ae423eee7f1136",
        "name": "",
        "pauseType": "delay",
        "timeout": "10",
        "timeoutUnits": "milliseconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "_mcu": {
            "mcu": true
        },
        "x": 450,
        "y": 360,
        "wires": [
            [
                "783d707f7c1920e0"
            ]
        ]
    },
    {
        "id": "c68922330662da2b",
        "type": "delay",
        "z": "38ae423eee7f1136",
        "name": "",
        "pauseType": "delay",
        "timeout": "10",
        "timeoutUnits": "milliseconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "_mcu": {
            "mcu": true
        },
        "x": 550,
        "y": 500,
        "wires": [
            [
                "9923e227636827b5"
            ]
        ]
    },
    {
        "id": "4d169417dde33296",
        "type": "comment",
        "z": "38ae423eee7f1136",
        "name": "GetTemp",
        "info": "",
        "_mcu": {
            "mcu": true
        },
        "x": 100,
        "y": 760,
        "wires": []
    },
    {
        "id": "12d2b6b4edb55e9d",
        "type": "inject",
        "z": "38ae423eee7f1136",
        "name": "",
        "props": [],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": "2",
        "topic": "",
        "_mcu": {
            "mcu": true
        },
        "x": 130,
        "y": 800,
        "wires": [
            [
                "09b8caa870bf862f"
            ]
        ]
    },
    {
        "id": "a5306f8b07808051",
        "type": "debug",
        "z": "38ae423eee7f1136",
        "name": "debug 1",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "_mcu": {
            "mcu": true
        },
        "x": 420,
        "y": 800,
        "wires": []
    },
    {
        "id": "2097f2fdda368085",
        "type": "comment",
        "z": "38ae423eee7f1136",
        "name": "GetMode",
        "info": "",
        "_mcu": {
            "mcu": true
        },
        "x": 100,
        "y": 660,
        "wires": []
    },
    {
        "id": "d58259d29075b520",
        "type": "inject",
        "z": "38ae423eee7f1136",
        "name": "",
        "props": [],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "_mcu": {
            "mcu": true
        },
        "x": 130,
        "y": 700,
        "wires": [
            [
                "45f2fc2ea95f353b"
            ]
        ]
    },
    {
        "id": "0396e67fcf522ede",
        "type": "debug",
        "z": "38ae423eee7f1136",
        "name": "debug 2",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "_mcu": {
            "mcu": true
        },
        "x": 420,
        "y": 700,
        "wires": []
    },
    {
        "id": "6d5e2de480db881a",
        "type": "debug",
        "z": "38ae423eee7f1136",
        "name": "debug 3",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "_mcu": {
            "mcu": true
        },
        "x": 500,
        "y": 600,
        "wires": []
    },
    {
        "id": "56de770b8d4a2265",
        "type": "comment",
        "z": "38ae423eee7f1136",
        "name": "GetOrientationData",
        "info": "&orientationData, Adafruit_BNO055::VECTOR_EULER",
        "_mcu": {
            "mcu": true
        },
        "x": 130,
        "y": 1040,
        "wires": []
    },
    {
        "id": "179f716c476ec73f",
        "type": "comment",
        "z": "38ae423eee7f1136",
        "name": "GetAngVelocityData",
        "info": "&angVelocityData, Adafruit_BNO055::VECTOR_GYROSCOPE",
        "_mcu": {
            "mcu": true
        },
        "x": 130,
        "y": 1160,
        "wires": []
    },
    {
        "id": "f86e924c95f2d714",
        "type": "comment",
        "z": "38ae423eee7f1136",
        "name": "GetLinearAccelData",
        "info": "&linearAccelData, Adafruit_BNO055::VECTOR_LINEARACCEL",
        "_mcu": {
            "mcu": true
        },
        "x": 130,
        "y": 1280,
        "wires": []
    },
    {
        "id": "789308cd7398b7a9",
        "type": "comment",
        "z": "38ae423eee7f1136",
        "name": "GetMagnetometerData",
        "info": "&magnetometerData, Adafruit_BNO055::VECTOR_MAGNETOMETER",
        "_mcu": {
            "mcu": true
        },
        "x": 140,
        "y": 1400,
        "wires": []
    },
    {
        "id": "6d412de964cdf1ad",
        "type": "comment",
        "z": "38ae423eee7f1136",
        "name": "GetAccelerometerData",
        "info": "&accelerometerData, Adafruit_BNO055::VECTOR_ACCELEROMETER",
        "_mcu": {
            "mcu": true
        },
        "x": 140,
        "y": 1520,
        "wires": []
    },
    {
        "id": "889c49a06e67f72f",
        "type": "comment",
        "z": "38ae423eee7f1136",
        "name": "GetGravityData",
        "info": "&gravityData, Adafruit_BNO055::VECTOR_GRAVITY",
        "_mcu": {
            "mcu": true
        },
        "x": 120,
        "y": 1680,
        "wires": []
    },
    {
        "id": "6fc34c30eb5cf02e",
        "type": "comment",
        "z": "38ae423eee7f1136",
        "name": "GetCaliburationData",
        "info": "",
        "_mcu": {
            "mcu": true
        },
        "x": 130,
        "y": 920,
        "wires": []
    },
    {
        "id": "c046b8825c64cb96",
        "type": "inject",
        "z": "38ae423eee7f1136",
        "name": "",
        "props": [],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "_mcu": {
            "mcu": true
        },
        "x": 130,
        "y": 960,
        "wires": [
            [
                "287f82bdc2052e37"
            ]
        ]
    },
    {
        "id": "6af7c737cf7c0297",
        "type": "function",
        "z": "38ae423eee7f1136",
        "name": "CalcCalibration",
        "func": "let val=msg.payload;\n//  uint8_t calData = read8(BNO055_CALIB_STAT_ADDR);\n//if (sys != NULL) {\n//    * sys = (calData >> 6) & 0x03;\nconst sys = (val>>6) & 3;\n//}\n//if (gyro != NULL) {\n//    * gyro = (calData >> 4) & 0x03;\n//}\nconst gyro = (val>>4) & 3;\n//if (accel != NULL) {\n//    * accel = (calData >> 2) & 0x03;\n//}\nconst accel = (val>>2) & 3;\n//if (mag != NULL) {\n//    * mag = calData & 0x03;\n//}\nconst mag = val & 3;\nmsg.payload.sys = sys;\nmsg.payload.gyro = gyro;\nmsg.payload.accel = accel;\nmsg.payload.mag = mag;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "_mcu": {
            "mcu": true
        },
        "x": 480,
        "y": 960,
        "wires": [
            [
                "7fc606c07cba9abc"
            ]
        ]
    },
    {
        "id": "7fc606c07cba9abc",
        "type": "debug",
        "z": "38ae423eee7f1136",
        "name": "debugCaliburattion",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "_mcu": {
            "mcu": true
        },
        "x": 670,
        "y": 960,
        "wires": []
    },
    {
        "id": "42afd006c22aa25d",
        "type": "inject",
        "z": "38ae423eee7f1136",
        "name": "",
        "props": [],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": "2",
        "topic": "",
        "_mcu": {
            "mcu": true
        },
        "x": 130,
        "y": 1080,
        "wires": [
            [
                "7d6edcbab0d03dca"
            ]
        ]
    },
    {
        "id": "22aa0364a3f8c478",
        "type": "function",
        "z": "38ae423eee7f1136",
        "name": "CalcOrientationData",
        "func": "let c1 = new ArrayBuffer(2), x_ui = new Uint16Array(c1), x_i = new Int16Array(c1);\nlet c2 = new ArrayBuffer(2), y_ui = new Uint16Array(c2), y_i = new Int16Array(c2);\nlet c3 = new ArrayBuffer(2), z_ui = new Uint16Array(c3), z_i = new Int16Array(c3);\nx_i[0] = msg.payload[0] + msg.payload[1] * 0x100;\ny_i[0] = msg.payload[2] + msg.payload[3] * 0x100;\nz_i[0] = msg.payload[4] + msg.payload[5] * 0x100;\nlet msg2;\nmsg2 = { payload: { x: x_i[0] / 16.0, y: y_i[0] / 16.0, z: z_i[0] / 16.0 } };\nreturn msg2;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "_mcu": {
            "mcu": true
        },
        "x": 500,
        "y": 1080,
        "wires": [
            [
                "c82e1648ced64194"
            ]
        ]
    },
    {
        "id": "c82e1648ced64194",
        "type": "debug",
        "z": "38ae423eee7f1136",
        "name": "debugOrientationData",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "_mcu": {
            "mcu": true
        },
        "x": 760,
        "y": 1080,
        "wires": []
    },
    {
        "id": "aa3b4fe55518f45c",
        "type": "inject",
        "z": "38ae423eee7f1136",
        "name": "",
        "props": [],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": "2",
        "topic": "",
        "_mcu": {
            "mcu": true
        },
        "x": 130,
        "y": 1320,
        "wires": [
            [
                "91f532f86ff44a7d"
            ]
        ]
    },
    {
        "id": "521cac2f163b6312",
        "type": "function",
        "z": "38ae423eee7f1136",
        "name": "CalcLinearAccelData",
        "func": "let c1 = new ArrayBuffer(2), x_ui = new Uint16Array(c1), x_i = new Int16Array(c1);\nlet c2 = new ArrayBuffer(2), y_ui = new Uint16Array(c2), y_i = new Int16Array(c2);\nlet c3 = new ArrayBuffer(2), z_ui = new Uint16Array(c3), z_i = new Int16Array(c3);\nx_i[0] = msg.payload[0] + msg.payload[1] * 0x100;\ny_i[0] = msg.payload[2] + msg.payload[3] * 0x100;\nz_i[0] = msg.payload[4] + msg.payload[5] * 0x100;\nlet msg2;\nmsg2 = { payload: { x: x_i[0] / 100.0, y: y_i[0] / 100.0, z: z_i[0] / 100.0 } };\nreturn msg2;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "_mcu": {
            "mcu": true
        },
        "x": 520,
        "y": 1320,
        "wires": [
            [
                "3fc175c4506b12bd"
            ]
        ]
    },
    {
        "id": "3fc175c4506b12bd",
        "type": "debug",
        "z": "38ae423eee7f1136",
        "name": "debugLinearAccelData",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "_mcu": {
            "mcu": true
        },
        "x": 770,
        "y": 1320,
        "wires": []
    },
    {
        "id": "2cfadafd7cfd73fc",
        "type": "inject",
        "z": "38ae423eee7f1136",
        "name": "",
        "props": [],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": "2",
        "topic": "",
        "_mcu": {
            "mcu": true
        },
        "x": 130,
        "y": 1560,
        "wires": [
            [
                "935fb772208c36d1"
            ]
        ]
    },
    {
        "id": "0542be9dae744543",
        "type": "function",
        "z": "38ae423eee7f1136",
        "name": "CalcAccelerometerData",
        "func": "let c1 = new ArrayBuffer(2), x_ui = new Uint16Array(c1), x_i = new Int16Array(c1);\nlet c2 = new ArrayBuffer(2), y_ui = new Uint16Array(c2), y_i = new Int16Array(c2);\nlet c3 = new ArrayBuffer(2), z_ui = new Uint16Array(c3), z_i = new Int16Array(c3);\nx_i[0] = msg.payload[0] + msg.payload[1] * 0x100;\ny_i[0] = msg.payload[2] + msg.payload[3] * 0x100;\nz_i[0] = msg.payload[4] + msg.payload[5] * 0x100;\nlet msg2;\nmsg2 = { payload: { x: x_i[0] / 100.0, y: y_i[0] / 100.0, z: z_i[0] / 100.0}};\nreturn msg2;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "_mcu": {
            "mcu": true
        },
        "x": 550,
        "y": 1560,
        "wires": [
            [
                "b1d921ad6246d5f7"
            ]
        ]
    },
    {
        "id": "b1d921ad6246d5f7",
        "type": "debug",
        "z": "38ae423eee7f1136",
        "name": "debugAccelerometerData",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "_mcu": {
            "mcu": true
        },
        "x": 790,
        "y": 1560,
        "wires": []
    },
    {
        "id": "91b9994829987545",
        "type": "inject",
        "z": "38ae423eee7f1136",
        "name": "",
        "props": [],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": "2",
        "topic": "",
        "_mcu": {
            "mcu": true
        },
        "x": 130,
        "y": 1720,
        "wires": [
            [
                "79e850af2b58f771"
            ]
        ]
    },
    {
        "id": "0a293fa7be3fce78",
        "type": "function",
        "z": "38ae423eee7f1136",
        "name": "CalcGravityData",
        "func": "let c1 = new ArrayBuffer(2), x_ui = new Uint16Array(c1), x_i = new Int16Array(c1);\nlet c2 = new ArrayBuffer(2), y_ui = new Uint16Array(c2), y_i = new Int16Array(c2);\nlet c3 = new ArrayBuffer(2), z_ui = new Uint16Array(c3), z_i = new Int16Array(c3);\nx_i[0] = msg.payload[0] + msg.payload[1] * 0x100;\ny_i[0] = msg.payload[2] + msg.payload[3] * 0x100;\nz_i[0] = msg.payload[4] + msg.payload[5] * 0x100;\nlet msg2;\nmsg2 = { payload: { x: x_i[0] / 100.0, y: y_i[0] / 100.0, z: z_i[0] / 100.0}};\nreturn msg2;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "_mcu": {
            "mcu": true
        },
        "x": 520,
        "y": 1720,
        "wires": [
            [
                "27bebff5e50f7a26"
            ]
        ]
    },
    {
        "id": "27bebff5e50f7a26",
        "type": "debug",
        "z": "38ae423eee7f1136",
        "name": "debugGravityData",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "_mcu": {
            "mcu": true
        },
        "x": 770,
        "y": 1720,
        "wires": []
    },
    {
        "id": "2d9de493d1284c36",
        "type": "inject",
        "z": "38ae423eee7f1136",
        "name": "",
        "props": [],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": "2",
        "topic": "",
        "_mcu": {
            "mcu": true
        },
        "x": 130,
        "y": 1440,
        "wires": [
            [
                "bd975c8350ca91f1"
            ]
        ]
    },
    {
        "id": "1096aa141ac7e0d2",
        "type": "function",
        "z": "38ae423eee7f1136",
        "name": "CalcMagnetometerData",
        "func": "let c1 = new ArrayBuffer(2), x_ui = new Uint16Array(c1), x_i = new Int16Array(c1);\nlet c2 = new ArrayBuffer(2), y_ui = new Uint16Array(c2), y_i = new Int16Array(c2);\nlet c3 = new ArrayBuffer(2), z_ui = new Uint16Array(c3), z_i = new Int16Array(c3);\nx_i[0] = msg.payload[0] + msg.payload[1] * 0x100;\ny_i[0] = msg.payload[2] + msg.payload[3] * 0x100;\nz_i[0] = msg.payload[4] + msg.payload[5] * 0x100;\nlet msg2;\nmsg2 = { payload: { x: x_i[0] / 16.0, y: y_i[0] / 16.0, z: z_i[0] / 16.0}};\nreturn msg2;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "_mcu": {
            "mcu": true
        },
        "x": 550,
        "y": 1440,
        "wires": [
            [
                "8dc8abc588c20649"
            ]
        ]
    },
    {
        "id": "8dc8abc588c20649",
        "type": "debug",
        "z": "38ae423eee7f1136",
        "name": "debugAccelerometerData",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "_mcu": {
            "mcu": true
        },
        "x": 835,
        "y": 1439,
        "wires": []
    },
    {
        "id": "f8e0462b69699282",
        "type": "inject",
        "z": "38ae423eee7f1136",
        "name": "",
        "props": [],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": "2",
        "topic": "",
        "_mcu": {
            "mcu": true
        },
        "x": 130,
        "y": 1200,
        "wires": [
            [
                "e99de7b3c5068eb4"
            ]
        ]
    },
    {
        "id": "54f171af68f831e3",
        "type": "function",
        "z": "38ae423eee7f1136",
        "name": "CalcAngVelocityData",
        "func": "let c1 = new ArrayBuffer(2), x_ui = new Uint16Array(c1), x_i = new Int16Array(c1);\nlet c2 = new ArrayBuffer(2), y_ui = new Uint16Array(c2), y_i = new Int16Array(c2);\nlet c3 = new ArrayBuffer(2), z_ui = new Uint16Array(c3), z_i = new Int16Array(c3);\nx_i[0] = msg.payload[0] + msg.payload[1] * 0x100;\ny_i[0] = msg.payload[2] + msg.payload[3] * 0x100;\nz_i[0] = msg.payload[4] + msg.payload[5] * 0x100;\nlet msg2;\nmsg2 = { payload: { x: x_i[0] / 16.0, y: y_i[0] / 16.0, z: z_i[0] / 16.0}};\nreturn msg2;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "_mcu": {
            "mcu": true
        },
        "x": 540,
        "y": 1200,
        "wires": [
            [
                "403b462f8cf7723e"
            ]
        ]
    },
    {
        "id": "403b462f8cf7723e",
        "type": "debug",
        "z": "38ae423eee7f1136",
        "name": "debugAngVelocityData",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "_mcu": {
            "mcu": true
        },
        "x": 780,
        "y": 1200,
        "wires": []
    },
    {
        "id": "be6e4d4742b263a7",
        "type": "mcu_i2c_in",
        "z": "38ae423eee7f1136",
        "name": "Chip ID Read",
        "options": {
            "bus": "default",
            "hz": "100000",
            "address": "0x28"
        },
        "command": "0",
        "bytes": 1,
        "moddable_manifest": {
            "include": "$(NODEREDMCU)/nodes/mcu/i2c/manifest.json"
        },
        "_mcu": {
            "mcu": true
        },
        "x": 260,
        "y": 100,
        "wires": [
            [
                "ce19c3c52e12d654"
            ]
        ]
    },
    {
        "id": "1599c89dafcfe0c0",
        "type": "mcu_i2c_out",
        "z": "38ae423eee7f1136",
        "name": "OperationModeConfig",
        "options": {
            "bus": "default",
            "hz": "100000",
            "address": "0x28"
        },
        "command": "61,0",
        "bytes": 1,
        "payload": "payload",
        "payloadType": "msg",
        "moddable_manifest": {
            "include": "$(NODEREDMCU)/nodes/mcu/i2c/manifest.json"
        },
        "_mcu": {
            "mcu": true
        },
        "x": 280,
        "y": 240,
        "wires": [
            [
                "975f355fb1e83a0c"
            ]
        ]
    },
    {
        "id": "abc420a10f70ec04",
        "type": "mcu_i2c_out",
        "z": "38ae423eee7f1136",
        "name": "PowerModeNomal",
        "options": {
            "bus": "default",
            "hz": "50000",
            "address": "0x28"
        },
        "command": "62,0",
        "bytes": 1,
        "payload": "payload",
        "payloadType": "msg",
        "moddable_manifest": {
            "include": "$(NODEREDMCU)/nodes/mcu/i2c/manifest.json"
        },
        "_mcu": {
            "mcu": true
        },
        "x": 270,
        "y": 360,
        "wires": [
            [
                "1232a072885e5227"
            ]
        ]
    },
    {
        "id": "975f355fb1e83a0c",
        "type": "mcu_i2c_out",
        "z": "38ae423eee7f1136",
        "name": "Reset",
        "options": {
            "bus": "default",
            "hz": "100000",
            "address": "0x28"
        },
        "command": "63,32",
        "bytes": 1,
        "payload": "payload",
        "payloadType": "msg",
        "moddable_manifest": {
            "include": "$(NODEREDMCU)/nodes/mcu/i2c/manifest.json"
        },
        "_mcu": {
            "mcu": true
        },
        "x": 470,
        "y": 240,
        "wires": [
            [
                "37981dd64e75c6e6"
            ]
        ]
    },
    {
        "id": "9923e227636827b5",
        "type": "mcu_i2c_out",
        "z": "38ae423eee7f1136",
        "name": "OperationModeNDOF",
        "options": {
            "bus": "default",
            "hz": "100000",
            "address": "0x28"
        },
        "command": "61,12",
        "bytes": 1,
        "payload": "payload",
        "payloadType": "msg",
        "moddable_manifest": {
            "include": "$(NODEREDMCU)/nodes/mcu/i2c/manifest.json"
        },
        "_mcu": {
            "mcu": true
        },
        "x": 300,
        "y": 600,
        "wires": [
            [
                "6d5e2de480db881a"
            ]
        ]
    },
    {
        "id": "783d707f7c1920e0",
        "type": "mcu_i2c_out",
        "z": "38ae423eee7f1136",
        "name": "PageID:0",
        "options": {
            "bus": "default",
            "hz": "100000",
            "address": "0x28"
        },
        "command": "7,0",
        "bytes": 1,
        "payload": "payload",
        "payloadType": "msg",
        "moddable_manifest": {
            "include": "$(NODEREDMCU)/nodes/mcu/i2c/manifest.json"
        },
        "_mcu": {
            "mcu": true
        },
        "x": 240,
        "y": 500,
        "wires": [
            [
                "f46dbc4772fac354"
            ]
        ]
    },
    {
        "id": "f46dbc4772fac354",
        "type": "mcu_i2c_out",
        "z": "38ae423eee7f1136",
        "name": "SysTrigge:0",
        "options": {
            "bus": "default",
            "hz": "100000",
            "address": "0x28"
        },
        "command": "63,0",
        "bytes": 1,
        "payload": "payload",
        "payloadType": "msg",
        "moddable_manifest": {
            "include": "$(NODEREDMCU)/nodes/mcu/i2c/manifest.json"
        },
        "_mcu": {
            "mcu": true
        },
        "x": 390,
        "y": 500,
        "wires": [
            [
                "c68922330662da2b"
            ]
        ]
    },
    {
        "id": "45f2fc2ea95f353b",
        "type": "mcu_i2c_in",
        "z": "38ae423eee7f1136",
        "name": "ReadMode",
        "options": {
            "bus": "default",
            "hz": "100000",
            "address": "0x28"
        },
        "command": "61",
        "bytes": 1,
        "moddable_manifest": {
            "include": "$(NODEREDMCU)/nodes/mcu/i2c/manifest.json"
        },
        "_mcu": {
            "mcu": true
        },
        "x": 270,
        "y": 700,
        "wires": [
            [
                "0396e67fcf522ede"
            ]
        ]
    },
    {
        "id": "09b8caa870bf862f",
        "type": "mcu_i2c_in",
        "z": "38ae423eee7f1136",
        "name": "ReadTemp",
        "options": {
            "bus": "default",
            "hz": "100000",
            "address": "0x28"
        },
        "command": "52",
        "bytes": 1,
        "moddable_manifest": {
            "include": "$(NODEREDMCU)/nodes/mcu/i2c/manifest.json"
        },
        "_mcu": {
            "mcu": true
        },
        "x": 270,
        "y": 800,
        "wires": [
            [
                "a5306f8b07808051"
            ]
        ]
    },
    {
        "id": "287f82bdc2052e37",
        "type": "mcu_i2c_in",
        "z": "38ae423eee7f1136",
        "name": "GetCalibrationData",
        "options": {
            "bus": "default",
            "hz": "100000",
            "address": "0x28"
        },
        "command": "53",
        "bytes": 1,
        "moddable_manifest": {
            "include": "$(NODEREDMCU)/nodes/mcu/i2c/manifest.json"
        },
        "_mcu": {
            "mcu": true
        },
        "x": 290,
        "y": 960,
        "wires": [
            [
                "6af7c737cf7c0297"
            ]
        ]
    },
    {
        "id": "7d6edcbab0d03dca",
        "type": "mcu_i2c_in",
        "z": "38ae423eee7f1136",
        "name": "GetOrientationData",
        "options": {
            "bus": "default",
            "hz": "100000",
            "address": "0x28"
        },
        "command": "26",
        "bytes": "6",
        "moddable_manifest": {
            "include": "$(NODEREDMCU)/nodes/mcu/i2c/manifest.json"
        },
        "_mcu": {
            "mcu": true
        },
        "x": 290,
        "y": 1080,
        "wires": [
            [
                "22aa0364a3f8c478"
            ]
        ]
    },
    {
        "id": "e99de7b3c5068eb4",
        "type": "mcu_i2c_in",
        "z": "38ae423eee7f1136",
        "name": "GetAngVelocityData",
        "options": {
            "bus": "default",
            "hz": "100000",
            "address": "0x28"
        },
        "command": "20",
        "bytes": "6",
        "moddable_manifest": {
            "include": "$(NODEREDMCU)/nodes/mcu/i2c/manifest.json"
        },
        "_mcu": {
            "mcu": true
        },
        "x": 320,
        "y": 1200,
        "wires": [
            [
                "54f171af68f831e3"
            ]
        ]
    },
    {
        "id": "935fb772208c36d1",
        "type": "mcu_i2c_in",
        "z": "38ae423eee7f1136",
        "name": "GetAccelerometerData",
        "options": {
            "bus": "default",
            "hz": "100000",
            "address": "0x28"
        },
        "command": "8",
        "bytes": "6",
        "moddable_manifest": {
            "include": "$(NODEREDMCU)/nodes/mcu/i2c/manifest.json"
        },
        "_mcu": {
            "mcu": true
        },
        "x": 300,
        "y": 1560,
        "wires": [
            [
                "0542be9dae744543"
            ]
        ]
    },
    {
        "id": "91f532f86ff44a7d",
        "type": "mcu_i2c_in",
        "z": "38ae423eee7f1136",
        "name": "GetLinearAccelData",
        "options": {
            "bus": "default",
            "hz": "100000",
            "address": "0x28"
        },
        "command": "40",
        "bytes": "6",
        "moddable_manifest": {
            "include": "$(NODEREDMCU)/nodes/mcu/i2c/manifest.json"
        },
        "_mcu": {
            "mcu": true
        },
        "x": 300,
        "y": 1320,
        "wires": [
            [
                "521cac2f163b6312"
            ]
        ]
    },
    {
        "id": "bd975c8350ca91f1",
        "type": "mcu_i2c_in",
        "z": "38ae423eee7f1136",
        "name": "GetMagnetometerData",
        "options": {
            "bus": "default",
            "hz": "100000",
            "address": "0x28"
        },
        "command": "14",
        "bytes": "6",
        "moddable_manifest": {
            "include": "$(NODEREDMCU)/nodes/mcu/i2c/manifest.json"
        },
        "_mcu": {
            "mcu": true
        },
        "x": 300,
        "y": 1440,
        "wires": [
            [
                "1096aa141ac7e0d2"
            ]
        ]
    },
    {
        "id": "79e850af2b58f771",
        "type": "mcu_i2c_in",
        "z": "38ae423eee7f1136",
        "name": "GetGravityData",
        "options": {
            "bus": "default",
            "hz": "100000",
            "address": "0x28"
        },
        "command": "46",
        "bytes": "6",
        "moddable_manifest": {
            "include": "$(NODEREDMCU)/nodes/mcu/i2c/manifest.json"
        },
        "_mcu": {
            "mcu": true
        },
        "x": 300,
        "y": 1720,
        "wires": [
            [
                "0a293fa7be3fce78"
            ]
        ]
    }
]
```