Skip to content

surfrock66/RPi-RGB-Web

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 

Repository files navigation

RPi-RGB-Web

###Licensed under the MIT license.

This code allows you to control Raspberry Pi's GPIO Via the internet, specifically with the intention of controlling RGB LED Strips. The idea is that an HTML5 Canvas of an image provides the RGB sample set, and based on a user's click, a color sample is detected, converted to RGB, and sent to the Pi's GPIO where it's converted to signals for the LED Light Strips.

I have provided a bunch of sample RGB images, however any image you desire can be used. Resizing images in html breaks the canvas, so make sure your source image is the correct size for your needs. Additionally, avoid compressed images because the RGB information will be inconsistent.

Demonstration: My Youtube Demo

##Packages Needed and Web Server

You will need pigpiod, available here: PIGPIOD homepage

Install Instructions:

rm pigpio.tar
sudo rm -rf PIGPIO
wget abyz.co.uk/rpi/pigpio/pigpio.tar
tar xf pigpio.tar
cd PIGPIO
make -j4
sudo make install

To run pigpiod at startup, add the following to the root crontab with "crontab -e" from a root terminal:

@reboot              /usr/local/bin/pigpiod

You need a LAMP stack/web server on the pi:

sudo apt-get install apache2 php mysql-client mysql-server vsftpd

LAMP how to: DigitalOcean LAMP Guide

##Hardware Required

I've used the hardware outlined in this guide, and I'll summarize it here: Project which inspired the circuit and pigs code

Parts needed:

Parts that are helpful:

The LED strips I use, since I got a ton of them at costco years ago:

How to assemble the support circuit (you can use whatever GPIO pins you want):

LED Circuit

##Setup And Install

  1. Place all the Files in the "For Web Server" folder in the Root of your web server. (Default is /var/www/html/)
  2. Select the desired PNG image you want to use in your interface, rename it to "RGB.png". Remove other RGB-*.png files if desired. I have included the base .xcf file, so swatches can be rearranged or modified in GIMP.
  3. Ensure the web files are owned by the web user:
  • sudo chown www-data:www-data /var/www/html/RGB*
  1. Ensure the files have correct permissions:
  • sudo chmod 644 /var/www/html/RGB*
  1. Place RGB.sh in the "For Pi" somewhere on the Raspberry Pi. (For example, your home directory, ~/)
  2. Edit the RGB.sh file with the GPIO Pins you're using. Modify the polling interval if needed.
  3. Set the RGB.sh script to run at boot by running the following code:
  • sudo cp ~/RGB.sh /etc/RGB.sh
  • sudo chmod 755 /etc/RGB.sh
  • sudo chown root:root /etc/RGB.sh
  • su -
  • crontab -e
  • Add "@reboot /etc/RGB.sh &"
  1. To change the on off status go to http://raspberry-pi-ip/RGB.php

##References

About

A way to control Raspberry Pi's GPIO via the internet.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 77.9%
  • Shell 22.1%