Introduction: Wireless Phone Remote-Controlled LED Strips: RasPi W/ Fadecandy Driver W/ WS2811/WS2812 Addressable LED Strips W/ TouchOSC Smartphone App W/ Iphone or Droid
Here goes an increasingly comprehensive design overview of my latest project. Below is a video I have uploaded showing some functionality:
The original idea progression went something like the following:
- Addressable LED strip(s we always want more shiny things!!!) to get cool visual effects that could be programmed (somehow)
- controlled by an iPhone (or Android phone) using various available hardware functionality present in most modern smartphones (accelerometer, touch screen, wifi/bluetooth capability, able to run more & more complex applications now)
- not need an actual desktop computer or laptop to run. I had seen friends use the Python programming language with various GitHub repositories to integrate Wiimote input, or iPad accelerometer data for various different projects. Also necessary because it would be used for art installation and I did not want to need a computer be left out with the art structure.
- I knew that the Raspberry Pi was a cheap viable microcomputer (a step above microcontrollers in functionality and speed) that could run a certain program until the day it died, especially with Python and C languages. I did not really have any Python experience and found most of what I needed to set it up in Python so I decided to go that route. The actual Pi computer is the size of credit card and thickness of a quarter. Needs no heatsink,and is cheap (under $40, but ends up being around $70 with some necessary and luxury accessories)
I found quite a lot of help through the Adafruit Learning guides, and a lot of setup ideas were grafted from their awesome team, but a lot of design additions were added onto my setup as well. For example:
- I have mine setup to run via a Python program (vs. needing a networked computer)
- I added wireless phone remote control of the LEDs via PyOSC (allows the Python program and the phone with TouchOSC app to communicate)
- I have the Python program setup to run at startup so that when I take out to the middle of nowhere, all I have to do is plug it in and the LED effects program will startup (and also not need the phone app open to do so)
- No monitor or mouse needed once SSH setup
- Integrating PyOSC with PyOPC, and adding in some helpful libraries to include that help with some common occurrences with LED programming
- Some extra explanation on some of the programming adjustments that need to made to account for real-world to digital interaction (gamma correction and dithering as examples)
Adafruit (forum, component retailer, and knowledge hub http://www.adafruit.com/ ) sells the WS2811/WS2812 strips (They call them "Neopixels"), and they have a bunch of great resources for more awesome projects. Their forum community and moderator/admins/project shamans guides are amazing.
The LED strips normally need an Arduino controller to run, but Micah Scott of Scanlime designed a special controller /driver that helps obscure away that necessity. The controller/driver for the LED strips integrates the ability to use Open Pixel Control with dithering and gamma correction abilities.
Here is the Scanlime's article on the Fadecandy:
http://scanlime.org/2013/11/fadecandy-easier-tasti...
Dithering is an effect relevant to frequency perception. It can be applied to music just as it is to images. Dithering acts as a diffusion between two areas of low color depth. The lack of color depth leads to artifacts in digital captures of an environment, and dithering helps smooth those transitions. With LEDs this leads to modulated intensities to give more color depth, and will often result in a sort of twinkle (that I think looks great, like twinkling startlight).
The gamma correction helps re-scale the curve of each red green blue LED intensity. Our eyes do not perceive light intensity in a linear manner so gamma correction helps make a linear fade on red from 0 to 255 seem more linear to our eyes. If a light dimmer was set to linear scale, the first half would seem to turn on extremely fast, but the last half would seem not much brighter relative. Gamma correction then applies the inverse of our eye's natural curve to make sure the LEDs operate in a visually right way.
Open Pixel Control (OPC) allows for a simple way to network and streamline communication with RGB pixel arrays. PyOPC then takes that the necessary step further and allows for Python programming language to arrange an OPC client server between the pixel strands and the Fadecandy controller/driver that can receive and use OPC messages.
TouchOSC is the last piece of the puzzle and is what allows for some awesome unique and customizable functionality. I knew about TouchOSC from DJ usage. In that scenario I use the MIDI functionality of TouchOSC, but I knew that it also was capable of sending simultaneous Open Sound Control messages. I did some research and found that it was indeed able to interface with Python programming language via PyOSC.
The best parts about TouchOSC app:
- Easy to use TouchOSC Editor application allows fast intuitive controller design
- Simple sync-to-phone function via commonly connection WIFI connection allows easy way to update the layouts you make in the Editor (I have used an ad-hoc connection to sync when a router was not present)
- takes advantage of phone's preexisting hardware functionality (accelerometer & multi-input touch-capable screens)
- clean easy-to-use app interface / design
Step 1: Skills and Tools Needed
Some steps this guide will not help with but are necessary:
- Python programming experience helps
- Figure out power for Raspberry Pi (solar/battery vs. plug vs. battery just make sure it can get that solid 1A when it needs to)
- Initially setup the Pi (install distribution which is Raspian for me, change to American keyboard, etc.)
- Be able to access command prompt
- Update the distribution you have, and make sure you can setup everything mentioned if you do not have Raspian
- Accessing your phone Wifi settings (to connect to Pi's broadcasted network for TouchOSC control)
- Soldering
- How to use a DVM (just know how to use diode / continuity check mode on it
Things you need:
- Mouse & Keyboard & Desktop Monitor (with capability to plug into HDMI; VGA will need an expensive adapter to HDMI from the Pi's HDMI so DVI or HDMI are better) for initial setup until you can remote login via SSH & then all necessary changes can be handled w/ a wireless-connected laptop / desktop whenever necessary
- Soldering Iron
- Solder
- Between 18 & 24 AWG wire (for wiring harness to LED strips, at least 2 ft per strand so you can splay the strips out some, but probably not more than 6 ft per strand to avoid voltage drop going to LEDs)
- Between 10 &14 AWG wire (power for LEDs used in wiring harness so two times same amount per strip as above for ground and positive; also note this is for my setup and if you used less or more LEDs than I, this will be different; I go over in the instructable how I figured this out)
- Any number of WS2811/WS2812 LEDs w/ integrated driver and logic that are chained properly (data out from one LED wired to next LEDs data in as labeled on the physical strip)
- Raspberry Pi and necessary power accessories
- USB A male to USB B Mini Male (Pi to Fadecandy controller/driver for power and data)
- An enclosure of some sort that can have a 0.5" hole put in it and a way to put that hole in your enclosure; Also need to put another slightly bigger hole in enclosure.
- DC panel-mount jack (for connection to LED power brick)
- Good DC 5V switching power supply of proper amperage (Discussed in guide; For 180 LED setup I use 10A one)
- 12V 4700uF Capacitor (smoothing capacitor)
- Fadecandy WS2811/WS2812 LED Controller / Driver
- 1 JST 3-pin male / female connector set per LED strip
- 2 extra JST 3-pin connector male / female set for data & ground on Fadecandy side
- Heat shrink tubing or electrical tape
- Compatible wireless dongle
- Permatex 66b Silicone Sealant (highly recommended protective step)
- 470 Ω resistor ( 1 per each data connection)
- Smartphone capable of downloading TouchOSC app from relevant app store and app cost($5 at time of purchase for me from iTunes Store)
Step 2: Setting Up the Raspberry Pi: Enabling SSH
Alright so let us start with setting up the Pi
For this instructable, I am assuming you were able to at least get the Pi up and running, but there may be some things you have not yet setup yet.
An important one for editing code later will be enabling SSH, or Secure Shell. This allows remote login so that you will not need a monitor or mouse plugged into the Raspberry Pi again.
Assuming the Raspberry Pi has already been setup, you can access the configuration menu via:
sudo raspi-config
Then go to "Advanced Options" and you should see an option for "SSH"
Make sure that SSH is "Enabled" in this and you will be good to exit the configuration menu
This will now allow you to use a SSH client program to access your Raspberry Pi. You login with the username and password you already setup for the pi. If no such password was setup the default username is: pi. default password: raspberry.
Step 3: Setting Up the Raspberry Pi: Setting Up Wireless Dongle
This is easiest when you still have the monitor and mouse in the Raspberry Pi so that you can use the Raspian Desktop Wifi Utility.
Use the Pi's command prompt and type:
startx
This should bring you to the Desktop. Alternatively if you already see the Desktop of the Pi, go to the WiFi Config utility's icon and open it, and set it up from there pretty hassle free.
After a reboot the wifi should be alive:
sudo reboot
On login go to command prompt and type:
ping google.com
You should see some packets get sent and received.
Step 4: Setting Up the Raspberry Pi: Downloading Netatalk
Trying to remember a bunch of IP address numbers sounds like a nightmare for my forgetful brain, so installing Netatalk allows the Pi to use the name you gave it on configuration.
To install, make sure you either are plugged into your home router via ethernet or have the wireless all setup and connected, and type this into the command line:
sudo apt-get -y install netatalk
Now when you login to the Pi using SSH, you can type the actual username words you named the Pi instead of the 192.xxx.xx.x or whatever IP address your Pi has.
Step 5: Setting Up Fadecandy Server on Pi
You will need to download some files from GitHub. This means you will need to have the Git function installed on the Pi. To confirm this is downloaded type this into the command prompt:
sudo apt-get -y install git
Once finished, type this to download the Fadecandy GitHub repository to the Pi:
git clone git://github.com/scanlime/fadecandy
This downloads an executable file that no longer works on newer version of Raspian and other distros so do this next:
cd fadecandy/server
make submodules
make
(This takes a bit so be patient) Once done:
sudo mv fcserver /usr/local/bin
Finally, the server needs to be run at startup. This is done via the /etc/rc.local file which allows us to add programs to the startup execution list. Later this will include our python program integrating LED control and TouchOSC application control, as well. To do this we will use Pi's in command prompt text/file editor "nano". Sudo has to be used because we are editing root user files. To do this open the command prompt and type:
sudo nano /etc/rc.local
And add this before the final "exit 0" line in the file. Essentially, any commands put before this will run at startup once the Pi has booted, in the background:
/usr/local/bin/fcserver /usr/local/bin/fcserver.json >/var/log/fcserver.log 2>&1 &
Next we need to make the .json configuration file. In command prompt, type:
sudo nano /usr/local/bin/fcserver.json
Type out this code into the JSON file:
Since the Fadecandy actually is able to handle strip lengths up to 64, this remaps each strip from 64 to 60 (because the Neopixels are either 30 or 60 per meter), sets a hardware whitepoint on a scale of 0.1 to 1.0 (percent brightness as a hardware default where 1.0 is 100% brightness), and sets up the serial numbers for the Fadecandy. Serial numbers can be found by plugging in your fadecandy controller to the raspberry pi via the provided
USB and going to command prompt and using:
tail -f /var/log/fcserver.log
This should give you the 16 digit alphabetic serial number of each individual controller to use in where the code says serial. If only one controller is being used, delete the { } block that has the second. Each Fadecandy controller can support 8 strips of up to 64 LEDs.
Step 6: LED Power Considerations
Power considerations for LEDs become very real, very fast. While LEDs in general are low power consumption, they can start to add up to a high current system. Each LED is made up a Red, Green, and Blue LED. When all three are on is when the LED consumes the most power (when the output is white).
Each LED, when white, ends up drawing around 50mA ( 0.050 Amperes). So, a strip of 60 LEDs will draw about 3A. Three strips, 9A. 20 strips, 60A (!!!!). Always assume full power draw when designing. You do not want to design a system that will not be able to handle continuous peak consumption, and baking in some headroom is always a great design idea.
I started with my power supply. I wanted the system to run off one power line plugged into a surge protector power outlet. The power outlet I had was rated to handle 15A max. I decided to back it down the system to 10A max because it would be outdoors in a hot desert for many events, and I wanted to make sure it had extra, extra headroom as generator's power is not always the cleanest.
With that in mind, I decided I could do three strips of 60 LEDs and be around that 10A mark\, and never have to worry about throttling the maximum brightness via the JSON configuration file (and decreasing brightness ceiling means loss of color depth).
Now that overall system power parameters are taken into account, you must account for ampacity. Since LEDs are low-voltage high-current devices, wire gauge becomes quite important. Ampacity is essentially the capacity to handle current. In wiring, this comes down to two main factors: material and gauge. Since most wiring is going to be copper, gauge becomes the main variable. A quick Google of "ampacity chart" will show you a material at a temperature and it's ampere handling capacity at a certain gauge. Given that our system needs 10A we need at least a 16 gauge wire of copper, with 14 gauge being a better option.
I had some 12-gauge speaker wire around so that was what I used to have even more of a security blanket. This gauge is only really needed for the connection from our power to a branch or splitter (because that amperage will get divided amongst the three strands). For the smaller connections you will need at least 22-gauge (5A handling).
The rest of the system is very very nominal in power usage compared to the LEDs. The Pi with N wireless dongle, and Fadecandy will peak at 1A, but mostly float around half of that.
This allowed me to purchase a solid 5V 10A switching power supply that would be able to power the whole system.
In total the system using 180 LEDs ends up being about the equivalent of a 60W incandescent bulb!!!
Step 7: Enclosure for Pi and Power Electronics
Since this project is going to be subject to some dusty conditions, I wanted to make sure some of the main components were housed away in an enclosure. I wanted to enclosure to be mostly sealed when it was not being used, but still be able to access the Pi as well as the electrical connections (most important being the DC Jack allowing the power plug for the LEDs) in case something had to be replaced or adjusted.
The most suitable box I had around was my old elementary school pencil box. I laid out my electronics including the Pi to make sure it would all fit and not be a cable mess to deal with later, and it was quite perfect.
I melted a hold in the side of the pencil box (very carefully) until it very snugly fit the DC panel jack.
Next step is to figure out the polarity of your DC jack. To do this you will also need your power supply because that will have polarity information printed on it, specifically if the inside tip or sleeve is positive. The picture will help you determine which is correct. Once known, go ahead and plug in the power supply to the DC jack and get your DVM on "Diode" or "Continuity" mode. You will want the postive probe at the tip if your tip is listed as postive, or the negative probe at the tip if it is negative. Then, whether your DC jack has 2 or 3 prongs, you will want to touch the other probe to the other connection(s) and wait for the DVM to make it's continuity beep sound. This will tell you which other prong your capacitor will go to (if the tip inside is negative this is your positive prong/if the tip is positive this is your negative prong on the DC jack).
Next up is soldering a big ol' capacitor to these two prongs. This capacitor helps mitigate some electrical problems that arise when a lot of current is going around a project. It acts as a low-pass filter to fast voltage spikes (as it takes time for the capacitor to charge and discharge given a change in voltage). Since the polarity matters in this case, an electrolytic capacitor was used.
You will want that short leg to go to your negative prong on the DC jack with the long one going to the positive. Since my DC jack openings to loop wire through were small, I went ahead and cut out some of the 12-gauge wiring for each the positive and negative terminal so that I could solder both the capacitor and leads at the same time. Be extra cautious here not get accidently short this connection because this is where the most power will be flowing through and 10A is not something you want to mess with.
To distribute the power out to each LED strand, I found these cute 5 wire distribution blocks on Adafruit's site that have been great. All the wires just go into the little openings and you snap the connection closed. They are rated to handle up to 32A, are tiny, and can handle between 12-gauge and 18-gauge wiring. This made life a little easier than branching out and soldering a single cable into 3 seperate lines (twice over: ground and positive), and they are easily reusable.
I got the snappale terminal blocks from Adafruit.
Step 8: LED Strip Preparation
Most LED strip manufacturers have their strips come in 5-meter sections so more than likely you will need to do some prep work to get your LED strips in the configuration you want.
The WS2801 LED strips can be cut after every LED and the 1-meter sections are soldered together from the factory at 1 meter intervals. I used angled wire-cutters to cut into the silicone strip covers (being careful not to cut the strips). I cut back about 0.5" from the end on the top side so that I would have room to solder the connections.
To get it into the 3 separate 2-meter strips I wanted, I had to cut out 2 2-meter sections from the 5 meter section I got, then solder the remaining 2 1-meter sections together. You will want to make sure you have the data arrow at your input side going down the strip (as that is the direction data will go, and will not work properly otherwise).
Adafruit recommends a 470 Ω resistor soldered to the data input of each LED strip. This reason for this resistor is exaplained by transmission line theory. When the input and output of a transmission line are not perfectly matched, a standing wave forms from not quite all the signal's power transferring to the destination. This excess power reflects back down the transmission line towards the input and can then continue to do so over and over until that possibly small reflection snowballs causing "ringing". Ringing is an oscillation of what should be a constant value, which can lead to misinterpreted edge-detection (as digital wants either 1 or 0) and thus unexpected circuit behavior. The resistor helps match the impedance brought about by the resistance of copper traces over a length (as well as the logic impedance mismatch), and forms a voltage divide that helps suppress the ringing phenomenon.
Step 9: JST Connectors
To make the system all modular and have it able to be taken apart, JST 3-pin connectors are used. The 3 pins are for the positive voltage, data, and ground to the strips.
~ There will need to be one on each LED strip so it can be disconnected (3 for my project):
- Keep male end of connectors on LED strip side. Charge accumulates at the points, and you want that away from the power side of the circuit (Especially with high amperage circuits).
- Make sure you orient all the connectors the same way relative to the input side of your LED array.
- You Don't Want To Reverse Power & Ground accidentally because one connector is always backwards. Integrated Circuits usually can sink more current than they can source (absorb more than they can put out) and are better at handling the power spikes in that sink direction better. You are guaranteeing things don't go in that better protection haha (Insert South Park 'Yer gunna have a bad time').
- I also wanted to be able to detach and use the Fadecandy controller / driver with another system in the future (multiple Fadecandy controllers for lots and lots of pretty lights). This added 2 more JST 3-pin connectors for ground and for data split from Fadecandy.
- Adding these allow the wiring harnesses to be modular (unplug JST connector, get power lines out of snapable distribution block and your wiring harness is freeeee and transportable).
** 5 JSTConnectors male / female pair for my 3 strip project so far (1 for power; 1 for ground; 3 for 3 LED strips )
Step 10: Soldering All Those Connections
This is probably the most labor intensive part of this project (the exception maybe being time to get effects that look great out of the Python program).
Note: You must prepare your heat-shrink tubing now if you want to use that as I did in the pictures (cannot add that on once your pretty connections are all soldered together!)
Also Note: Method used for connecting two separate wires well pre-solder. It is called a "lineman splice". Google that fun and use that forever. It makes for nice rugged connections that are hard enough to pull apart pre-solder let alone post!
***EXAPAND HERE****
Connections to be soldered:
Fadecandy GND of each channel being used (each channel can have up to 64 LEDs) -> JST 3-pin connector
JST 3-pin from Fadecandy GND to 12-gauge (12-gauge gets snapped into distribution block)
Fadecandy data ->JST 3-pin
JST 3-pin from data to 3 seperate 22-gauge (in this range at least: 18-24awg) runs that have to be as long as you want the LEDs away from the enclosure. Try to keep it as short as possible. I have seen complications arise with data not being transmitted right once the person got past about 6 feet.
Then each LED strip will need:
470 Ω resistor -> data input
3-Pin JST -> resistor, with other two wires going to
->positive and
-> ground
And finally you want 12-gauge runs (equal to length of data cable)
For actually shrinking the heat shrink I had to use a hair dryer. A craft dryer works much better.
Step 11: Silicone Sealant and Zip-ties
As a step to give the LEDs a bit more weather-proofing, I sealed as much as I could off with Permatex 66B silicone sealant. I have used with before on car firewalls to seal holes that were drilled for electronics coming from the battery so I knew this would be alright with electronics. I, as smoothly as possible, filled any open gaps in the LED strips with the sealant and clamped down the strips (GENTLY!) in a vice to hold it until it dried. The less you have to much around the sealant the clearer it will come out. I generally waited 12 hrs to be safe on them drying perfect. Excess sealant was cut off after it was all dried.
I did this to each strip end, each strips that was soldered together needed it in the middle, and also around each input. While I obviously advice against it, I have seen someone spill a drink on my electronics and have it not die so this is a very very very good idea to do. I especially needed it for not getting dust into the strips. I also went ahead and used zipties every 8 inches or so (also cut off the extra pull tab) on all the wiring harnesses to keep the positive, ground, and data lines all together and pretty. ***INSERT PICTURE OF WIRING HARNESS***
Step 12: Obtaining and Using TouchOSC App + TouchOSC Editor
So TouchOSC uses Open Sound Control (OSC) messages along with a controller editor to allow a person to make a custom controller that can communicate with any device the is OSC enabled. OSC is a protocol using the power of modern networking with electronic multimedia/musical devices allowing for an easy-to-implement universal control language. Essentially, interfacing a litany of devices can be made a lot more simple via OSC.
TouchOSC is extra powerful because it takes advantage of data input streams already programmed/hardwired into your phone (multi-touch screen to allow multiple simultaneous button presses; accelerometer). It also comes with a very easy to use Editor allowing completely customizable input and has pretty much any input device you can think of (xy-pad, fader, toggle button, hold button, rotary fader, multi button array, and a few more).
The editor can be found on TouchOSC's website under the downloads section on the landing page. It is quite small and does not need to install to run (at on windows it does not).
The screen size of the controller is customized to the size of your phone's resolution (a quick google search revealed that my iPhone 5s was at 640×1136pixels). You can then input devices to the controller by right-clicking and selecting the input you want. Once on the screen, the input device can be moved and resized to your liking. Labels can be added to organize everything. I also like adding in a battery meter to make sure my remote (phone) is not about to die. Multiple pages can be made as well by right-clicking the grey top bar and selecting "Add Page" for up to 6 pages, I believe.
Step 13: Installing Python and PyOSC on Pi
I decided on using Python for this because there is an awesome utility called PyOSC that helps setup an OSC client server between the Fadecandy and TouchOSC allowing for a python program to handle input from TouchOSC and output to the LED strips that we oh so want to twinkle and flash.
First you have to make sure to download Python onto the Pi so that we can write and execute Python programs.Type the following into command to get the latest python version (make sure you do not need older version for other stuff, if you do you will need to Google "python virtualenv" to make a segregated python environment):
sudo apt-get install python3
Once that is done reboot with:
sudo reboot
Once rebooted we need to install PyOSC:
cd /tmp
git clone git://gitorious.org/pyosc/devel.git
cd devel
sudo ./setup.py install
This changes the directory to a temporary download folder, clones the github repository for PyOSC into that folder, accesses the devel folder from that download that has an executable install file, and finally installs it. Now that PyOSC is installed and all the Fadecandy client-server shenaniganry is setup, we can finally get to how our python program is going to look!
Step 14: Python Program to Control LED Strip
What does the Python Program needs to do, now?
Setup the OPC client (to communicate with our Fadecandy board)
Setup OSC server (to receive input from TouchOSC app via Wifi connected phone)
Setup some variables to store the current system values that can be used by all functions I did this with global variables successfully, but I am not sure if this is the best practice.
Be able to detect relative-to-human-reaction-time fast asynchronous input (input coming at non periodic intervals making your overall Python program structure need to check to input as often as possible)
Store the incoming OSC message from TouchOSC into a character array
Parse the array for OSC data (channel name, attribute name, and attribute range; Customizable in TouchOSC Editor in the properties menu on left)
Store parsed data into temporary function variables
Stores temporary function value into the relevant global variable (program gets a new OSC message; I moved a fader, it is now at a value of 10; the fader was on page 1, and is called "redfader" so I need to update my global variable pixelcolorred (or whatever descriptive name you want). The global variable was the heuristic approach. I am using it because I can easily see what function is messing with it because of the parsed osc message. I understand it is a dangerous variable because everything can access it and edit it, but that is what was kind of the way I saw the program working.
Startup in a main loop at an initial mode in a while loop (like channels on a tv). This is the default landing mode that will be the first "effect" the LED array starts to run when the Python program starts up (which will be on boot)
Be able to switch out of that mode's effect while-loop fast enough to not notice lag
The program constantly is asking the client if any new OSC messages have been received. Any change to any of the TouchOSC controls will send the relevant OSC message that will be detected at every line the program uses:
server.handle_request()
Once a mode change is detected (via similar functionality to the example of the fader change being detected) the program will break from the prior while loop, go through the list while loops until it finds the proper mode's loop, and run that until another mode change is detected. I tried to organize the modes into functions instead of nest them all in the main run-time loop, but then it got a little more complicated / cluttered using the server.handle_request() function inside of the other function, and I did not quite want to deal with that.
I do not want to get too specific here because that is where the creativity comes in, along with some Python experience that I cannot fully get into. (I do plan to edit in some of the OPC and OSC setup in Python) but some great starter resources can be found here:
https://www.instructables.com/id/R-Pi-control-Andro...
Some helpful utilities can be found in:
- Math library (absolute value)
- time (good for another random variable that is linearly progressing)
- random (generate pseudo-random value)
- color_utils (some clamping functions locking a mix and max, remapping ranges, and other useful functions pertaining to LED control) and comes from Open Pixel Control Python libraries added on
Step 15: AutoBoot Your Python Program
First make sure your Python program has been tested well and runs the way you expect.
The next step is to setup your rc.local file to autorun your python program in the background of the OS once the Raspberry Pi boots (no need to login; no need to have computer if your Python program works alright!)
Get to the Raspberry Pi's command prompt, and type:
sudo nano /etc/rc.local
This is the file that gets run after the Pi boots up and Python programs can be run, and we actually edited it already in this guide before with the Fadecandy server autorunning at startup. Here is the line of code I added after the Fadecandy (Fadecandy has to load before our LEDs will work anyways), and BEFORE the "exit 0" line:
(sleep 5; python yourprogramsname.py)&
You will want to use the "Write Out" option to save the text. Once that is done, exit the file back to terminal / command prompt, and reboot to see if your program autoruns:
sudo reboot
If you have the python program setup right it should autoboot and run. It is smart to include print messages in the Python code to terminal for debugging initially.
Step 16: Get Creative and Some Credit.
I have gotten the TouchOSC remote to pretty much do whatever I can think using the available Python utilities and help from all the great sites like instructables, adafruit, github, scanlime.
Here is some functionality demonstrated:
Some awesome sources of inspiration and shamanistic wisdom:
Adafruit (forum, components retailer, and learning hub):
http://www.adafruit.com/
Designer of Fadecandy (Micah Scott's Projects):
http://scanlime.org/
Fadecandy example code and other helpful documentation:
https://github.com/scanlime/fadecandy
Host of all this fun info:
https://www.instructables.com/
TouchOSC:
http://hexler.net/software/touchosc
Apple Store:
http://store.apple.com/
Droid Store:
https://play.google.com/store/apps
OPC (Open Pixel Control):
http://openpixelcontrol.org/
OSC (Open Sound Control):
http://opensoundcontrol.org/