how to electrocute yourself using the internet

40
HOW TO ELECTROCUTE YOURSELF USING THE INTERNET

Upload: alexander-roche

Post on 28-Jan-2015

115 views

Category:

Technology


3 download

DESCRIPTION

A talk about the Internet of things, Arduino and JavaScript frameworks including BreakoutJS and Johnny-Five

TRANSCRIPT

Page 1: How To Electrocute Yourself using the Internet

HOW TO ELECTROCUTEYOURSELF USING

THE INTERNET

Page 2: How To Electrocute Yourself using the Internet

ALEX ROCHE

@ALEXHACKED

Page 3: How To Electrocute Yourself using the Internet

Tom Scott being Electrocuted as part of a PayPal charity hack.(http://www.youtube.com/embed/j_74elSiI7E)

Page 4: How To Electrocute Yourself using the Internet

Matt, of SI Digital, being shocked.

Page 5: How To Electrocute Yourself using the Internet

WHAT I'M GOING TO BE TALKING ABOUTInternet of Things

Arduino

Johnny Five

BreakoutJS

Page 6: How To Electrocute Yourself using the Internet

- Kevin Ashton

Today computers—and, therefore, the Internet—are almost whollydependent on human beings for information ... The problem is, people

have limited time, attention and accuracy—all of which means theyare not very good at capturing data about things in the real world ...We're physical, and so is our environment ... Ideas and information

are important, but things matter much more.

Yet today's information technology is so dependent on dataoriginated by people that our computers know more about ideas thanthings. If we had computers that knew everything there was to know

about things—using data they gathered without any help from us—wewould be able to track and count everything.

Page 7: How To Electrocute Yourself using the Internet

XIVELYCloud Based Service

Users send JSON, XML or CSV to a RESTful API

Amalgamates data from around the world and stores it

Data is also accessible through AJAX requests

Page 8: How To Electrocute Yourself using the Internet

WHAT CAN YOU USE THE INTERNET OFTHINGS FOR?

MONITORING AN ENVIRONMENTModerating the temperature in your house

Making sure you're not being broken in to

REACTING TO DATA FROM AN ENVIRONMENTPrinting out the news every morning

Flashing a light when someone enters a room ...

... on the other side of the world

Page 9: How To Electrocute Yourself using the Internet

BERG'S LITTLE PRINTER

Page 10: How To Electrocute Yourself using the Internet

PHILIPS HUE LIGHTS

Page 11: How To Electrocute Yourself using the Internet

MAKE THE COSMPulls from Xively based on a user defined search term

Data is updated in real time

User can use the data provided to trigger sounds

Page 12: How To Electrocute Yourself using the Internet

STRAVA

Gathers data about your surrounding area

Transfers this data to a server which aggregates

Server reacts to the data you post

Page 13: How To Electrocute Yourself using the Internet

ARDUINO

Page 14: How To Electrocute Yourself using the Internet

WHAT IS AN ARDUINO?Open Source

Microcontroller board with addressable GPIO pins

Various form factors depending on need

Communicates with electronics using GPIO pins

Page 15: How To Electrocute Yourself using the Internet

GUH-PEE-OH WHAT?General Purpose Input and Output

Can be used to receive and transmit current to electroniccomponents

Can also be used to pass messages to serial input

Are how the Microcontroller talks to the outside world

Page 16: How To Electrocute Yourself using the Internet

PINS ON THE ARDUINONormal pins which can be set high or low

Analogue and PWM Pins

Analogue pins which can read values between 0 and 1023

PWM Pins can be set to values between 0 and 255

Page 17: How To Electrocute Yourself using the Internet

WARNINGWINDOWS USERS

You will have to bypass windows security to install drivers for theArduino.

Drivers are unsigned by Arduino

As such, you will need to disable Driver Signature Checking

Page 18: How To Electrocute Yourself using the Internet

S.H.I.E.L.D.S.Not a comic law enforcement agency (in this case)

Add on to an Arduino which extends functionality

Can be stacked, but some care does need to be taken

Page 19: How To Electrocute Yourself using the Internet

S.H.I.E.L.D. REQUIREMENTSPlugs to the non-GPIO pins need to reach all shields.

Each shield will have outputs which need to be left unconnectedto.

Outputs to the Arduino need to be unique.

Page 20: How To Electrocute Yourself using the Internet

PROGRAMMING AN ARDUINOBreaks down in to two main types

Code that is compiled to C / C++ and uploaded to themicrocontroller

Code that communicates with the board and issues commands

Page 21: How To Electrocute Yourself using the Internet

BREAKOUT JS; WHAT?Javascript based framework

Can be ran in a web page

Needs Arduino to be connected to a computer

Needs a server to run on your computer

Resulting web page can be connected to from any device on thelocal network

Page 22: How To Electrocute Yourself using the Internet

BREAKOUT JS; HOW?Install the Firmata firmware

Open the file located in the Breakout zip in the firmware folder

Upload it to the board using any compatible IDE

Page 23: How To Electrocute Yourself using the Internet

BREAKOUT JS; INSTALLING THE SERVERDepends on which server you want to install; Java or Node

Page 24: How To Electrocute Yourself using the Internet

USING THE JAVA SERVERUnzip the folder relevant to your Operating System

MacOS, Linux, Windows x32 & x64

Run the resulting Executable

Page 25: How To Electrocute Yourself using the Internet

USING THE NODE SERVERInstall NodeJS

Navigate to the node_server folder in command line

Run “npm install” to install all dependencies

“node server.js” starts the server

Page 26: How To Electrocute Yourself using the Internet

WHAT THE API LOOKS LIKEClasses for most things you would connect to an Arduino

Mixed in amongst normal Javascript and HTML

BO and JSUTILS namespacing

Page 27: How To Electrocute Yourself using the Internet

BO.I2CBase, BO.IOBoard, BO.IOBoardEvent, BO.PhysicalInputBase,BO.Pin, BO.PinEvent, BO.WSocketEvent, BO.WSocketWrapper,

BO.custom.ID12RFIDReader, BO.custom.RFIDEvent,BO.filters.Convolution, BO.filters.FilterBase, BO.filters.Scaler,

BO.filters.TriggerPoint, BO.generators.GeneratorBase,BO.generators.GeneratorEvent, BO.generators.Oscillator,

BO.io.AccelerometerADXL345, BO.io.AccelerometerEvent,BO.io.AnalogAccelerometer, BO.io.BiColorLED, BO.io.BlinkM,

BO.io.Button, BO.io.ButtonEvent, BO.io.CompassEvent,BO.io.CompassHMC6352, BO.io.DCMotor, BO.io.GyroEvent,BO.io.GyroITG3200, BO.io.LED, BO.io.MagnetometerEvent,

BO.io.MagnetometerHMC5883, BO.io.PotEvent, BO.io.Potentiometer,BO.io.RGBLED, BO.io.Servo, BO.io.SoftPot, BO.io.SoftPotEvent,

BO.io.Stepper, JSUTILS.Event, JSUTILS.EventDispatcher,JSUTILS.SignalScope, JSUTILS.Timer, JSUTILS.TimerEvent

Page 28: How To Electrocute Yourself using the Internet

HELLO WORLD EXAMPLEvar IOBoard = BO.IOBoard;var IOBoardEvent = BO.IOBoardEvent;var LED = BO.io.LED;var Button = BO.io.Button;var ButtonEvent = BO.io.ButtonEvent;var host = window.location.hostname;// if the file is opened locally, set the host to "localhost"if (window.location.protocol.indexOf("file:") === 0) { host = "localhost";}var arduino = new IOBoard(host, 8887); arduino.addEventListener(IOBoardEvent.READY, onReady);

function onReady(event) { // Remove the event listener because it is no longer needed arduino.removeEventListener(IOBoardEvent.READY, onReady); var led = new LED(arduino, arduino.getDigitalPin(11)); button = new Button(arduino, arduino.getDigitalPin(2)); button.addEventListener(ButtonEvent.PRESS, onPress); button.addEventListener(ButtonEvent.RELEASE, onRelease); $('#btnLeft').on('click', turnLedOff); $('#btnRight').on('click', turnLedOn); }

Page 29: How To Electrocute Yourself using the Internet

HELLO WORLD EXAMPLEfunction turnLedOn(evt) { // Turn the LED on led.on();}

function turnLedOff(evt) { // Turn the LED off led.off(); }

function onPress(evt) { // get a reference to the button object that fired the event var btn = evt.target; $('#state').html("Button " + btn.pinNumber + " state: Pressed");}

function onRelease(evt) { // get a reference to the button object that fired the event var btn = evt.target; $('#state').html("Button " + btn.pinNumber + " state: Released");}

Page 30: How To Electrocute Yourself using the Internet

CONNECTING TO THE INTERNET WITH BREAKOUTJSBreakoutJS runs in a web page

Treat it like any other Javascript Library

XMLHttpRequest() is something you can use

Or jQuery.ajax() if you prefer!

No extra shields needed to extend functionality

Page 31: How To Electrocute Yourself using the Internet

WHAT WOULD YOU USE BREAKOUTJS FOR?Large scale hacks which need monitoring

Systems which you can adjust over an internal network

Setting the colour of lights using a colour picker

Monitoring the heating and adjusting a thermostat

Deciding which person to administer an electrical shock to

Page 32: How To Electrocute Yourself using the Internet

JOHNNY FIVE

Page 33: How To Electrocute Yourself using the Internet

JOHNNY FIVE; WHAT?NodeJS based framework

Needs the Arduino connected to the computer running JohnnyFive

Page 34: How To Electrocute Yourself using the Internet

JOHNNY FIVE; HOW?Upload the "StandardFirmata" Arduino example to your Arduino

Install NodeJS

Pick a directorynpm install johnny-five

Page 35: How To Electrocute Yourself using the Internet

WHAT DOES THE API LOOK LIKE?Creating instances of hardware objects and passing initiation

propertiesvar servo = new five.Servo(10);

servo.min(), servo.max(), servo.center(), move(deg), sweep(deg)

Page 36: How To Electrocute Yourself using the Internet

HELLO WORLD EXAMPLEvar five = require("johnny-five"), button, led, litBool;var board = new five.Board();board.on("ready", function() {//Once the board is ready and the callback fires, your code goes here! litBool = false; led = five.Led(13); button = new five.Button(8);

button.on("down", function() { if(litBool == false){ led.off(); }else{ led.on(); } litBool = !litBool; });

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

Page 37: How To Electrocute Yourself using the Internet

CONNECTING TO THE INTERNET WITH JOHNNY FIVEJohnny Five is just a Node package

Treat it like any other Node Library

Connecting to API's is the same as you normally would withNodeJS

No extra shields needed either!

Page 38: How To Electrocute Yourself using the Internet

WHAT WOULD YOU USE JOHNNY FIVE FOR?Autonomously monitoring and adjusting

Inteligently regulating an aquarium

Building a little robot to intelligently avoid walls

Letting twitter decide who to administer a shock to

Page 39: How To Electrocute Yourself using the Internet

The Internet of Things is already here!

No concrete definition; make it your own

We can take part with (relative) ease

BreakoutJS : Watch and control your environment

Johnny Five : Control your environment with AI

Page 40: How To Electrocute Yourself using the Internet

THANK YOU!I'VE BEEN;

ALEX ROCHE

@ALEXHACKED