{"id":15290587,"url":"https://github.com/fivdi/pi-io","last_synced_at":"2025-07-23T04:34:06.858Z","repository":{"id":57323348,"uuid":"82600936","full_name":"fivdi/pi-io","owner":"fivdi","description":"Raspberry Pi IO Plugin for Johnny-Five","archived":false,"fork":false,"pushed_at":"2021-05-01T10:06:32.000Z","size":1260,"stargazers_count":14,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-11T20:25:16.431Z","etag":null,"topics":["io-plugin","iot","javascript","johnny-five","nodejs","raspberry-pi"],"latest_commit_sha":null,"homepage":"","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/fivdi.png","metadata":{"files":{"readme":"README.md","changelog":"History.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-20T20:46:09.000Z","updated_at":"2023-09-23T21:12:21.000Z","dependencies_parsed_at":"2022-09-12T05:50:09.712Z","dependency_job_id":null,"html_url":"https://github.com/fivdi/pi-io","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/fivdi/pi-io","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fivdi%2Fpi-io","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fivdi%2Fpi-io/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fivdi%2Fpi-io/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fivdi%2Fpi-io/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fivdi","download_url":"https://codeload.github.com/fivdi/pi-io/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fivdi%2Fpi-io/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266618818,"owners_count":23957273,"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","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["io-plugin","iot","javascript","johnny-five","nodejs","raspberry-pi"],"created_at":"2024-09-30T16:08:42.758Z","updated_at":"2025-07-23T04:34:06.837Z","avatar_url":"https://github.com/fivdi.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pi-IO\n\nA proof of concept to demonstrate that it's feasible to implement a Raspberry\nPi IO Plugin for Johnny-Five using\n[Linux-IO](https://github.com/fivdi/linux-io).\n\nTested on a Raspberry Pi 4 Model B with Node.js v16.0.0. Should function with\nNode.js v10 or higher.\n\n## Installation\n\n#### Step 1 - Install the pigpio C library\n\nThe [pigpio C library](https://github.com/joan2937/pigpio) is a prerequisite\nfor pi-io.\n\nRun the following command to determine which version of the pigpio C library\nis installed:\n\n```\npigpiod -v\n```\n\nFor the Raspberry Pi Zero, 1, 2 and 3 V41 or higher of the pigpio C library is\nrequired. For the Raspberry Pi 4 V69 or higher is required.\n\nIf the pigpio C library is not installed or if the installed version is too\nold, the latest version can be installed with the following commands:\n\n```\nsudo apt-get update\nsudo apt-get install pigpio\n```\n\nAlternative installation instructions for the pigpio C library can be found\n[here](http://abyz.me.uk/rpi/pigpio/download.html).\n\n**Warning:** The pigpio C library contains a number of utilities. One of these\nutilities is pigpiod which launches the pigpio C library as a daemon. This\nutility should not be used as the pi-io uses the pigpio C library directly.\n\n#### Step 2 - Install the pi-io Node.js package\n\n```\nnpm install pi-io\n```\n\n## Johnny-Five Features Supported\n\nFeature | Support\n:--- | :---\nAnalog Read | no\nDigital Read | yes\nDigital Write | yes\nPWM | yes\nServo | yes\nI2C | yes\nOne Wire | no\nStepper | no\nSerial/UART | no\nDAC | no\nPing | yes \u003csup\u003e*)\u003c/sup\u003e\n\n*) Ping was tested with three HC-SR04 proximity sensors with varying degrees\nof success. One sensor functioned as expected. The second didn't timeout as\nit should but it's was possible to workaround the issue with software. The\nthird sensor didn't function. The issues may be related to the fact that a\nsingle pin is used for both trigger and echo.\n\nTo workaround these issues a controller was implemented that allows separate\npins to be used for trigger and echo. The same three HC-SR04 proximity sensors\nfunctioned well with this controller.\n\n## Supported Pins\n\nPin ID | Supported Modes | Comments\n:--- | :--- | :---\nP1-3 or GPIO2 | INPUT, OUTPUT, PWM, SERVO | Alternatively I2C SDA1\nP1-5 or GPIO3 | INPUT, OUTPUT, PWM, SERVO | Alternatively I2C SCL1\nP1-7 or GPIO4 | INPUT, OUTPUT, PWM, SERVO |\nP1-8 or GPIO14 | INPUT, OUTPUT, PWM, SERVO |\nP1-10 or GPIO15 | INPUT, OUTPUT, PWM, SERVO |\nP1-11 or GPIO17 | INPUT, OUTPUT, PWM, SERVO |\nP1-12 or GPIO18 | INPUT, OUTPUT, PWM, SERVO |\nP1-13 or GPIO27 | INPUT, OUTPUT, PWM, SERVO |\nP1-15 or GPIO22 | INPUT, OUTPUT, PWM, SERVO |\nP1-16 or GPIO23 | INPUT, OUTPUT, PWM, SERVO |\nP1-18 or GPIO24 | INPUT, OUTPUT, PWM, SERVO |\nP1-19 or GPIO10 | INPUT, OUTPUT, PWM, SERVO |\nP1-21 or GPIO9 | INPUT, OUTPUT, PWM, SERVO |\nP1-22 or GPIO25 | INPUT, OUTPUT, PWM, SERVO |\nP1-23 or GPIO11 | INPUT, OUTPUT, PWM, SERVO |\nP1-24 or GPIO8 | INPUT, OUTPUT, PWM, SERVO |\nP1-26 or GPIO7 | INPUT, OUTPUT, PWM, SERVO |\nP1-29 or GPIO5 | INPUT, OUTPUT, PWM, SERVO |\nP1-31 or GPIO6 | INPUT, OUTPUT, PWM, SERVO |\nP1-32 or GPIO12 | INPUT, OUTPUT, PWM, SERVO |\nP1-33 or GPIO13 | INPUT, OUTPUT, PWM, SERVO |\nP1-35 or GPIO19 | INPUT, OUTPUT, PWM, SERVO |\nP1-36 or GPIO16 | INPUT, OUTPUT, PWM, SERVO |\nP1-37 or GPIO26 | INPUT, OUTPUT, PWM, SERVO |\nP1-38 or GPIO20 | INPUT, OUTPUT, PWM, SERVO |\nP1-40 or GPIO21 | INPUT, OUTPUT, PWM, SERVO |\nLED0 | OUTPUT | Built-in LED\n\n## Usage\n\n### Pluse an LED connected to GPIO17\n\n\u003cimg src=\"https://raw.githubusercontent.com/fivdi/pi-io/master/doc/led.png\"\u003e\n\n```js\nvar five = require('johnny-five');\nvar PiIO = require('pi-io');\n\nvar board = new five.Board({\n  io: new PiIO()\n});\n\nboard.on('ready', function() {\n  var led = new five.Led('GPIO17');\n\n  led.pulse(1000);\n});\n```\n\n### Rotate a continuous servo connected to GPIO27 clockwise\n\n\u003cimg src=\"https://raw.githubusercontent.com/fivdi/pi-io/master/doc/continuous-servo.png\"\u003e\n\n```js\nvar five = require('johnny-five');\nvar PiIO = require('pi-io');\n\nvar board = new five.Board({\n  io: new PiIO()\n});\n\nboard.on('ready', function() {\n  var servo = new five.Servo({\n    pin: 'GPIO27',\n    type: \"continuous\"\n  });\n\n  servo.cw(0.8);\n});\n```\n\n### Measure proximity with a HC-SR04 using separate pins for trigger and echo\n\n\u003cimg src=\"https://raw.githubusercontent.com/fivdi/pi-io/master/doc/hc-sr04-two-pin.png\"\u003e\n\n```js\nvar five = require('johnny-five');\nvar PiIO = require('pi-io');\n\nvar board = new five.Board({\n  io: new PiIO()\n});\n\nboard.on('ready', function() {\n  var proximity = new five.Proximity({\n    controller: PiIO.HCSR04, // Custom controller\n    triggerPin: 'GPIO23',\n    echoPin: 'GPIO24'\n  });\n\n  proximity.on(\"change\", function() {\n    console.log(\"cm: \", this.cm);\n  });\n});\n```\n\n### Measure proximity with a HC-SR04 connected to GPIO25\n\nNote that this circuit uses a single pin for trigger and echo. Whether or not\nthis functions correctly appears to be highly dependent on the particular\nHC-SR04 sensor being used. The circuit shown above that uses separate pins for\ntrigger and echo is far more reliable.\n\n\u003cimg src=\"https://raw.githubusercontent.com/fivdi/pi-io/master/doc/hc-sr04.png\"\u003e\n\n```js\nvar five = require('johnny-five');\nvar PiIO = require('pi-io');\n\nvar board = new five.Board({\n  io: new PiIO()\n});\n\nboard.on('ready', function() {\n  var proximity = new five.Proximity({\n    controller: 'HCSR04',\n    pin: 'GPIO25'\n  });\n\n  proximity.on(\"data\", function() {\n    console.log(\"cm: \", this.cm);\n  });\n});\n```\n\n## Examples\n\nAdditional examples can be found in the\n[example directory](https://github.com/fivdi/pi-io/tree/master/example).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffivdi%2Fpi-io","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffivdi%2Fpi-io","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffivdi%2Fpi-io/lists"}