NodeBots

Robots powered by JavaScript

Leeds JS - 25 Nov 2015

@thiruppathi

Hello, I'm Thiru!

Brief History of Flashing Lights

Flashing Lights

In fact, I had plans to use flashing lights

You've been warned!

Moral of the story

Get comfortable with abstraction

http://abstrusegoose.com/98

In this talk

We're all gonna have fun!

  • What are NodeBots

  • Hardware Basics

  • Categories of NodeBots

  • Arduino

  • Johnny-Five

  • Installation Instructions

  • Demo time

  • Safety Instructions

  • References

  • What are NodeBots

  • Hardware Basics

  • Categories of NodeBots

  • Arduino

  • Johnny-Five

  • Installation Instructions

  • Demo time

  • Safety Instructions

  • References

NodeBots

Any kind of physical machine powered by 

JavaScript and Node.js

The "brain" of a NodeBot can be any MicroController

Micro-Controllers

  • Super hard to use

  • Difficult to get started

  • Poor software support

  • Geared towards Electrical Engineering

  • Use less power than a normal computer

  • Small

  • Can be battery operated

  • Programmed to do few specific tasks

 Wrapped NodeBots

Categories of NodeBots

  • These do not run JS internally; they expose an API that can be used via JS.
  •  e.g. Arduino, Sphero, SparkCore

 Native NodeBots

  • These platforms run JS natively; no wrappers, no tethered computer running node.
  •  e.g. Tessel, Espurino

Itty-Bitty Computers

  • These are just small computers with GPIO pins attached. They run node from command line.
  •  e.g. Raspberry Pi, BeagleBone Black

You don't need anyone's permission to make something great.

Set of tools aimed to make physical computing easy for everyone

Arduino UNO

  • Nerve Center/Brain of your Wrapped NodeBots
  • Signals are passed through it via code, GPIO devices, etc.
  • Needs External WiFi/Ethernet Adaptor
  • Consumes less Power
  • Programs written using C

Arduino IDE

Why C?

johnny-five

jQuery for Internet of Things

Why Not JS?

Arduino - Firmata Protocol

Hardware Basics

Hardware Basics - Breadboard

What's in the name?

Hardware Basics - Breadboard

Used for prototyping circuits

Hardware Basics - LED

Emits light when a small current is passed through it. 

Hardware Basics - Resistor

Restricts the amount of current that can flow through a circuit.

Hardware Basics - Resistor

Violet

Hardware Basics - Remembering Color Codes

Better Be Right Or Your Great Big Venture Goes West

BBROYGBVGW

0 - Black

1 - Brown

2 - Red

4 - Yellow

3 - Orange

5 - Green

6 - Blue

7 - Violet

8 - Grey

9 - White

BBROYGBVGW

mnemonic for resistor color code

Bye Bye Rosie, Off You Go, Bristol Via Great Western

B.B. ROY of Great Britain has a Very Good Wife

Hardware Basics - Jumper Wires

A jump wire, is a short electrical wire with a solid tip at each end, 

which is used to interconnect the components in a breadboard.

Hardware Basics - Servo

Takes a timed pulse and converts it into an angular position of the output shaft.

Hardware Basics - DC Motor

Spins when a current is passed through it.

Hardware Basics - Piezo Element

A pulse of current will cause it to click.

A stream of pulses will cause it to emit a tone.

Now, You know Everything about Electronics

that I do.

When did you become an expert in hardware?

LAST NIGHT

If tomorrow, somebody asks..

Initial Impressions on Hardware

You Can Build & Program Robots

  • Use a command line
  • Install Node
  • Code JavaScript
  • Use callback
  • node.js based robotics framework

  • jQuery of IoT

    • Normalises hardware through common API

    • Event driven interface

  • JS doesn't run on Arduino board

  • Boards like Tessel can run JS natively

  • Uses Firmata to communicate with the board

  • Makes hardware more accessible

  • Great chance to learn node.js

johnny-five

Johnny-Five

BRACE YOURSELVES

FOR DEMO

Johnny-Five - Getting Started

    
    npm install johnny-five
1
  
  /* blink-led.js */

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

  board.on("ready", function() {
    var led = new five.Led(13);
    led.blink(500);
  });
    
    $ node blink-led.js
2
3

Blink LED from Web App

Control LED from FireBase

1.  Prepare Firebase data

2.  Draw Fritzing Diagram

3.  Write j5 script

4. Connect the parts in Arduino

5. node <my-code.js>

When success - Turn on White LED

When (!success) - Turn off White LED

When LifeCount is 0 - Turn off Green LED

Usecase

Steps

Contributing to Community

Documentation Matters

From the simplest Blinking LED to HulkBuster, your documentation matters!

Documentation Matters

Documentation Matters

Document what went wrong!

Don't just document what went well. 

Safety Instructions

  • Don't get wet

  • Disconnect Arduino/any prototyping board from power source before adding/removing parts

  • Use resistors when required

node.js

Quadcopter

NodeCopter

Now, To Take Over The World!

node-copter

powered by ar-drone

Demo

Hope you are excited!

Happy Hacking!! Thank you!

References & Acknowledgements

Community & Movements

API Reference & Examples

Inspiration

Chris for encouraging to give the talk on node bots. 

LeedsJS for allowing me to experiment different things.

Steven Harper for lending his Drone.

Special Thanks to

NodeBots

By Thiruppathi Muthukumar

NodeBots

My Talk on NodeBots at LeedsJS November 2015 Meetup.

  • 1,826