Skip to content
This repository was archived by the owner on Jan 3, 2023. It is now read-only.

Firmata wrapper for the CurieIMU library on the Arduino101. This enables the CurieIMU functionality to be used over Firmata

License

Notifications You must be signed in to change notification settings

intel-iot-devkit/firmata-curie-imu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DISCONTINUATION OF PROJECT

This project will no longer be maintained by Intel. Intel has ceased development and contributions including, but not limited to, maintenance, bug fixes, new releases, or updates, to this project. Intel no longer accepts patches to this project.

FirmataCurieIMU

Firmata wrapper for the CurieIMU library on the Arduino101

Installation

  1. Make sure you have the following dependencies installed in the libraries folder for your Arduino installation:
  1. Clone or download and copy FirmataCurieIMU into the libraries folder for your Arduino installation:

How to use

The simplest possible example that connects the CurieIMU devices, but nothing else within the Firmata interface, would be as follows:

#include <ConfigurableFirmata.h>
#include <FirmataExt.h>
FirmataExt firmataExt;

#include <CurieIMU.h>
#include <FirmataCurieIMU.h>
FirmataCurieIMU curieIMU;

void systemResetCallback()
{
  firmataExt.reset();
}

void setup()
{
  Firmata.setFirmwareVersion(FIRMATA_MAJOR_VERSION, FIRMATA_MINOR_VERSION);

  firmataExt.addFeature(curieIMU);

  Firmata.attach(SYSTEM_RESET, systemResetCallback);
  Firmata.begin(57600);

  // set reset to default config
  systemResetCallback();
}

void loop()
{
  while (Firmata.available()) {
    Firmata.processInput();
  }
}

As with any other sketch that uses ConfigurableFirmata, you can choose to include digital, analog, i2c, or any other interface that it supports. There are several examples of sketches that use ConfigurableFirmata along with FirmataCurieIMU in the examples directory.

Firmata clients

JavaScript

Example code that calls the FirmataCurieIMU SYSEX extended interface is here:

https://github.com/intel-iot-devkit/firmata-curie-imu.js

Protocol

Read accelerometer

Query

 /* -----------------------------------------------------
 * 0 START_SYSEX                (0xF0)
 * 1 CURIE_IMU                  (0x11)
 * 2 CURIE_IMU_READ_ACCEL       (0x00)
 * 3 END_SYSEX                  (0xF7)
 * -----------------------------------------------------
 */

Response

 /* -----------------------------------------------------
 * 0 START_SYSEX                (0xF0)
 * 1 CURIE_IMU                  (0x11)
 * 2 CURIE_IMU_READ_ACCEL       (0x00)
 * 3 x axis, bits 0-6 (LSB)
 * 4 x axis, bits 7-13 (MSB)
 * 5 y axis, bits 0-6 (LSB)
 * 6 y axis, bits 7-13 (MSB)
 * 7 z axis, bits 0-6 (LSB)
 * 8 z axis, bits 7-13 (MSB)
 * 9 END_SYSEX                  (0xF7)
 * -----------------------------------------------------
 */

Read gyro

Query

 /* -----------------------------------------------------
 * 0 START_SYSEX                (0xF0)
 * 1 CURIE_IMU                  (0x11)
 * 2 CURIE_IMU_READ_GYRO        (0x01)
 * 3 END_SYSEX                  (0xF7)
 * -----------------------------------------------------
 */

Response

 /* -----------------------------------------------------
 * 0 START_SYSEX                (0xF0)
 * 1 CURIE_IMU                  (0x11)
 * 2 CURIE_IMU_READ_GYRO        (0x01)
 * 3 x axis, bits 0-6 (LSB)
 * 4 x axis, bits 7-13 (MSB)
 * 5 y axis, bits 0-6 (LSB)
 * 6 y axis, bits 7-13 (MSB)
 * 7 z axis, bits 0-6 (LSB)
 * 8 z axis, bits 7-13 (MSB)
 * 9 END_SYSEX                  (0xF7)
 * -----------------------------------------------------
 */

Read temperature

Query

 /* -----------------------------------------------------
 * 0 START_SYSEX                (0xF0)
 * 1 CURIE_IMU                  (0x11)
 * 2 CURIE_IMU_READ_TEMP        (0x02)
 * 3 END_SYSEX                  (0xF7)
 * -----------------------------------------------------
 */

Response

 /* -----------------------------------------------------
 * 0 START_SYSEX                (0xF0)
 * 1 CURIE_IMU                  (0x11)
 * 2 CURIE_IMU_READ_TEMP        (0x02)
 * 3 int16 temperature, byte 0, bits 0-6 (LSB)
 * 4 int16 temperature, byte 0, bits 7-13 (MSB)
 * 5 int16 temperature, byte 1, bits 0-6 (LSB)
 * 6 int16 temperature, byte 1, bits 7-13 (MSB)
 * 7 END_SYSEX                  (0xF7)
 * -----------------------------------------------------
 */

Enable shock detection

Query

 /* -----------------------------------------------------
 * 0 START_SYSEX                (0xF0)
 * 1 CURIE_IMU                  (0x11)
 * 2 CURIE_IMU_SHOCK_DETECT     (0x03)
 * 3 enable/disable, bit 0
 * 4 END_SYSEX                  (0xF7)
 * -----------------------------------------------------
 */

Response

NONE

To enable shock detection, send 1 as the enable flag (byte 3). To disable shock detection, send 0 as the enable flag (byte 3).

Message

When shock detection is enabled, the following message will be sent each time that a shock is detected:

 /* -----------------------------------------------------
 * 0 START_SYSEX                (0xF0)
 * 1 CURIE_IMU                  (0x11)
 * 2 CURIE_IMU_SHOCK_DETECT     (0x03)
 * 3 axis (bits 0-3)
 * 4 direction (bit 0)
 * 5 END_SYSEX                  (0xF7)
 * -----------------------------------------------------
 */

Enable step counter

Query

 /* -----------------------------------------------------
 * 0 START_SYSEX                (0xF0)
 * 1 CURIE_IMU                  (0x11)
 * 2 CURIE_IMU_STEP_COUNTER     (0x04)
 * 3 enable/disable, bit 0
 * 4 END_SYSEX                  (0xF7)
 * -----------------------------------------------------
 */

Response

NONE

To enable step detection, send 1 as the enable flag (byte 3). To disable step detection, send 0 as the enable flag (byte 3).

Message

When step counting is enabled, the following message will be sent each time a new step is registered:

 /* -----------------------------------------------------
 * 0 START_SYSEX                (0xF0)
 * 1 CURIE_IMU                  (0x11)
 * 2 CURIE_IMU_STEP_COUNTER     (0x04)
 * 3 step count, bits 0-6 (LSB)
 * 4 step count, bits 7-13 (MSB)
 * 5 END_SYSEX                  (0xF7)
 * -----------------------------------------------------
 */

Enable tap detection

Query

 /* -----------------------------------------------------
 * 0 START_SYSEX                (0xF0)
 * 1 CURIE_IMU                  (0x11)
 * 2 CURIE_IMU_TAP_DETECT       (0x05)
 * 3 enable/disable, bit 0
 * 4 END_SYSEX                  (0xF7)
 * -----------------------------------------------------
 */

Response

NONE

To enable tap detection, send 1 as the enable flag (byte 3). To disable tap detection, send 0 as the enable flag (byte 3).

Message

When tap detection is enabled, the following message will be sent each time a tap is detected:

 /* -----------------------------------------------------
 * 0 START_SYSEX                (0xF0)
 * 1 CURIE_IMU                  (0x11)
 * 2 CURIE_IMU_TAP_DETECT       (0x05)
 * 3 axis (bits 0-3)
 * 4 direction (bit 0)
 * 5 END_SYSEX                  (0xF7)
 * -----------------------------------------------------
 */

Read motion sensor

Query

 /* -----------------------------------------------------
 * 0 START_SYSEX                (0xF0)
 * 1 CURIE_IMU                  (0x11)
 * 2 CURIE_IMU_READ_MOTION      (0x06)
 * 3 END_SYSEX                  (0xF7)
 * -----------------------------------------------------
 */

Response

 /* -----------------------------------------------------
 * 0 START_SYSEX                (0xF0)
 * 1 CURIE_IMU                  (0x11)
 * 2 CURIE_IMU_READ_MOTION      (0x06)
 * 3 x axis accelerometer, bits 0-6 (LSB)
 * 4 x axis accelerometer, bits 7-13 (MSB)
 * 5 y axis accelerometer, bits 0-6 (LSB)
 * 6 y axis accelerometer, bits 7-13 (MSB)
 * 7 z axis accelerometer, bits 0-6 (LSB)
 * 8 z axis accelerometer, bits 7-13 (MSB)
 * 9 x axis gyro, bits 0-6 (LSB)
 * 10 x axis gyro, bits 7-13 (MSB)
 * 11 y axis gyro, bits 0-6 (LSB)
 * 12 y axis gyro, bits 7-13 (MSB)
 * 13 z axis gyro, bits 0-6 (LSB)
 * 14 z axis gyro, bits 7-13 (MSB)
 * 15 END_SYSEX                  (0xF7)
 * -----------------------------------------------------
 */

About

Firmata wrapper for the CurieIMU library on the Arduino101. This enables the CurieIMU functionality to be used over Firmata

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages