Particle-IO Now Supports I2C

With an updated VoodooSpark and the latest Particle-IO adapter, Particle Photons and Cores can now interface with I2C devices via Johnny-Five.

This means that any existing I2C device can be hooked up to your Particle device and used just like any other I2C device. Here is an example of using the Particle Photon with an MPU6050 Accelerometer.

Photon + MPU6050

var five = require("johnny-five");
var Particle = require("particle-io");
var board = new five.Board({
  io: new Particle({
    token: process.env.PARTICLE_TOKEN,
    deviceId: process.env.PARTICLE_DEVICE_ID
  }) 
});

board.on("ready", function() {
  var accelerometer = new five.Accelerometer({
    controller: "MPU6050"
  });

  accelerometer.on("change", function() {
    console.log("accelerometer");
    console.log("  x            : ", this.x);
    console.log("  y            : ", this.y);
    console.log("  z            : ", this.z);
    console.log("  pitch        : ", this.pitch);
    console.log("  roll         : ", this.roll);
    console.log("  acceleration : ", this.acceleration);
    console.log("  inclination  : ", this.inclination);
    console.log("  orientation  : ", this.orientation);
    console.log("--------------------------------------");
  });
});

The beauty of the Johnny-Five abstraction allows us to do some things that you may not consider. For example, pair the SparkFun Photon Redboard with the EVShield, and you have a JavaScript enabled, wireless controller for your Lego creations. Or, connect your Photon to the SparkFun Weather Shield and wirelessly automate your home.

Examples of the components that are now supported on the Particle devices in Johnny-Five include (but is not limited to):

Please report any issues here.




Brian Genisio on October 8th 2015

Hi! The Johnny-Five community is building new projects every day. We made this newsletter to tell you about what's new, what's good, and what's next for Open Source robotics. Join us in exploring what we can make together.

Fork me on GitHub