No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


This is a node.js library for driving the Adafruit 12 bit 16 channel PWM Driver based on the PCA9685 with the Raspberry Pi


npm install adafruit-pca9685 

Optionally, get it from github and run npm install.

In your node.js file just require the library:

var makePwm = require( "adafruit-pca9685" );

This returns a constructor which you can now use to create a pwm instance using:

var pwm = makePwm();

The constructor can also be called with an argument map object. The map below shows defaults

    "freq": "50",   // frequency of the device
    "correctionFactor": "1.0", // correction factor - fine tune the frequency 
    "address": "0x40", // i2c bus address
    "device": '/dev/i2c-1', // device name
    "debug": <null> // adds some debugging methods if set 

The created pwm object has four methods

pwm.setFrequency(freq, correctionFactor);
pwm.setPwm(channel, on, off);
pwm.setPulse(channel, pulse);

A demo web application is in the demo folder

Remember: You must run your application as root


Some of the design for this module is is based on the [Adafruit python Code Library] (

Here is a growing collection of libraries and example python scripts for controlling a variety of Adafruit electronics with a Raspberry Pi

In progress!

Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit!

Written by Limor Fried, Kevin Townsend and Mikey Sklar for Adafruit Industries. BSD license, all text above must be included in any redistribution

To download, we suggest logging into your Pi with Internet accessibility and typing: git clone

Additional inspiration came from the pi4j project and the implementation of adafruit-i2c-pwm-driver node module.