How to remotely control RGB LED strip with your Raspberry Pi and Phone

Published on: March 30, 2018

The video below shows off the RGB LED Strip that I have in my living room which I control with my phone. The set up is fairly simple. To access the code, please feel free to fork the Github repository here: https://github.com/nlinux1/Nazberrypi-RGB

The front-end is just basic JavaScript (and jQuery) which takes user input from a browser. It was done with the Bootstrap CSS framework so it's responsive and looks decent on mobile. Definitely not complex at all! The custom JavaScript file is just a 145 lines, and about 80 of those lines are a switch statement with the custom colors that you see. 

The backend is not the most efficient but since I'm not very adpet with Python, I have a PHP layer in between the Python and JavaScript. The JavaScript sends data to the PHP script via AJAX and the PHP script then triggers a Python command to change the colors. The python script alters the red, green, and blue lights individually, and together, they look like what you see in the video. 

I will work on hardware diagrams so please be sure to subscribe for updates. For now, the hardware you will need are:

  1. Raspberry Pi (this has been tested with Pi 3 and Pi Zero/W)
  2. Three MOSFET Transistors Type N-Channel - should be a logic-level transistor. E.g. IRL2203 or IRLU024
  3. RGB LED Strip
  4. Connectors/Wires and Power sources for Pi and Lights

For the software and the RGB control, you will also need the PIGPIO library installed on your pi - <a href="http://abyz.me.uk/rpi/pigpio/pigpiod.html" rel="nofollow">PIGPIO Library</a>. It's a free library and very easy to use. I'm planning on redoing my project and writing and recording all the steps!

Have questions? Ask in the comments below! 

Remember to checkout the Resources section below for associated downloadable on Github and more!

Resources:

Want the source code? Get it on my Github: https://github.com/nlinux1/Nazberrypi-RGB




Comments: