osc2led

This is a program for Raspberry Pi and the Adafruit 16 channel, 12 bit PWM interface. It enables you to control analog LED lights/stripes using OSC messages.. so it turns your Raspberry Pi into an OSC LED controller. I wrote it for this project.

  • event driven, written in Perl
  • supports two chained PWM interfaces -> 10 independent LED stripes
  • supports two commands: 1) set LED color and 2) set LED color and time interval.. after the interval, the LED goes black
  • can be extended to support more interfaces and more commands (for strobing, etc, see comments at the end of the source code)

 

Download

Instructions:

  • Download the script and edit it to change the address and port on which it will listen (OSC server)
  • Install required modules, most importantly Device::PWMGenerator::PCA9685. From here or using cpan..
  • Run the script, no parameters needed:
    ./osc2led.pl

    This will start the OSC server on defined address and port.

  • Send OSC messages to it:
/leds/X R G B
/leds/X/blink R G B I

Where X (from 1 to 10) is channel number – selects the LED stripe and R, G, B are red, green, blue values from the interval 0-4095 (integer) and I is time interval (float)