This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description
# RGB LED Driver

This software can be used to drive an analog RGB LED strip using a raspberry pi
and Adafruit's [16-channel 12-bit PWM/Servo Driver - PCA9685](

## The Circuit

Here's the basic idea:

- Hook up the pi to the PCA9685 breakout board using the I2C connections.
- Connect the pi's 3.3V output to VCC on the PCA9685 breakout board. Leave V+
- Follow this tutorial for the RGB LED strips:
- I used N-channel MOSFETs - three of them, one for each channel
- Connect the +12V from the LED strip to an external power supply (do NOT
use your pi for this!)
- Connect the ground side of the power supply to the pi ground
- Instead of using the PWM outputs from the arduino, we'll use the PWM
outputs from the PCA9685.
- Connect up the PWM output 0 to the MOSFET with the red wire from the
LED strip. Output 1 goes to green, output 2 goes to blue.

![Breadboard image](

## Dependencies

- [WiringPi2 Python](

## Usage

This program is designed to be included as a python module, but also has some
command line options. It, or any python code importing it, must be run as root
(sudo), because of the I2C interface.

### CLI Options

- `-c [hex color]` - Sets the led strip to the color specified.
- `-t` - Runs a test of a couple things. Use as a demo.
- `-o` - Turn the led strip off after other actions.

### As a module

from rgbDriver import RGBDriver
rgb_driver = RGBDriver()

Methods in the module use tuples to describe rgb colors: `(red_value,
green_value, blue_value)`. Each color value can range between 0 and 4095, due
to the PWM driver's 12 bit resolution. The `convert_eight_to_twelve_bit()`
method can convert a standard 0 to 255 color value to this scale.

To describe a color you can use the string representation of a hex color code
and the method `hex_to_rgb()` to convert it or `set_hex_color()` and
`to_hex_color()` to use it directly.

The driver keeps a property `current_color` that stores the led strip's current
color (in theory). This is used internally to smoothly transition from one
color to another.

Two types of color setting methods exist. `to_...` will transition a color
change over a set time. The last argument of any `to_...` method is that
transition time in milliseconds (default 300ms). `set_...` will set a color

Currently supported methods are:

- `to_rgb(rgb, fade=DEFAULT)`, `set_rgb(rgb)`
- `to_rand(r_range=(0, 4095), g_range=(0, 4095), b_range=(0, 4095), fade=DEFAULT)`, `set_rand(r_range=(0, 4095), g_range=(0, 4095), b_range=(0, 4095))`
- `to_hex_color(color, fade=DEFAULT)`, `set_hex_color(color)`


- I've got a basic single color led strip and an extra N-channel MOSFET that I
want to control.
- Set current_color var after setting up pwm.

Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
ledDriver-1.0.tar.gz (5.5 kB) Copy SHA256 Checksum SHA256 Source Mar 2, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting