View More Like this at my website jamespoole.me where I have other projects similar to this! :)
***Github Repo For This Project***
I built this project a few months ago but never got around to documenting it until now. The idea for this project is to have an RGB light strip that can be turned on and off and have the colours changed from a phone app. It’s a simple idea with a relatively simple solution. While it is not fully supported, I think it is possible to get a Neopixel light strip working with a Raspberry Pi. But for this I used an Arduino Nano to operate the light strip and a Raspberry Pi to serve the website.
Components:- Raspberry Pi
- Adafruit NeoPixel Light Strip (https://www.adafruit.com/products/1376)
- WiFi Dongle
- 5v 3A Power Supply
- DC Barrel Adapter
- Jumper cables (male to male and female to female)
- Block of wood and metal strip
I installed standard Raspbian on the RPi and set it to boot to the command line in the raspi-config menu. The “arduino_lights” folder in the Github repo contains the file that is to be placed on the Arduino. Use the Arduino IDE to load the file onto the board. The wiring is as in the Fritzing diagram. I will include photos of my setup but it is a real mess due to a lack of female to female jumper cables and my poor soldering skills!
Not Included is the DC Barrel Jack that splits the power supply into Positive and Negative lines that can be connected to the NeoPixel.
(Because I didn’t have any female to female jumper cables, my setup was needlessly complex. Just follow the fritzing diagram above and you should be fine 🙂)
For extra info on the Adafruit NeoPixels visit the Adafruit tutorials .
Programming***Github Repo For This Project***
Like in previous projects I used Python and the Flask framework to create the server to host the controls for the light.
First clone the repo of my code down to the Raspberry Pi. Everything will be used here except the arduino_lights folder as this is the code for the Arduino.
git clone https:/github.com/JamesPoole/PiLight
To get Flask up and running takes just 2 commands:
sudo apt-get install python-pip
sudo pip install Flask
With those installed and the lights.ino file loaded on the Arduino, you are ready to start up the web server. Run
sudo python app.py
To have the application run on startup edit the .bashrc file:
sudo nano ~/.bashrc
…and add the following line to the very bottom of the file:
python app.py
Now your server should be up and running on port 8000 of your RPis IP address (If you don’t know what your IP is run “ifconfig” and it should appear something in the format of 192.168.1.189). If the setup has run successfully you should now be able to go to any browser on your network and enter “your_ip_address:8000” and you will be presented with my basic graphical interface to alter the colour settings of the light.
To suspend the lights I used a section of a door saddle strip because it is strong enough to hold the lights while being malleable to mould into shape. This strip was drilled into a wooden block with a bit of weight in it to make sure that it would be kept steady.
Now that I have taken the time to write this article I have been thinking about new ways to improve this project. Two things that I am starting to work on right now is to build an app for Pebble watches to control the light in the same way as the current interface and to add voice activation. This is my first go at developing for the Pebble platform so I am looking forward to seeing what it has to offer! I hope it works out because if there is anything I need at the moment, it is a nerdier way to turn on a light bulb.
UPDATE 3/12/16
I built a Pebble App for controlling the light from my wrist! Its not complete yet but it has the basic functionality. The Pebble is an ideal interface to interact with the light because it has a button for each of the three colours to toggle them on and off. I still intend on adding voice activation to the app to make it that bit cooler! For now you can get the code for the watch app at this link https://github.com/JamesPoole/PiLightPebbleController.
Thanks for reading this, if anything wasn’t clear or is missing, please let me know and I will tend to the issue!
James P.
Comments
Please log in or sign up to comment.