Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pi-fast-gpio

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pi-fast-gpio

Super fast GPIO access on the Raspberry Pi using the pigpio daemon (for pwm, servo control, etc)

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
Maintainers
1
Weekly downloads
 
Created
Source

pi-fast-gpio

Super fast GPIO access on the Raspberry Pi using the pigpio daemon (for pwm, servo control, etc)

The pigpio library uses direct memory access (DMA) to allow you to sample the GPIOs up to 1,000,000 times per second. It also makes it fast enough to give you PWM and servo control on all GPIOs simultaneously. The servo waveforms are accurate to a few microseconds.

This code is based off of the python library included with the pigpio download.

Installation

For now you'll just have to clone this repo

Usage

Start the pigpio daemon:

$ sudo pigpiod

In your program:

  1. require(...) the pi-fast-gpio library
  2. Create a new instance of the PiFastGpio class
  3. Call connect(...) to connect to the pigpiod daemon
  4. When connected, do what you please with the GPIOs on your Raspberry Pi
  5. Call close() when you're done and about to exit your program.

Examples

There are two examples included, one that drives two servos, and one that uses PWM to change the brightness of two LEDs

Before running any of the examples, make sure the pigpio daemon is running:

$ sudo pigpiod

Servos example

Watch the servos example in action here: http://youtu.be/AnlUtAq5oAM

Before running the example, please connect two servos to your Raspberry Pi. One on GPIO18 and one on GPIO23.

Go to the examples/ directory and run the code:

$ node js_servo.js

Watch the servos turn!

LED PWM example

Watch the LED PWM example in action here: http://youtu.be/OW6yF4NuwLE

Before running the example, please connect to LEDs to your Raspberry Pi with suitable resistors. Connect one LED to GPIO24 and one to GPIO25.

Go to the examples/ directory and run the code:

$ node js_pwm.js

Watch the LEDs light up with different brightness!

Pin Layout tables

(Tables copied from r-pi-gpio's readme file)

Raspberry Pi GPIO Pin Layout (Revision 1)

AssignmentPinPinAssignment
3.3V125V
GPIO 0 (I2C0 SDA)34DNC
GPIO 1 (I2C0 SCL)56GROUND
GPIO 478GPIO 14 (UART TXD)
DNC910GPIO 15 (UART RXD)
GPIO 171112GPIO 18
GPIO 211314DNC
GPIO 221516GPIO 23
DNC1718GPIO 24
GPIO 10 (SP10 MOSI)1920DNC
GPIO 9 (SP10 MISO)2122GPIO 25
GPIO 11 (SP10 SCLK)2324GPIO 8 (SP10 CE0 N)
DNC2526GPIO 7 (SP10 CE1 N)

Raspberry Pi GPIO Pin Layout (Revision 2)

AssignmentPinPinAssignment
3.3V125V
GPIO 2 (I2C1 SDA)345V
GPIO 3 (I2C1 SCL)56GROUND
GPIO 478GPIO 14 (UART TXD)
GROUND910GPIO 15 (UART RXD)
GPIO 171112GPIO 18
GPIO 271314GROUND
GPIO 221516GPIO 23
3.3V1718GPIO 24
GPIO 10 (SP10 MOSI)1920GROUND
GPIO 9 (SP10 MISO)2122GPIO 25
GPIO 11 (SP10 SCLK)2324GPIO 8 (SP10 CE0 N)
GROUND2526GPIO 7 (SP10 CE1 N)

Keywords

FAQs

Package last updated on 07 Dec 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc