{"id":13521392,"url":"https://github.com/rwaldron/galileo-io","last_synced_at":"2025-10-01T15:31:13.855Z","repository":{"id":14328276,"uuid":"17037665","full_name":"rwaldron/galileo-io","owner":"rwaldron","description":"Intel Galileo \u0026 Intel Edison IO Plugin for Johnny-Five","archived":false,"fork":false,"pushed_at":"2017-02-01T15:31:33.000Z","size":1613,"stargazers_count":101,"open_issues_count":20,"forks_count":26,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-10-18T20:54:11.314Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://johnny-five.io","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rwaldron.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-MIT","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-02-20T22:20:58.000Z","updated_at":"2023-08-12T18:37:35.000Z","dependencies_parsed_at":"2022-09-03T08:51:49.154Z","dependency_job_id":null,"html_url":"https://github.com/rwaldron/galileo-io","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwaldron%2Fgalileo-io","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwaldron%2Fgalileo-io/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwaldron%2Fgalileo-io/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwaldron%2Fgalileo-io/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rwaldron","download_url":"https://codeload.github.com/rwaldron/galileo-io/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234878802,"owners_count":18900703,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T06:00:33.785Z","updated_at":"2025-10-01T15:31:13.389Z","avatar_url":"https://github.com/rwaldron.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","Libraries and Plugins"],"sub_categories":["IO Compatibility Plugins"],"readme":"# Galileo/Edison/Joule-IO\n\n[![Travis Build Status](https://travis-ci.org/rwaldron/galileo-io.svg?branch=master)](https://travis-ci.org/rwaldron/galileo-io)\n\n\n## Compatible with Intel's Galileo Generation 2 (no longer supports Galileo Generation 1), Edison (Mini and Arduino Board, SparkFun GPIO \u0026 Arduino Blocks, Xadow Board, DFRobot Romeo \u0026 IO Expansion) and Joule boards.\n\n\nGalileo/Edison/Joule-IO is a Firmata.js-compatibility class for writing Node.js programs that run on the [Intel Galileo](https://software.intel.com/en-us/iot/hardware/galileo), [Intel Edison](https://software.intel.com/en-us/iot/hardware/edison), or [Intel Joule](https://software.intel.com/en-us/iot/hardware/joule). This project was built at [Bocoup](http://bocoup.com)\n\n\n## Getting Started\n\nGalileo/Edison/Joule-IO scripts are run directly on the Galileo, Edison or Joule board. To get started, complete the appropriate setup instructions: \n\n- [Getting Started with the Intel Galileo Board](https://software.intel.com/en-us/get-started-galileo-windows)\n- [Get Started with the Intel Edison Development Board](https://software.intel.com/en-us/get-started-edison-windows)\n- [Intel Joule Module User Guide\n](https://software.intel.com/en-us/intel-joule-getting-started)\n\n\n### Installation\n\n```\nnpm install galileo-io johnny-five\n```\n\nIf you want, you can also use the alias modules: \n\nFor Edison: \n\n```\nnpm install edison-io johnny-five\n```\n\nFor Joule: \n\n```\nnpm install joule-io johnny-five\n```\n\n\nBut keep in mind that these modules only delegate directly back to this module. \n\n\n### Usage\n\nThis module is intended for use as an IO-Plugin for [Johnny-Five](https://github.com/rwaldron/johnny-five).\n\n## Pin Identity and Access by Platform\n\n\n#### Intel Joule (Carrier Board)\n\n\n[![](joule.jpg)](joule.jpg)\n\n\n\nThe [Intel Joule + Carrier Breakout](https://www.sparkfun.com/products/13097) has two \"Breakout connectors\": \n\n[![](joule-breakouts.jpg)](joule-breakouts.jpg)\n\n\nThe usable pins and additional capabilities are shown here: \n\n[![](joule-breakout-names-pins-role.jpg)](joule-breakout-names-pins-role.jpg)\n\n\nPins may be addressed by _either_ \"Breakout Name\" or \"Pin Number\": \n\n\n| Breakout Name | Pin Number | Capability      |\n| ------------- | ---------- | --------------- |\n| B1_1          | 1          | GPIO            |\n| B1_2          | 2          | GPIO            |\n| B1_4          | 4          | GPIO            |\n| B1_5          | 5          | GPIO            |\n| B1_6          | 6          | GPIO            |\n| B1_7          | 7          | GPIO, UART 0 TX | \n| B1_8          | 8          | GPIO            |\n| B1_10         | 10         | GPIO            |\n| B1_11         | 11         | GPIO, I2C 0 SDA | \n| B1_12         | 12         | GPIO            |\n| B1_13         | 13         | GPIO, I2C 0 SCL | \n| B1_14         | 14         | GPIO            |\n| B1_15         | 15         | GPIO, I2C 1 SDA | \n| B1_16         | 16         | GPIO            |\n| B1_17         | 17         | GPIO, I2C 1 SCL | \n| B1_18         | 18         | GPIO            |\n| B1_19         | 19         | GPIO, I2C 2 SDA | \n| B1_20         | 20         | GPIO            |\n| B1_21         | 21         | GPIO, I2C 2 SCL | \n| B1_22         | 22         | GPIO, UART 1 TX | \n| B1_24         | 24         | GPIO, UART 1 RX | \n| B1_26         | 26         | GPIO, PWM 0     | \n| B1_28         | 28         | GPIO, PWM 1     | \n| B1_30         | 30         | GPIO, PWM 2     | \n| B1_32         | 32         | GPIO, PWM 3     | \n| B1_35         | 35         | GPIO            |\n| B2_11         | 51         | GPIO            |\n| B2_13         | 53         | GPIO            |\n| B2_15         | 55         | GPIO            |\n| B2_17         | 57         | GPIO            |\n| B2_19         | 59         | GPIO            |\n| B2_21         | 61         | GPIO            |\n| B2_22         | 62         | GPIO            |\n| B2_23         | 63         | GPIO            |\n| B2_24         | 64         | GPIO            |\n| B2_25         | 65         | GPIO            |\n| B2_26         | 66         | GPIO            |\n| B2_27         | 67         | GPIO            |\n| B2_28         | 68         | GPIO, UART 0 RX | \n| B2_29         | 69         | GPIO            |\n| B2_30         | 70         | GPIO            |\n| B2_31         | 71         | GPIO, I2C 1 SDA | \n| B2_32         | 72         | GPIO            |\n| B2_33         | 73         | GPIO, I2C 1 SCL | \n| B2_34         | 74         | GPIO, UART 1 TX | \n| B2_35         | 75         | GPIO, I2C 2 SDA | \n| B2_36         | 76         | GPIO, UART 1 RX | \n| B2_37         | 77         | GPIO, I2C 1 SCL | \n| B2_39         | 79         | GPIO            |\n| B2_40         | 80         | GPIO            |\n| L0, GP100     | 100        | LED100          |\n| L1, GP101     | 101        | LED101          |\n| L2, GP102     | 102        | LED102          |\n| L3, GP103     | 103        | LED103          |\n\n\n**NOTES** \n\n- **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.\n- **I2C Bus 0 is used by default** when no bus is explicitly provided.\n- **I2C Bus 1 or 2 must be specified explicitly** by providing a `bus: ...` property to the instantiation options (see \"BLINKM\" example below).\n\n\n\nBasic Example: \n\n```\nnpm install joule-io johnny-five\n```\n\n\n```js\nvar five = require(\"johnny-five\");\nvar Joule = require(\"joule-io\");\nvar board = new five.Board({\n  io: new Joule()\n});\n\nboard.on(\"ready\", function() {\n  var led = new five.Led(103);\n  led.blink(500);\n});\n```\n\n\n```js\nvar five = require(\"johnny-five\");\nvar Joule = require(\"joule-io\");\nvar board = new five.Board({\n  io: new Joule()\n});\n\nboard.on(\"ready\", function() {\n  var rgb = new five.Led.RGB({\n    // Specifying an alternate bus: \n    bus: 1,\n    controller: \"BLINKM\",\n  });\n\n  rgb.color(\"red\");\n});\n```\n\n\n#### Intel Edison Arduino\n\nThe [Intel Edison + Arduino Breakout](https://www.sparkfun.com/products/13097) has a pin-out form similar to an Arduino Uno. Use the pin numbers as printed on the board, eg. `3`, `13`, or `\"A0\"`.\n\n[![](https://cdn.sparkfun.com//assets/parts/1/0/1/3/9/13097-02.jpg)](https://cdn.sparkfun.com//assets/parts/1/0/1/3/9/13097-02.jpg)\n\nExample: \n\n```\nnpm install edison-io johnny-five\n```\n\n\n```js\nvar five = require(\"johnny-five\");\nvar Edison = require(\"edison-io\");\nvar board = new five.Board({\n  io: new Edison()\n});\n\nboard.on(\"ready\", function() {\n  var led = new five.Led(13);\n  led.blink(500);\n});\n```\n\n#### Intel Edison Mini Breakout\n\nThe [Intel Edison + Mini Breakout](https://www.sparkfun.com/products/13025) 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](#pin-mapping-table-) below to determine corresponding Pin names and numbers. \\*\n\nConnection to bus `1`:\n\n|I2C-1-SDA|I2C-1-SCL|\n|---------|---------|\n|J17-8    |J18-6    |\n\n[![](https://cdn.sparkfun.com//assets/parts/1/0/0/1/1/13025-01.jpg)](https://cdn.sparkfun.com//assets/parts/1/0/0/1/1/13025-01.jpg)\n\n\nExample: \n\n```\nnpm install edison-io johnny-five\n```\n\n\n```js\nvar five = require(\"johnny-five\");\nvar Edison = require(\"edison-io\");\nvar board = new five.Board({\n  io: new Edison()\n});\n\nboard.on(\"ready\", function() {\n  var led = new five.Led(\"J17-1\");\n  /*\n    Same as: \n\n    var led = new five.Led(0);\n    var led = new five.Led(\"GP182\");\n   */\n  led.blink(500);\n});\n```\n\n\n#### SparkFun Edison GPIO Block\n\nThe [SparkFun Edison GPIO Block](https://www.sparkfun.com/products/13038) 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](#pin-mapping-table-) below to determine corresponding Pin names and numbers. \\*\n\n[![](https://cdn.sparkfun.com//assets/parts/1/0/0/3/9/13038-03.jpg)](https://cdn.sparkfun.com//assets/parts/1/0/0/3/9/13038-03.jpg)\n\nExample: \n\n```\nnpm install edison-io johnny-five\n```\n\n\n```js\nvar five = require(\"johnny-five\");\nvar Edison = require(\"edison-io\");\nvar board = new five.Board({\n  io: new Edison()\n});\n\nboard.on(\"ready\", function() {\n  var led = new five.Led(\"GP44\");\n  /*\n    Same as: \n\n    var led = new five.Led(31);\n    var led = new five.Led(\"J19-4\");\n   */\n  led.blink(500);\n});\n```\n\n#### SparkFun Edison Arduino Block\n\nThe [SparkFun Edison Arduino Block](https://www.sparkfun.com/products/13046) connects to the Edison via `Serial1`, or `/dev/ttyMFD1`. This means that a user must [upload StandardFirmata via FTDI programmer](https://learn.sparkfun.com/tutorials/sparkfun-blocks-for-intel-edison---arduino-block). 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`](https://github.com/jgautier/firmata) (this is installed by Johnny-Five automattically. The port name must be specified: \n\n```js\n// This code runs on the Edison, communicating with the \n// SparkFun Arduino Block via Serial1 (/dev/ttyMFD1)\nvar five = require(\"johnny-five\");\nvar board = new five.Board({\n  port: \"/dev/ttyMFD1\"\n});\n\nboard.on(\"ready\", function() {\n  var led = new five.Led(13);\n  led.blink(500);\n});\n```\n\n[![](https://cdn.sparkfun.com//assets/parts/1/0/0/3/7/13036-01.jpg)](https://cdn.sparkfun.com//assets/parts/1/0/0/3/7/13036-01.jpg)\n\n\n#### SparkFun Edison I2C Block\n\nGalileo/Edison/Joule-IO/Edison-IO will automatically connect to bus 1, which is the bus used by this block.\n\n\n#### SparkFun Edison 9DOF Block\n\nGalileo/Edison/Joule-IO/Edison-IO will automatically connect to bus 1, which is the bus used by this block.\n\n\n\n\n#### Edison Mini Pin Mapping Table \\* \n\n| Pin Number  | Physical Pin | Edison Pin    |\n|-------------|--------------|---------------|\n| 0           | J17-1        | GP182         |\n| 4           | J17-5        | GP135         |\n| 6           | J17-7        | GP27          |\n| 7           | J17-8        | GP20          |\n| 8           | J17-9        | GP28          |\n| 9           | J17-10       | GP111         |\n| 10          | J17-11       | GP109         |\n| 11          | J17-12       | GP115         |\n| 13          | J17-14       | GP128         |\n| 14          | J18-1        | GP13          |\n| 15          | J18-2        | GP165         |\n| 19          | J18-6        | GP19          |\n| 20          | J18-7        | GP12          |\n| 21          | J18-8        | GP183         |\n| 23          | J18-10       | GP110         |\n| 24          | J18-11       | GP114         |\n| 25          | J18-12       | GP129         |\n| 26          | J18-13       | GP130         |\n| 31          | J19-4        | GP44          |\n| 32          | J19-5        | GP46          |\n| 33          | J19-6        | GP48          |\n| 35          | J19-8        | GP131         |\n| 36          | J19-9        | GP14          |\n| 37          | J19-10       | GP40          |\n| 38          | J19-11       | GP43          |\n| 39          | J19-12       | GP77          |\n| 40          | J19-13       | GP82          |\n| 41          | J19-14       | GP83          |\n| 45          | J20-4        | GP45          |\n| 46          | J20-5        | GP47          |\n| 47          | J20-6        | GP49          |\n| 48          | J20-7        | GP15          |\n| 49          | J20-8        | GP84          |\n| 50          | J20-9        | GP42          |\n| 51          | J20-10       | GP41          |\n| 52          | J20-11       | GP78          |\n| 53          | J20-12       | GP79          |\n| 54          | J20-13       | GP80          |\n| 55          | J20-14       | GP81          |\n\n\n#### Intel Galileo Gen 2\n\n\u003e Or Gen 1 if you're a glutton for punishment. \n\nThe [Intel Galileo Gen 2](https://www-ssl.intel.com/content/www/us/en/do-it-yourself/galileo-maker-quark-board.html) has a pin-out form similar to an Arduino Uno. Use the pin numbers as printed on the board, eg. `3`, `13`, or `\"A0\"`.\n\n[![](https://cdn.sparkfun.com//assets/parts/1/0/1/3/8/13096-01.jpg)](https://cdn.sparkfun.com//assets/parts/1/0/1/3/8/13096-01.jpg)\n\nExample: \n\n```js\nvar five = require(\"johnny-five\");\nvar Galileo = require(\"galileo-io\");\nvar board = new five.Board({\n  io: new Galileo()\n});\n\nboard.on(\"ready\", function() {\n  var led = new five.Led(13);\n  led.blink(500);\n});\n```\n\n\n\n\n\n\n### Blink an Led\n\nThe \"Hello World\" of microcontroller programming:\n\n(attach an LED on pin 9)\n\n```js\nvar Galileo = require(\"galileo-io\");\nvar board = new Galileo();\n\nboard.on(\"ready\", function() {\n  var byte = 0;\n  this.pinMode(9, this.MODES.OUTPUT);\n\n  setInterval(function() {\n    board.digitalWrite(9, (byte ^= 1));\n  }, 500);\n});\n```\n\n### Johnny-Five IO Plugin\n\nGalileo/Edison/Joule-IO is the default [IO layer](https://github.com/rwaldron/johnny-five/wiki/IO-Plugins) for [Johnny-Five](https://github.com/rwaldron/johnny-five) programs that are run on a Galileo or Edison board.\n\n***Note:*** On the Edison, you should require johnny-five first, followed by galileo-io. Otherwise you'll get a segmentation fault.\n\n\n```\nnpm install edison-io johnny-five\n```\n\nExample:\n```js\nvar five = require(\"johnny-five\");\nvar Edison = require(\"edison-io\");\nvar board = new five.Board({\n  io: new Edison()\n});\n```\n\n### Specify An I2C Bus\n\nGalileo/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: \n\n```js\n// If the i2c bus is 1 (`/dev/i2c-1`)\nvar board = new Galileo({\n  i2c: {\n    bus: 1\n  }\n});\n```\n\nOr...\n\n```js\nvar board = new Edison({\n  i2c: {\n    bus: 1\n  }\n});\n```\n\n#### Xadow Board\n\nExpansion boards can also be initialized with a built-in configuration object, that contains the correct I2C bus for that board: \n\n\n```\nnpm install edison-io johnny-five\n```\n\nExample:\n```js\nvar five = require(\"johnny-five\");\nvar Edison = require(\"edison-io\");\nvar board = new five.Board({\n  io: new Edison(Edison.Boards.Xadow)\n});\n```\n\nOr \n\n```js\nvar five = require(\"johnny-five\");\nvar Galileo = require(\"galileo-io\");\nvar board = new five.Board({\n  io: new Galileo(Galileo.Boards.Xadow)\n});\n```\n\n**Additional expansion board configurations will be added as support is implemented**\n\n\n### API\n\n**digitalWrite(pin, 1|0)**\n\n\u003e Sets the pin to 1 or 0, which either connects it to 5V (the maximum voltage of the system) or to GND (ground).\n\nExample:\n```js\n// This will turn on the pin\nboard.digitalWrite(9, 1);\n```\n\n\n\n**analogWrite(pin, value)**\n\n\u003e 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.\n\nExample:\n```js\n// Crank an LED to full brightness\nboard.analogWrite(9, 255);\n```\n\n**servoWrite(pin, value)** \n\n\u003e Set the pin to a value between 0-180° to move the servo's horn to the corresponding position.\n\nExample:\n```js\nboard.servoWrite(9, 180);\n```\n\n**digitalRead(pin, handler)** Setup a continuous read handler for specific digital pin.\n\n\u003e 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.\n\nExample:\n```js\n// Log all the readings for 9\nboard.digitalRead(9, function(data) {\n  console.log(data);\n});\n```\n\n\n**analogRead(pin, handler)** Setup a continuous read handler for specific analog pin.\n\n\u003e 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.\n\n\nExample:\n```js\n// Log all the readings for A1\nboard.analogRead(\"A1\", function(data) {\n  console.log(data);\n});\n\n```\n\n## License\nSee LICENSE file.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frwaldron%2Fgalileo-io","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frwaldron%2Fgalileo-io","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frwaldron%2Fgalileo-io/lists"}