Hacking into IoT using JavaScript

Preview:

Citation preview

Yesterday, Internet changed our life. Today IoT is doing it all over

again..

22 Billions of devices are expected to be part of IoT by 2020 – Gartner

Game Changers

Is this enough to get there?

Hack the IoT world with JavaScriptSajan John | Twitter:@sajanjohn

Idea Source: http://www.odetocode.com

Idea Source: http://www.odetocode.com

Why JavaScript?

1. Most popular language in the world today!

2. JavaScript is everywhere now!

3. Asynchronous

4. Easy learning curve

5. A language that can be used at back/middle/front-end layers

6. Light foot print

7. Efficient Memory Management

8. Node.Js and NPM

Node.js + arduino = magic!

Frameworks for hardware programming

Johnny-Five.js Cylon.js

Ever growing community

Write your own framework

Using Node Serial Port and Node Web Socket.

Write in JS and control Arduino Use Firmata Protocol to

communicate with Arduino Can be used with Accelerometer,

Button, Compass, Led, Joystick, Motor, (Ultrasonic) Ping, Proximity IR, Range IR, Sensor, Servo, Sonar

Running on a node.js server Excellent for internet and cloud

programming

Johnny-Five

Demo – 1 : Let there be light!

Install Arduino IDE Install Node.js npm install johnny-five Upload Firmata to your arduino

Open Arudino IDE Go to File > Examples >

Firmata > StandardFirmataJohnny-Five Demo

var five = require("johnny-five"), led, board;board = new five.Board();board.on("ready", function(){

led = new five.Led(12)led.strobe(1000);

})

Road Ahead

- Classes - Modules- Lexical block scope (let,

constant)- Concise method - Lambada operator

- Binary and Octal literals

- Mobile Controlled- NUI driven – Gesture /

Voice - Wearable- Listening Walls

- Learning Algorithms

ES 6

IoT

Demo – 2 : Smart Home concept

Removed the video due to size restriction. You can watch the poorly recorded back up demo herehttps://www.youtube.com/watch?v=YMIduKslE7M

Remote car is driven using JavaScript

When the car enters the garage lights will turn on automatically and turn off when it leaves the garage – using IR sensors

Chrome speech synthesizer integrated for voice commands

Socket used for mobile / remote control of appliances

Tech stack – Node.Js, Socket.Io, Johhny-Five, Express Js , Arudino Uno, Raspberry Pi, IR Sensors and Relays

Smart Home Demo

Thank You

Recommended