aphexddb / lightshow

RGB LED light effects and things for the Raspberry Pi

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

lightshow

RGB LED light effects and things for the Raspberry Pi.

Arduino's are tricky for anything fancy regarding services, limited in RAM and plus I wanted to use Golang. Getting software PWM to work on a RPI is a bit of a challenge! All dependencies are vendored for convenience.

This project not possible without the original Arduino github.com/sowbug/G35Arduino project for inspiration and WiringPi

Hardware

This project uses a Raspberry Pi 3 and GE Color Effects Lights that you can buy at Lowe's. You should be able to support other LED pixels if you know what you are doing around timings and such.

Pi Model 3 Pinout Reference:

Raspberry PWM Pinout:

Header Pin Name BCM GPIO
12 PWM0 18

Linux Setup

  • Used Minibian distro. Setup your SSH access as you prefer, default user is root / raspberry.
  • Used ethernet for internet access, you can do wifi if you please

PWM Support via Pi Blaster

  1. Disable Raspberry Pi audio (it uses PWM). You will need to blacklist the Broadcom audio kernel module by creating a file /etc/modprobe.d/snd-blacklist.conf with

    blacklist snd_bcm2835
    

    If the audio device is still loading after blacklisting, you may also need to comment it out in the /etc/modules file. Some distributions use audio by default, even if nothing is being played. If audio is needed, you can use a USB audio device instead.

  2. Install latest Pi firmware

    wget https://raw.githubusercontent.com/Hexxeh/rpi-update/master/rpi-update
    bash rpi-update
    

    Reboot the pi

  3. Install Pi Blaster

sudo apt-get install pi-blaster

pi-blaster creates a special file (FIFO) in /dev/pi-blaster. Any application on your Raspberry Pi can write to it (this means that only pi-blaster needs to be root, your application can run as a normal user).

Important: when using pi-blaster, the GPIO pins you send to it are configured as output.

To set the value of a PIN, you write a command to /dev/pi-blaster in the form <GPIOPinName>=<value> where must be a number between 0 and 1 (included).

You must use the GPIO number (BCM xx in the diagram below).

Running

go build
./lightshow

Links

To investigate

PWM and GPIO things

Lights and LED

About

RGB LED light effects and things for the Raspberry Pi


Languages

Language:Go 98.0%Language:HTML 2.0%