Step 4: The Fun Part

The Android phone is controlling an LED strip hidden in the vase using a IOIO board with Bluetooth. In this example, the Android phone is running an app which obtains color values from the onboard camera and then in turn matches those colors to the LED strip. We (myself and Ytai) sort of ran out of time on this project but with the sample code, it can easily be expanded to do other things. Here's a few ideas we didn't get to:

Using the phone accelerometer to change the color patterns, a shake event for example
Displaying a pattern when receiving a text
Displaying a pattern when receiving a phone call
Displaying a pattern when a friend if nearby via social networking
Displaying a pattern on specific Twitter keywords

IOIO is a physical computing platform for the Android platform, kind of like Arduino but dedicated to Android and features a small form factor with Bluetooth capability leveraging off the shelf & inexpensive Bluetooth dongles. IOIO was created by Ytai Ben-Tsvi who was my partner on this project, actually Ytai did all the work. I've done a few Arduino projects in the past that also required a PC for the graphical & rich internet application capabilities, it was nice see how one can get rid of the PC and yet still retain these rich capabilities leveraging the Android platform. This opens up many new application possibilities for hobbyists.

The LED strip is digitally addressable meaning each LED (32 in the strip) can be controlled individually. That combined with the Bluetooth IOIO and Android opens up endless interactive lighting schemes.

* Android 2.3.3 and above required for Bluetooth
Android 2.1 to 2.3.2 will support Bluetooth but you'll need to enter the Bluetooth pairing pin on every connection
Android 1.5 and above can use a USB cable connection as opposed to Bluetooth. For USB connections, the "USB debugging" setting (also known as ADB) must be turned on in your Android phone, you'll find this setting under "Settings", "Applications", and "Development".

Step 1: Wiring

The wiring is pretty easy. First and this is very important, look for the connector on the LED strip with an arrow (see the pictures), it should be the strip end with one connector as opposed to the strip end with two connectors. That is the end of the LED strip where you'll connect the 4 wires per the schematic below. The other end of the LED strip (with two connectors) also has a similar connector but you'd use that to daisy chain another LED strip. In this particular case, we're only using one LED strip so we don't need this connector. If this is the case for you, then you can save yourself some time by cutting off that connector (female) and then plugging it into the single connector end (male) and then wire to the IOIO board.

Outside of the DC power source which go to the VIN and GND pins on the IOIO (DC power between 5V and 15V), you'll only need to connect 4 wires on the LED strip to the IOIO.

Step 2: Quick Test Before Installation

Do a quick test to ensure the LED strip can be controlled by the Android device. Connect the bluetooth dongle to the IOIO, power on, and then pair to your Android device. It will show up as "IOIO (address number)" in the bluetooth discovery screen. Select it and then enter "4545" for the pairing code.

Then install the Holidays IOIO app for this project and see if the LED strip lights up. Make sure the camera on your phone is not facing down so it's picking up some colors.

Step 3: Installation

With the electronics working, now it's time to install the LED strip in your form factor of choice and also hide the IOIO board somewhere in there. If it's a permanent installation, then you'll want to solder the wires from the LED strip directly to the IOIO board or if it's temporary, then solder some header pins on your IOIO board and connect to the LED strip using jumper cables.

The LED strip has an adhesive backing so you can just stick it on.

Step 4: The Fun Part

Now the fun part. Here's where you'll write the code to tell the Android phone how to control the LED strip. To make things easier, refer to the example code of this project and then just tweak for your needs, here's a direct link to the Android activity code (main body of code). The sky is the limit here in terms of interactive scenarios, anything you can get to with an Android phone becomes possible.

For the folks that know Arduino, coding Android is a little more difficult but not too bad, you'll get the hang of it pretty quick. Here's the traditional "hello world" application for IOIO and Android. Read through the code along with the comments in Bold Italics and you'll get the gist.

/** * This is the main activity of the HelloIOIO example application. * * It displays a toggle button on the screen, which enables control of the * on-board LED. This example shows a very simple usage of the IOIO, by using * the {@link AbstractIOIOActivity} class. For a more advanced use case, see the * HelloIOIOPower example. */

/** * Called when the activity is first created. Here we normally initialize * our GUI. */

@Overridepublicvoid onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);//all Android app have this line, just make sure it's there and don't worry about it
setContentView(R.layout.main); //in Android, the screen layout comes from an XML file you specificy, main.xml here
button_ = (ToggleButton) findViewById(R.id.button);
}

/** * This is the thread on which all the IOIO activity happens. It will be run * every time the application is resumed and aborted when it is paused. The * method setup() will be called right after a connection with the IOIO has * been established (which might happen several times!). Then, loop() will * be called repetitively until the IOIO gets disconnected. */

/** * Called every time a connection with IOIO has been established. * Typically used to open pins. * * @throws ConnectionLostException * When IOIO connection is lost. * * @see ioio.lib.util.AbstractIOIOActivity.IOIOThread#setup() */

Has anyone had problems with these LED strips? I just received my second strip from Sparkfun thinking the first was bad but I'm finding the second one has the same behavior. I'm quite familiar with the IOIO... and followed this instructable... I also tried plugging in the LED's to an arduino and found the same behavior. The last (or maybe the 1st) LED (the one furthest away from the IOIO connection is the only one that lights, and it seems to cycle through the colors on that single LED only if I touch the end of the opposite connector. When the first strip began behaving this way, I thought there might be a bad connection or one of the chips was bad, so I cut and rewired a portion of it... and had the same behavior... so it is starting to seem like an issue with power or cycling through the LED's. Should all the LED's turn on as I connect to 5V supply and ground? If not, is there another simple way to check all the LED's in the strip before I get into the programming (although knowing Ytai, I trust the code Holiday IOIO app works fine)... I am trying to build this into something this week before the Greenbrae mini-maker Faire next weekend so any help would be GREATLY appreciated!

About This Instructable

Bio:With 20 years of experience in the IT industry, Al is currently Senior Director of Information Technology for a Fortune 500 company. Outside of his day job, Al is an active member in the open source ...read more »