KEMBAR78
Droids, java script and web connected hardware | PDF
DROIDS, JAVASCRIPT AND WEB
CONNECTED HARDWARE
JSConf China, July 11, 2015
Andrew Fisher @ajfisher
Press'S'forfullspeakernotes.
JS ALL THE REAL THINGS
(CC)FlickrQuasimodo
HARDWARE IS BECOMING MORE LIKE SOFTWARE
(CC)PhilFarugia
TODO
Why use JS for robotics?
Introduction to the NodeBots stack
Applications and examples
1.
2.
3.
WHY USE JAVASCRIPT FOR ROBOTICS?
(CC)FlickrJohnGreenaway
JAVASCRIPT IS TOO DYNAMIC TO BE PRECISE...
REAL HARDWARE ENGINEERS USE C...
WEB APPS DESIGNED BY HARDWARE ENGINEERS
WHY USE JS AND HARDWARE?
(CC)FlickrOskay
EVENTEMITTER
Twitter:@nodebotanist
THE REAL WORLD IS ALL EVENTS
(CC)Flickrtxmx2
OBJECTS NEED STRUCTURE AND FLEXIBILITY
var motor = new Five.Motor();
motor.start();
PROTOTYPES ARE GREAT
var left_motor = new Five.motor({controller: 'I2C'});
var right_motor = new Five.motor({controller: 'PCA34567'});
left_motor.start();
right_motor.stop();
left_motor.prototype.double_speed = function() { .. };
JS <3 ROBOTICS
(CC)Flickrhiperbolica
THE NODEBOTS STACK
JOHNNY FIVE
(C)JoanneDaudier
THE STACK
Controller board (sensors and actuators)
IO Plugin (communications protocol)
Johnny Five / NodeJS (application logic)
WS/HTTP (networking and security protocols)
Clients (UI, input, visualisation)
#
#
#
#
#
COMMON IMPLEMENTATION
Controller board (Arduino)
IO Plugin (Firmata over USB)
Johnny Five / NodeJS (application logic)
WS/HTTP (networking and security protocols)
Clients (UI, input, visualisation)
#
#
#
#
#
NODEBOTS HARDWARE
Servos, Motors, ESCs, Stepper motors
Accelerometers, Gyroscopes, Compasses, IMUs
Temperature, Proxitimity, Pressure sensors
LEDs, NeoPixels, Pixel matrices
Switches, Joysticks, Buttons
LCDs
#
#
#
#
#
#
INSTALLATION
Board development environment (eg Arduino)
Flash board with protocol (eg Firmata)
npm install johnny-five
Write code
...
Make an awesome robot
#
#
#
#
#
#
EXAMPLES AND APPLICATIONS
Glasses(C) |Image(CC)AndyGelme MatthewBergman
SIMPLEBOT
Simplebot(CC)AJFisher
NODE SKIRT
Skirt(C) |Image(CC)KassandraPerch MatthewBergman
TETRIS
(C)AdrianCatalan
THARP
(OSC)dtex
HELLO WORLD
(CC)FlickrDanielNovta
CIRCUIT
HARDWARE HELLO WORLD
var five = require("johnny-five");
if (process.argv[2] == null) {
console.log("You need to supply a device to connect to");
process.exit()
}
var board = five.Board({port: process.argv[2]});
board.on("ready", function() {
var led = new five.Led(10);
led.blink(500);
});
DEMONSTRATION
Imageoflivedemonstration.Code:led.js
WEB PAGE LED
var five = require("johnny-five");
if (process.argv[2] == null) {
console.log("Please supply a device to connect to");
process.exit();
}
// web server elements
var express = require('express');
var app = express();
var http = require('http');
var server = http.createServer(app);
var board;
//
//
// Set up the application server
//
WEB CONNECTED LIGHT
Imageoflivedemonstration.Code:webled.js
MBOT
(CC)AJFisher
MBOT DRIVE CODE
var five = require("johnny-five");
var max_speed_l = 150;
var max_speed_r = 140;
// set up the input
var stdin = process.openStdin();
require('tty').setRawMode(true);
var board = new five.Board({port: process.argv[2]});
var l_motor = r_motor = null;
board.on("ready", function(err) {
if (err){
console.log(err);
return;
}
DEMONSTRATION
Imageofalternativedemonstration.Code:mbot.js
LOOK FOR DROIDS
(CC)Flickr⣫⣤⣇⣤
NODEBOTS TONIGHT
Arduino IDE - arduino.cc
NodeJS installed
npm install johnny-five
github.com/jsconfcn/nodebots-session
#
#
#
#
INTERNATIONAL NODEBOTS DAY
July 25, 2015
nodebotsday.com
RESOURCES
johnny-five.org
gitter.im/rwaldron/johnny-five
node-ardx.org
Make JS Robotics book (BOOKJSROBOTICS at MakerShed)
#
#
#
#
DROIDS, JAVASCRIPT AND WEB
CONNECTED HARDWARE
JSConf China, July 11, 2015
Andrew Fisher @ajfisher

Droids, java script and web connected hardware