Makes IoT Prototyping Fun



Makes IoT Prototyping Fun

1 2


internet-of-nodebots

What happens when the Internet, node.js, and electronics have a baby? The Internet of Nodebots

On Github mimming / internet-of-nodebots

Makes IoT Prototyping Fun

Jenny Tong

Google Cloud Platform Developer Advocate @MimmingCodes

Agenda

  • Stuff we don't need
  • A recipe for IoT hacking
  • Silly demos

No low level code

No complicated circuits

Credit: http://xkcd.com/730/

The recipe

Code + InternetDriversHardware

The recipe

Firebase Johnny-Five Raspberry Pi

Hardware: Raspberry Pi

From: adafruit.com/products/1014

Hardware: Arduino Uno

Hardware Prep: Flash Firmata

Wire stuff up

Wire stuff up

Hardware done.
Next up: Johnny Five

Johnny-Five

Install Johnny-Five
$ npm install johnny-five
Paste in some code
var five = require('johnny-five');
  
var board = new five.Board();

board.on('ready', function() {
  var led = new five.Led("13");
  led.on();
});

From https://github.com/rwaldron/johnny-five/

Johnny-Five

Add button code
var five = require('johnny-five');

var board = new five.Board();

board.on('ready', function() {
  var led = new five.Led("13");
  var button = new five.Button("8");

  button.on("up", function () {
    led.off();
  });

  button.on("down", function () {
    led.on();
  });
});

From https://github.com/rwaldron/johnny-five/

Hardware done. Driver done.
Next up:

Firebase Platform

Realtime Data
Authentication
Hosting

Firebase Realtime Database

Realtime Database

Realtime is where your bus is

https://wherebus.firebaseapp.com

Realtime is collaborative drawing

https://yaay.firebaseapp.com

Realtime game state

http://mmoasteroids.firebaseapp.com

Some JavaScript code

Write Data

var ref = new Firebase("https://io.firebaseio-demo.com/");

ref.set("Hello, Developers!");

Read Data

ref.on("value", function (snapshot) {
  var data = snapshot.val();
  console.log(data);
});

Put it all together

var five = require('johnny-five');
var Firebase = require("firebase");
var board = new five.Board();
var firebaseRef = new Firebase("https://firebutton.firebaseio-demo.com/button");

board.on("ready", function () {
  var button = new five.Button(8);
  var led = new five.Led(13);
  button.on("up", function () { firebaseRef.set(false); });
  button.on("down", function () { firebaseRef.set(true); });

  firebaseRef.on("value", function (snapshot) {
    var buttonValue = snapshot.val();
    if (buttonValue) {
      led.on();
      setTimeout(function() { led.off(); }, 2500); }
});});

Demos

Now go build cool stuff

Slides: mimming.com/presos/internet-of-nodebots Slide code: github.com/mimming/internet-of-nodebots FireButton Code: github.com/mimming/firebutton Me: @MimmingCodes