The project

The Raspberry Pi Zero has been out for quite a while now and inspiring projects with the Pi Zero pop up everywhere on maker websites. The 5 dollar Pi inspired me (Marcel Brouwers) and Chris Kuipers to start a project to control RGB ledstrips using our mobile phone. Sure, there are commercial off the shelf products with fancy Apps that let you control ledstrips, but that doesn’t give you the satisfaction achieved by making this yourself.

The solution we put together consists of a Raspberry Pi Zero and a custom PCB that takes care of the 12 volt to 5 volt power conversion for the Pi Zero and transistors for controlling the ledstrip (For more info on the hardware, see the hardware section of this post). For controlling the ledstrip via the browser we combined the pi-blaster software, a lighttpd install with php, the bootstrap framework and some php scripts. (For more info on the software, see the software section of this post)

WP_20160210_13_53_13_Rich_LI

The hardware

For this project we created a custom PCB using the Fritzing software and ordered it at a PCB manufacturing house. The  2 layer PCB is made to fit perfectly on top of the Pi Zero. The gerber files for the PCB can be downloaded here.

RPi-Zero Ledstrip V2.0_pcb
The parts we used:
– 3x TIP122 transistor
– 1x screw terminal with 5.0 mm pin spacing
– 2x screw terminal with 3.5 mm pin spacing
– 1x LM7805 power converter (or LM7805 drop-in alternative, which we used)
– 1x electrolytic capacitor (220 µF)
– 1x RGEF400 re-settable fuse (or bigger fuse for a longer ledstrip)
– 1x 40 pin gpio header female
– 1x 40 pin gpio header male
– 1x Raspberry pi zero
– 1x usb wifi dongle (rtl8188eu)
– 12 volt RGB ledstrip
– 12 volt power supply (amperage depending on the length of your ledstrip)

WP_20160210_13_23_01_Rich_LI

LM7805 v.s. buck converter

We could have used an ordinary LM7805 voltage regulator for powering the Pi Zero. However we chose for a buck converter as a drop-in replacement for the LM7805 mainly to limit heat buildup and improve power efficiency. There are many LM7805 drop in replacements on the market, the one we used can be found here.

WP_20160211_14_00_29_Rich_LI

The software

On the Raspberry Pi zero we installed Raspbian Jessie Lite and configured the usb wifi dongle to connect to our wireless network. Then we installed pi-blaster and tested pins 17, 27 and 22. After that we installed lighttpd and php. Then we used the bootstrap framework as basis for the webpage used to control the ledstrip. We added the code on GitHub so you can directly clone the files to the /var/www/html directory of your pi zero.

Control Ledstrip

And this is the end result:

WP_20160211_17_09_24_Rich_LI

Please feel free to leave your thoughts in the comment section below.

Facebook Comments

5 thoughts on “Raspberry Pi Zero Ledstrip Controller

  1. Marcel

    Excellent project exactly what I was looking for to use my PI Zero. Curious if you can tell me how I may get the board you designed. Fairly new to PCB work so any help would be great. Have already ordered all the other parts to get started.

    Cheers, Michael

  2. I can’t seem to get the website to actually control the LEDs. I have the wiring correct, and everything is working well with the command line. Also, I can access the web pages, however the sliders aren’t changing anything on the LED strips.

    I’m certainly missing something simple.

  3. Quick question. I’m adding relay controls to this now. Please see if this looks correct.
    From HTML

    1
    Option one is enabled

    function (){
    var xmlhttp;
    if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
    xmlhttp=new XMLHttpRequest();
    } else {// code for IE6, IE5
    xmlhttp=new ActiveXObject(“Microsoft.XMLHTTP”);
    }
    xmlhttp.open(“GET”,”ajax.php?relay1=”+relay1.getValue(),true);
    xmlhttp.send();
    }

    From PHP

    $relay1 = 5;
    if(is_numeric($_GET[‘relay1’])){
    exec(“echo \”” . $relay1 . “=” . $_GET[‘relay1’] . “\” > /dev/pi-blaster”);

Comments are closed.