javascript on arduino

Download Javascript on Arduino

If you can't read please download the document

Upload: keith-bloomfield

Post on 13-Apr-2017

621 views

Category:

Technology


1 download

TRANSCRIPT

FileNewTemplate

Click to edit Master title style

Click to edit Master subtitle style

9/23/15

Click to edit Master title style

Click to edit the outline text formatSecond Outline LevelThird Outline LevelFourth Outline LevelFifth Outline LevelSixth Outline LevelSeventh Outline LevelClick to edit Master text stylesSecond levelThird levelFourth level

Fifth level

9/23/15

Javascript on Arduino

Keith Bloomfield - Dev9

Javascript on Arduino

Told from experiencemotivation

approach

lessons learned

Talking points:hardware

software

design patterns

hardware/software integration

code samples

Javascript on Arduino

Motivation

Javascript on Arduino

Motivation

SainSmart palletizing robotic arm

Javascript on Arduino

Motivation

SainSmart palletizing robotic arm - $118.23

Javascript on Arduino

Motivation

SainSmart palletizing robotic arm - $118.23

ProsMuch cheaper than rival hobby robotic arms

Performs surprisingly well in terms of speed

Javascript on Arduino

Motivation

SainSmart palletizing robotic arm - $118.23

ConsNot much lifting power

Difficult to replace parts

No instructions

Javascript on Arduino

Motivation

IoT is the buzzword of the day

Javascript on Arduino

Motivation

IoT is the buzzword of the day

Javascript on Arduino

Motivation

IoT is the buzzword of the day

But it isn't entirely newParts are cheaper

Tutorials are available

Technology is more developer friendly

Similar reasons why many people became software developers

We will get back to this

Javascript on Arduino

Arduino

- Is a microcontroller (Open source prototyping platform) A small computer on a single integrated circuit (memory, processor, I/O peripherals).- One of several competing products

Shield

- Extends capabilities of the Arduino- Requires a driver- Requires soldering

Javascript on Arduino

Javascript is powering devices

Johnny-five http://johnny-five.io

Cylon http://cylonjs.com

Espruino (Javascript on the metal) http://www.espruino.com/

and more!

Javascript on Arduino

Javascript is powering devices

Firmata: It's a protocol, it's a library...

Javascript on Arduino

Javascript is powering devices

Firmata: It's a protocol, it's a library...

- Enables communication between a computer and a microcontroller using the midi message format:http://www.midi.org/techspecs/midimessages.php

Javascript on Arduino

IoT is the buzzword of the day?

Javascript on Arduino

IoT is the buzzword of the day?

The cloud acts as the OS of the device.

Javascript on Arduino

Software:

johnny-five: JS Robotics & IoT framework compulsive ('13) Loops and delays without traditional timers. Time based event loop process queue

temporal? (TODO '14) Non-blocking, temporal task sequencing.

Javascript is powering devices

Javascript on Arduino

johnny-five

- has a useful REPL (read-eval-print loop) - supports a growing number of boards, shields, sensors, actuators

Javascript is powering devices

Javascript on Arduino

Hardware: Arduino Mega 2560 AdaFruit Servo Shield Servos IR motion sensor

Javascript is powering devices

Javascript on Arduino

Hardware: Load Sensor HX711 Load Cell Amp MultiColor Led HUZZA ESP8266 Wifi breakout

Javascript is powering devices

Javascript on Arduino

Powered by:Arduino: Basic arm motion only(4) 1.5V AA Batteries: Arm with augmented body

5V 2A power supply: Arm, lid, motion sensor. Struggles lifting when all 3 in operation at the same time.

5V 10A power supply: Sufficient

Servos require lots of power!

Javascript on Arduino

Be careful about mishaps. The larger/stronger the robot, the more severe the accident.

Accidents can quickly disable functionality.

Servos require lots of power!

Javascript on Arduino

Be careful about mishaps. The larger/stronger the robot, the more severe the accident.

Accidents can quickly disable functionality.

Recovery may take several days (new hardware in the mail)

Servos require lots of power!

Javascript on Arduino

Be careful about mishaps. The larger/stronger the robot, the more severe the accident.

Accidents can quickly disable functionality.

Recovery may take several days (new hardware in the mail)

+ Add an emergency stop early

Servos require lots of power!

Javascript on Arduino

When composition relies heavily on found components, and the idea is ad hoc, hardware refactoring/reassembly is frequent.

Lesson: It's easy to end up in the weeds

Javascript on Arduino

When composition relies heavily on found components, and the idea is ad hoc, hardware refactoring/reassembly is frequent.

+ Plan well, measure accurately and thoroughly.

Lesson: It's easy to end up in the weeds

Javascript on Arduino

When composition relies heavily on found components, and the idea is ad hoc, hardware refactoring/reassembly is frequent.

+ Plan well, measure accurately and thoroughly.

+ Expect to spend considerable time refactoring if you are planning as you go.

Lesson: It's easy to end up in the weeds

Javascript on Arduino

+ Refactor small, iterative/incremental, stable as possible

Lesson: It's easy to end up in the weeds

Javascript on Arduino

+ Refactor small, iterative/incremental, stable as possible

+ Use a board to track tasks

Lesson: It's easy to end up in the weeds

Javascript on Arduino

+ Refactor small, iterative/incremental, stable as possible

+ Use a board to track tasks

+ Keep changes in sync with the REPL

Lesson: It's easy to end up in the weeds

Javascript on Arduino

Couples sensory information to action selection (what to do next) in an intimate bottom-up fashion.

Subsumption Architecture

Javascript on Arduino

Subsumption Architecture

Couples sensory information to action selection (what to do next) in an intimate bottom-up fashion.

Behaviors prioritized and interruptive.

Javascript on Arduino

Subsumption Architecture

Couples sensory information to action selection (what to do next) in an intimate bottom-up fashion.

Behaviors prioritized and interruptive.

Lejos: Robot accessed directly through behaviors, focus on looping actions broken by flipping a boolean to false. Static methods/fields for convenience

Javascript on Arduino

Couples sensory information to action selection (what to do next) in an intimate bottom-up fashion.

Behaviors prioritized and interruptive.

Lejos: Robot accessed directly through behaviors, focus on looping actions broken by flipping a boolean to false. Static methods/fields for convenience

Challenge: Action selection implementation

Subsumption Architecture

Javascript on Arduino

Hardware in terms of stateful objects

On node.js?

Subsumption Architecture

Javascript on Arduino

Johnny-five: Animation

Subsumption Architecture

Javascript on Arduino

REST + JSON?

Javascript on Arduino

REST + JSON?

CoAP (Constrained Application Protocol) http://coap.technology/

QUIC (Quick UDP Internet Connections)https://www.chromium.org/quic

CBOR (Concise Binary Object Representation)http://cbor.io/

Apache thrift https://thrift.apache.org/

protobuf (Protocol Buffers serializing structured data) https://github.com/google/protobuf

Javascript on Arduino

- Costly,prohibitive ramp-up time

Inexpensive, interoperable, plug-and-play components

Expensive computation occurs in the cloud

The only limitation is creativity

Javascript on Arduino

The Robot...

Javascript on Arduino

Javascript on Arduino

- Detects presence of cat

Javascript on Arduino

- Detects presence of cat-Waits for cat to do its business

Javascript on Arduino

- Detects presence of cat-Waits for cat to do its business-Warns off nearby cat(s)

Javascript on Arduino

- Detects presence of cat-Waits for cat to do its business-Warns off nearby cat(s)-Scoops the clumps, deposits them in bin

Javascript on Arduino

- Detects presence of cat-Waits for cat to do its business-Warns off nearby cat(s)-Scoops the clumps, deposits them in bin- Levels the mounds

Javascript on Arduino

- Detects presence of cat-Waits for cat to do its business-Warns off nearby cat(s)-Scoops the clumps, deposits them in bin- Levels the mounds(v2) Tracks litter level in bin(v2) Notifies user once bin is full(v2) Detects clumps(v2) Wireless

Javascript on Arduino

Demo + Q&A

Github:github.com/kthblmfld/poopscavator

Demo:https://www.youtube.com/watch?v=kCbXBw0zStk