Introduction to JavaScript Robotics

Post on 12-Apr-2017

68 views 7 download

Transcript of Introduction to JavaScript Robotics

INTRO TO JAVASCRIPT ROBOTICS

Suz Hinton@noopkat

aka.ms/tiara

ABOUT ME

Technical Evangelist at Microsoft

Open source hardware author

Member of NodeJS Hardware Working Group

AGENDA

Microcontroller boards

Inputs and Outputs

NodeJS on-board

NodeJS off-board

NodeJS as an IoT

service

Resources

Q: WHAT ARE MOST ROBOTS MADE OF?

A: MICROCONTROLLERS

A: INPUTS AND OUTPUTS

MICROCONTROLLERS

Arduino Uno

Processor - ATMega328PSpeed: 8MHzMemory: 32KbLanguage: C++Price: $24.95 USD

Good for:Offline, simple projects

Gotchas:No built in internet, modules are available

Tessel 2

Processor - Mediatek MT7620nSpeed: 580MHzMemory: 32Gb flash, 64Mb RAMLanguage: NodeJS, RustPrice: $44.95 USDExtras: built in Wi-Fi, runs Linux

Good for:Online, processor intensive projects

ESP8266

Processor – 32bit Tensilica Xtensa LX106Speed: 80MHzMemory: 1MB FlashLanguage: Lua, C++Price: $5 USDExtras: built in Wi-Fi, TLS capable

Good for:Online, portable, low power projects

Gotchas:Hard to work with

INPUTS AND OUTPUTS

INPUTS

‘read only’

sensors

switches

data

INPUT EXAMPLES

light sensor

touch sensor

humidity

sensor

api response

OUTPUTS

‘write only’

state

data

movement

OUTPUT EXAMPLES

LED (light)

speaker

motor

data stream

TECHNIQUES

#1 : NODEJS ON BOARD

with the Tessel2

$ npm install –g t2-cli$ npm install ambient-attx4

var tessel = require('tessel');var ambientlib = require('ambient-attx4');

var ambient = ambientlib.use(tessel.port['A']);ambient.getLightLevel();ambient.getSoundLevel();

#2 : NODEJS OFF BOARD

with the Arduino Uno

$ npm install –g firmata-party$ firmata-party uno$ npm install johnny-five

var five = require(‘johnny-five’);var board = new five.Board();

board.on(‘ready’, function() { var led = new five.Led(13); led.blink(500);});

#3 : NODEJS AS AN IOT SERVICE

with the ESP8266

IOT TIARA

IoT TiaraESP8266‘brain’3D printed band + crystalsRGB LEDs for lighting

Connects to MQTT broker (Azure IoT Hub)NodeJS server sends commands via broker

aka.ms/tiara

Azure IoT Hub tiara

Azure Web App

Twitch chat IRC channel

Azure IoT Hub tiara

Azure Web App

colorpicker.html

RESOURCES

tessel.io

arduino.cc

adafruit.com

nodebots.io

johnny-five.io

microsoft.com/en-us/internet-of-things

github.com/noopkat/iot-tiara