• Stars
    star
    101
  • Rank 338,166 (Top 7 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 11 years ago
  • Updated almost 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Intel Galileo & Intel Edison IO Plugin for Johnny-Five

Galileo/Edison/Joule-IO

Travis Build Status

Compatible with Intel's Galileo Generation 2 (no longer supports Galileo Generation 1), Edison (Mini and Arduino Board, SparkFun GPIO & Arduino Blocks, Xadow Board, DFRobot Romeo & IO Expansion) and Joule boards.

Galileo/Edison/Joule-IO is a Firmata.js-compatibility class for writing Node.js programs that run on the Intel Galileo, Intel Edison, or Intel Joule. This project was built at Bocoup

Getting Started

Galileo/Edison/Joule-IO scripts are run directly on the Galileo, Edison or Joule board. To get started, complete the appropriate setup instructions:

Installation

npm install galileo-io johnny-five

If you want, you can also use the alias modules:

For Edison:

npm install edison-io johnny-five

For Joule:

npm install joule-io johnny-five

But keep in mind that these modules only delegate directly back to this module.

Usage

This module is intended for use as an IO-Plugin for Johnny-Five.

Pin Identity and Access by Platform

Intel Joule (Carrier Board)

The Intel Joule + Carrier Breakout has two "Breakout connectors":

The usable pins and additional capabilities are shown here:

Pins may be addressed by either "Breakout Name" or "Pin Number":

Breakout Name Pin Number Capability
B1_1 1 GPIO
B1_2 2 GPIO
B1_4 4 GPIO
B1_5 5 GPIO
B1_6 6 GPIO
B1_7 7 GPIO, UART 0 TX
B1_8 8 GPIO
B1_10 10 GPIO
B1_11 11 GPIO, I2C 0 SDA
B1_12 12 GPIO
B1_13 13 GPIO, I2C 0 SCL
B1_14 14 GPIO
B1_15 15 GPIO, I2C 1 SDA
B1_16 16 GPIO
B1_17 17 GPIO, I2C 1 SCL
B1_18 18 GPIO
B1_19 19 GPIO, I2C 2 SDA
B1_20 20 GPIO
B1_21 21 GPIO, I2C 2 SCL
B1_22 22 GPIO, UART 1 TX
B1_24 24 GPIO, UART 1 RX
B1_26 26 GPIO, PWM 0
B1_28 28 GPIO, PWM 1
B1_30 30 GPIO, PWM 2
B1_32 32 GPIO, PWM 3
B1_35 35 GPIO
B2_11 51 GPIO
B2_13 53 GPIO
B2_15 55 GPIO
B2_17 57 GPIO
B2_19 59 GPIO
B2_21 61 GPIO
B2_22 62 GPIO
B2_23 63 GPIO
B2_24 64 GPIO
B2_25 65 GPIO
B2_26 66 GPIO
B2_27 67 GPIO
B2_28 68 GPIO, UART 0 RX
B2_29 69 GPIO
B2_30 70 GPIO
B2_31 71 GPIO, I2C 1 SDA
B2_32 72 GPIO
B2_33 73 GPIO, I2C 1 SCL
B2_34 74 GPIO, UART 1 TX
B2_35 75 GPIO, I2C 2 SDA
B2_36 76 GPIO, UART 1 RX
B2_37 77 GPIO, I2C 1 SCL
B2_39 79 GPIO
B2_40 80 GPIO
L0, GP100 100 LED100
L1, GP101 101 LED101
L2, GP102 102 LED102
L3, GP103 103 LED103

NOTES

  • LED100, LED101 and LED102 do not work correctly. This is a known issue in the platform itself, with work in progress to fix the issues.
  • I2C Bus 0 is used by default when no bus is explicitly provided.
  • I2C Bus 1 or 2 must be specified explicitly by providing a bus: ... property to the instantiation options (see "BLINKM" example below).

Basic Example:

npm install joule-io johnny-five
var five = require("johnny-five");
var Joule = require("joule-io");
var board = new five.Board({
  io: new Joule()
});

board.on("ready", function() {
  var led = new five.Led(103);
  led.blink(500);
});
var five = require("johnny-five");
var Joule = require("joule-io");
var board = new five.Board({
  io: new Joule()
});

board.on("ready", function() {
  var rgb = new five.Led.RGB({
    // Specifying an alternate bus: 
    bus: 1,
    controller: "BLINKM",
  });

  rgb.color("red");
});

Intel Edison Arduino

The Intel Edison + Arduino Breakout has a pin-out form similar to an Arduino Uno. Use the pin numbers as printed on the board, eg. 3, 13, or "A0".

Example:

npm install edison-io johnny-five
var five = require("johnny-five");
var Edison = require("edison-io");
var board = new five.Board({
  io: new Edison()
});

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

Intel Edison Mini Breakout

The Intel Edison + Mini Breakout has a dense pin-out form comprised of four rows, J17, J18, and J19, J20. Each pin is numbered, left-to-right, from 14 to 1 (if looking from the back). Use the row and column name ("J17-1"), or the corresponding GPIO ("GP182"), or pin number 0, to interact with that pin. (Note: "J17-1", "GP182" and 0 refer to the same pin). See the table of valid pins below to determine corresponding Pin names and numbers. *

Connection to bus 1:

I2C-1-SDA I2C-1-SCL
J17-8 J18-6

Example:

npm install edison-io johnny-five
var five = require("johnny-five");
var Edison = require("edison-io");
var board = new five.Board({
  io: new Edison()
});

board.on("ready", function() {
  var led = new five.Led("J17-1");
  /*
    Same as: 

    var led = new five.Led(0);
    var led = new five.Led("GP182");
   */
  led.blink(500);
});

SparkFun Edison GPIO Block

The SparkFun Edison GPIO Block has two columns of pins. Use the GPIO name printed on the board ("GP44"), or the corresponding row and column name ("J19-4"), or pin number (31), to interact with that pin. (Note: "J19-4", "GP44" and 31 refer to the same pin). See the table of valid pins below to determine corresponding Pin names and numbers. *

Example:

npm install edison-io johnny-five
var five = require("johnny-five");
var Edison = require("edison-io");
var board = new five.Board({
  io: new Edison()
});

board.on("ready", function() {
  var led = new five.Led("GP44");
  /*
    Same as: 

    var led = new five.Led(31);
    var led = new five.Led("J19-4");
   */
  led.blink(500);
});

SparkFun Edison Arduino Block

The SparkFun Edison Arduino Block connects to the Edison via Serial1, or /dev/ttyMFD1. This means that a user must upload StandardFirmata via FTDI programmer. Johnny-Five does not use Galileo/Edison/Joule-IO to communicate with the hardware on this block, instead it communicates via the serial connection, using its default Firmata.js (this is installed by Johnny-Five automattically. The port name must be specified:

// This code runs on the Edison, communicating with the 
// SparkFun Arduino Block via Serial1 (/dev/ttyMFD1)
var five = require("johnny-five");
var board = new five.Board({
  port: "/dev/ttyMFD1"
});

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

SparkFun Edison I2C Block

Galileo/Edison/Joule-IO/Edison-IO will automatically connect to bus 1, which is the bus used by this block.

SparkFun Edison 9DOF Block

Galileo/Edison/Joule-IO/Edison-IO will automatically connect to bus 1, which is the bus used by this block.

Edison Mini Pin Mapping Table *

Pin Number Physical Pin Edison Pin
0 J17-1 GP182
4 J17-5 GP135
6 J17-7 GP27
7 J17-8 GP20
8 J17-9 GP28
9 J17-10 GP111
10 J17-11 GP109
11 J17-12 GP115
13 J17-14 GP128
14 J18-1 GP13
15 J18-2 GP165
19 J18-6 GP19
20 J18-7 GP12
21 J18-8 GP183
23 J18-10 GP110
24 J18-11 GP114
25 J18-12 GP129
26 J18-13 GP130
31 J19-4 GP44
32 J19-5 GP46
33 J19-6 GP48
35 J19-8 GP131
36 J19-9 GP14
37 J19-10 GP40
38 J19-11 GP43
39 J19-12 GP77
40 J19-13 GP82
41 J19-14 GP83
45 J20-4 GP45
46 J20-5 GP47
47 J20-6 GP49
48 J20-7 GP15
49 J20-8 GP84
50 J20-9 GP42
51 J20-10 GP41
52 J20-11 GP78
53 J20-12 GP79
54 J20-13 GP80
55 J20-14 GP81

Intel Galileo Gen 2

Or Gen 1 if you're a glutton for punishment.

The Intel Galileo Gen 2 has a pin-out form similar to an Arduino Uno. Use the pin numbers as printed on the board, eg. 3, 13, or "A0".

Example:

var five = require("johnny-five");
var Galileo = require("galileo-io");
var board = new five.Board({
  io: new Galileo()
});

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

Blink an Led

The "Hello World" of microcontroller programming:

(attach an LED on pin 9)

var Galileo = require("galileo-io");
var board = new Galileo();

board.on("ready", function() {
  var byte = 0;
  this.pinMode(9, this.MODES.OUTPUT);

  setInterval(function() {
    board.digitalWrite(9, (byte ^= 1));
  }, 500);
});

Johnny-Five IO Plugin

Galileo/Edison/Joule-IO is the default IO layer for Johnny-Five programs that are run on a Galileo or Edison board.

Note: On the Edison, you should require johnny-five first, followed by galileo-io. Otherwise you'll get a segmentation fault.

npm install edison-io johnny-five

Example:

var five = require("johnny-five");
var Edison = require("edison-io");
var board = new five.Board({
  io: new Edison()
});

Specify An I2C Bus

Galileo/Edison/Joule-IO will do it's best to detect the correct I2C bus to use for a given expansion board, however the process is not infallible. To specify an I2C bus:

// If the i2c bus is 1 (`/dev/i2c-1`)
var board = new Galileo({
  i2c: {
    bus: 1
  }
});

Or...

var board = new Edison({
  i2c: {
    bus: 1
  }
});

Xadow Board

Expansion boards can also be initialized with a built-in configuration object, that contains the correct I2C bus for that board:

npm install edison-io johnny-five

Example:

var five = require("johnny-five");
var Edison = require("edison-io");
var board = new five.Board({
  io: new Edison(Edison.Boards.Xadow)
});

Or

var five = require("johnny-five");
var Galileo = require("galileo-io");
var board = new five.Board({
  io: new Galileo(Galileo.Boards.Xadow)
});

Additional expansion board configurations will be added as support is implemented

API

digitalWrite(pin, 1|0)

Sets the pin to 1 or 0, which either connects it to 5V (the maximum voltage of the system) or to GND (ground).

Example:

// This will turn on the pin
board.digitalWrite(9, 1);

analogWrite(pin, value)

Sets the pin to a value between 0 and 255, where 0 is the same as LOW and 255 is the same as HIGH. This is sort of like sending a voltage between 0 and 5V, but since this is a digital system, it uses a mechanism called Pulse Width Modulation, or PWM. You could use analogWrite to dim an LED, as an example.

Example:

// Crank an LED to full brightness
board.analogWrite(9, 255);

servoWrite(pin, value)

Set the pin to a value between 0-180Β° to move the servo's horn to the corresponding position.

Example:

board.servoWrite(9, 180);

digitalRead(pin, handler) Setup a continuous read handler for specific digital pin.

This will read the digital value of a pin, which can be read as either HIGH or LOW. If you were to connect the pin to 5V, it would read HIGH (1); if you connect it to GND, it would read LOW (0). Anywhere in between, it’ll probably read whichever one it’s closer to, but it gets dicey in the middle.

Example:

// Log all the readings for 9
board.digitalRead(9, function(data) {
  console.log(data);
});

analogRead(pin, handler) Setup a continuous read handler for specific analog pin.

This will read the analog value of a pin, which is a value from 0 to 4095, where 0 is LOW (GND) and 4095 is HIGH (5V). All of the analog pins (A0 to A5) can handle this. analogRead is great for reading data from sensors.

Example:

// Log all the readings for A1
board.analogRead("A1", function(data) {
  console.log(data);
});

License

See LICENSE file.

More Repositories

1

idiomatic.js

Principles of Writing Consistent, Idiomatic JavaScript
23,134
star
2

johnny-five

JavaScript Robotics and IoT programming framework, developed at Bocoup.
JavaScript
13,283
star
3

tc39-notes

TC39 Meeting Notes
JavaScript
587
star
4

jquery-hive

jQuery Plugin for creating and managing web workers across implementations. Includes Hive.Pollen.js - the thread-safe utility library for connecting worker threads to the Hive.
JavaScript
203
star
5

jquery.eventsource

Harnessing the EventSource API with jQuery
JavaScript
186
star
6

particle-io

Particle/Spark Core/Photon IO Plugin for Johnny-Five
JavaScript
173
star
7

dmv

JavaScript
118
star
8

io-plugins

Documentation and discussion point for IO Plugins
117
star
9

temporal

Non-blocking, temporal task sequencing. For use with robots built with Johnny-Five
JavaScript
84
star
10

javascript-robotics

JavaScript
71
star
11

grunt-compare-size

JavaScript
62
star
12

proposal-math-extensions

ES Math Extensions
HTML
58
star
13

popcorn.capture

capture any frame from your popcorn video instance and save as png
JavaScript
57
star
14

tessel-io

A Tessel 2 IO Plugin for Johnny-Five JavaScript Robotics programs
JavaScript
50
star
15

proposal-enum-definitions

47
star
16

fritzing-components

Custom Fritzing parts
42
star
17

fact

JavaScript
38
star
18

popcorn.sequence

JavaScript
36
star
19

mediagroup.js

JavaScript
28
star
20

etherport

EtherPort is a transport layer
JavaScript
23
star
21

navigator.getusermedia

JavaScript
22
star
22

popcorn.kernel

JavaScript
20
star
23

playground-io

Adafruit Circuit Playground IO Plugin for Johnny-Five
JavaScript
15
star
24

nodebot-sbc

NodeBots SBC
14
star
25

rwaldron

JavaScript
14
star
26

esp-io

ESP-IO is an IO Plugin that enables writing JavaScript Robotics programs with Johnny-Five, which interact with ESP8266 boards.
13
star
27

imp-io

Electric Imp IO Plugin for Johnny-Five
JavaScript
12
star
28

arduino-adc-io-expander

Turn any Arduino into an ADC IO Expander with an I2C interface.
Arduino
12
star
29

mock-firmata

Mocks used for testing code that depends on Firmata
JavaScript
11
star
30

compulsive

loops and delays without traditional timers
JavaScript
11
star
31

bro

whats up bro
10
star
32

jquery-mobile-badge

JavaScript
10
star
33

subjectisdead

Haskell
9
star
34

popcorn.embedly

JavaScript
9
star
35

edison-io

Intel Edison & Intel Galileo IO Plugin for Johnny-Five
JavaScript
9
star
36

j5-ds-touch

A DS Touch Screen component plugin for Johnny-Five
JavaScript
9
star
37

idiomatic.json

8
star
38

tyrion

Agent/Device Firmware Pair for Electric Imp. Use with Imp-IO for Johnny-Five
Squirrel
8
star
39

butter

JavaScript
8
star
40

unprefix.js

JavaScript
8
star
41

j5-rc-receiver

RC Receiver component plugin for Johnny-Five
JavaScript
8
star
42

chromakey

html5 video chromakey
JavaScript
8
star
43

nino-io

Linino One & Arduino Yun IO Plugin for Johnny-Five
JavaScript
8
star
44

adventure

JavaScript
7
star
45

burst-core

First pass at re-writing the animation core of The Burst Engine for generic JS Object timeline control.
JavaScript
6
star
46

pee-wee-rover

JSConf 2015 JavaScript Robotics Project Files
JavaScript
5
star
47

node-jsdev

JavaScript
5
star
48

jQuery.Mines

Publisher/Subscriber system with expressive and flexible control - and a cool metaphor.
JavaScript
5
star
49

tiny-query

JavaScript
5
star
50

tinyquery

JavaScript
4
star
51

polyfill

JavaScript polyfill functions
JavaScript
4
star
52

EventSource

THIS IS NOT A RELEASE
JavaScript
4
star
53

avrdude

Arduino-specific version of avrdude
C
3
star
54

jquery-classlist

JavaScript
3
star
55

snippets.js

tab triggered js code snippets... everywhere!
JavaScript
3
star
56

i2c-backpack-workshop

3
star
57

sdactivity

JavaScript
3
star
58

sensors

Notes for Sensor API unification
3
star
59

espresso

Small JavaScript VM for Arduino Mega 2560
C
3
star
60

platoon

JavaScript
3
star
61

footils

For exercisin distributed development
JavaScript
3
star
62

nitwit

nitwit is a command line twitter status update program in python
3
star
63

reflecta-io

IO Plugin for controlling Arduino boards with Johnny-Five via Reflecta
JavaScript
3
star
64

popcorn.zoom

Popcorn plugin to zoom and rotate popcorn video objects
JavaScript
3
star
65

vox-populi-tests

2
star
66

sotu

JavaScript
2
star
67

pcduino-io

pcDuino IO Plugin for Johnny-Five
JavaScript
2
star
68

electron-io

Particle Electron IO Plugin for Johnny-Five
JavaScript
2
star
69

popcorn.create

JavaScript
2
star
70

j5-button-gestures

JavaScript
2
star
71

burst

A javascript vector animation engine for the HTML5 Canvas supporting SVGs, Blender3D objects, timelines, easing, command chanining and callbacks.
JavaScript
2
star
72

lemmy

49% Motherfucker | 51% Son of a Bitch Express + Mocha + HTML5 smart boilerplate for both Javascript and Coffee-Script that kicks your ass!!!
CoffeeScript
2
star
73

NXTI2CDevice

Patched version of NXTI2CDevice for use with Arduino 1.0+
C++
2
star
74

testharness.js

Test framework for writing javascript-based browser tests
JavaScript
1
star
75

cloudnine

hooking up with cloud9 beta
JavaScript
1
star
76

nodysentary.js

1
star
77

b9snvs0

1
star
78

taco

It's a tastier docco built with bootstrap.
CoffeeScript
1
star
79

blitz-node

Node.js API Client for Blitz
JavaScript
1
star
80

tubeyloops

JavaScript
1
star
81

cloudninetest

cloudninetest
JavaScript
1
star
82

popcorn.scene

JavaScript
1
star
83

t2-project

Build a project for deployment to a Tessel 2
JavaScript
1
star
84

animeiosis

JavaScript
1
star
85

junktown

1
star
86

tessel-include-bundling

JavaScript
1
star
87

sumobot

SumoBot class for Johnny-Five
JavaScript
1
star
88

junkbox

1
star
89

geniverse

JavaScript
1
star
90

duokey

JavaScript
1
star
91

webOS

webOS Related Projects.
JavaScript
1
star
92

ObjectLateral

Passing off objects since jqcon 2009
1
star
93

chrome-dev-snippets

JavaScript
1
star
94

scripty2-contrib

1
star
95

euler

JavaScript
1
star
96

tiny-jquery

Interview project
JavaScript
1
star
97

playback.js

JavaScript
1
star
98

Promise

An elegant promise implementation for Javascript
JavaScript
1
star
99

Rust.tmbundle-1

Rust Bundle for TextMate
1
star
100

Sublime-JSLint

Sublime Text Editor 2 JSLint Support
JavaScript
1
star