Bright Pi v1.0 Code Examples

To get the Bright Pi working on the Raspberry Pi, you need to enable I2C. You can find a great guide on setting up I2C on the Adafruit website here.

Once I2C is all set up, then from command line to turn only all white LEDs on:

sudo i2cset -y 1 0x70 0x00 0x5a

To turn only all IR LEDs on:

sudo i2cset -y 1 0x70 0x00 0xa5

To turn all LEDs on:

sudo i2cset -y 1 0x70 0x00 0xff

Then you need to turn the gain up to full using:

sudo i2cset -y 1 0x70 0x09 0x0f

Then you need to turn brightness of individual LEDs up. For white:

sudo i2cset -y 1 0x70 0x02 0x32
sudo i2cset -y 1 0x70 0x04 0x32
sudo i2cset -y 1 0x70 0x05 0x32
sudo i2cset -y 1 0x70 0x07 0x32

For IR:

sudo i2cset -y 1 0x70 0x01 0x32
sudo i2cset -y 1 0x70 0x03 0x32
sudo i2cset -y 1 0x70 0x06 0x32
sudo i2cset -y 1 0x70 0x08 0x32

If you need to turn all the LEDs off:

sudo i2cset -y 1 0x70 0x00 0x00

The above instructions assume you have a Rev 2 (or newer) Raspberry Pi. If you are using an original Rev 1 Model B Raspberry Pi then you will need to change the “-y 1” part to “-y 0” as the Rev 1 Model B Raspberry Pis (with 256 MB of RAM) use I2C port 0, whereas the newer models use I2C port 1.

That’s it really! You can vary brightness either by changing overall gain down, or by changing each individual LEDs brightness down. This can be done from within Python too and we will make guides up for this very soon. We are also intending to create an easy to use Python library as well as hopefully introducing support in Scratch.

For those that would like a bit more information about the exact operation of the pre-assembled LED driver chip on the board, it is a Semtech SC620 part. You can find the product on the Semtech website here and the full datasheet here. You may notice from the datasheet that there are only 8 controllable channels on this driver chip, and 12 LEDs in total. Each white LED is individually controllable, whereas the IR LEDs are controllable in banks of two. The banks of two IR LEDs correspond to the two LEDs closest to each white LED at the corner.

For information on how to assemble the Bright Pi, please visit the assembly guide page and to purchase the Bright Pi you can visit the product page here. In the pictures the Bright Pi is mounted on a Pimoroni Raspberry Pi Camera Mount which is the perfect addition to the kit.