Loading...

Controlling an RGB LED strip via Raspberry Pi over the internet

50,137 views

Loading...

Loading...

Transcript

The interactive transcript could not be loaded.

Loading...

Loading...

Rating is available when the video has been rented.
This feature is not available right now. Please try again later.
Published on May 26, 2013

WARNING!!! This is a LONG video. I ramble and go into technical detail a lot. If you just want to see the thing in action, goto 6:09 or click this link to go straight to that part so you can skip the rambling and just see it in action.

For a proof of concept project, I wrote a couple scripts to allow me to control my rgb led strip from my iphone.

Details are in the video. Here are the parts I used:

Raspberry Pi Model B (from Adafruit)
Adafruit Pi Box (acrylic case)
Adafruit Pi T-Cobbler Breakout Kit (GPIO)
Half size solderless breadboard (from Adafruit)
3x 2n3904 transistors (from digikey)
1m rgb led strip (from Adafruit)
16gb class 4 SD card (from Amazon)
802.11n Wifi Dongle (from Adafruit)

I'm running Occidentalis distro from Adafruit. It's basically their souped up version of Raspbian. Highly recommended.

Control flow:
controller.php sends a simple html graphic user interface to the user via internet (user via internet)
each button on the interface hyperlinks back to controller.php along with get variables (server side scripting)
when a button is clicked, the script changes the colors states in test.txt (local on server)
python script (local to the raspberry pi) polls test.php (via internet)
test.php on the webserver reads test.txt and outputs contents to browser (via internet)
python script reads the values into a variable for each color
python changes the states of the pins for each color according to the values in the variables

As promised in the video, here are links to the scripts. You'll need to rename stuff accordingly, and install dependencies and such, but it'll get you going in the right direction should you decide the method I chose for accomplishing this is how you want to do it also. The beautiful thing about this stuff is that there are a million different ways you could accomplish this same project.

http://5ky.me/media/poll.py.txt
http://5ky.me/media/test.php.txt
http://5ky.me/media/controller.php.txt

I absolutely hate public speaking, which is what this practically is, so sorry in advance for being such a bad public speaker. Sorry for rambling too. I probably went more in detail than necessary--I just like to gush about this nerdy crap.

Also, I know I didn't necessarily go about this the most efficient way. There are tons of ways to accomplish this task. I just went with the quick and familiar route.

Loading...

Advertisement
When autoplay is enabled, a suggested video will automatically play next.

Up next


to add this to Watch Later

Add to

Loading playlists...