Phone Controlled Mood Lighting

Introduction: Phone Controlled Mood Lighting

Dorm rooms are notorious for their dreadful lighting, so I wanted to make a cool alternative light source for my room at school. I made it phone controlled so there would be an easy and wireless way to change the color of the lighting.

The lighting consists of Tricolor LED Strips and are controlled by a phone through an app. The app is able communicate with the Arduino via bluetooth by using the Seeed Bluetooth Shield.

Step 2: Bluetooth Shield

Fit the bluetooth shield onto the Arduino.

Arrange the jumpers on the board like in the first photo above. The first jumper should be connected to digital pin 7 and BT_RX and the second jumper should be connected to digital pin 6 and BT_TX. The shield will not be able to act as the bluetooth slave if the jumpers are not connected properly.

Step 3: Arduino With Bluetooth

Load the following code onto the Arduino in order to set up your Arduino as the bluetooth slave:

If the bluetooth is working correctly, a red and a green LED will flash one after the other in sequence on the shield. If this does not start happening a few seconds after you load the code onto the Arduino, try power cycling the Arduino and reloading the code.

Step 4: Processing and Android

I used Processing to create an app for my Android device. It provides good documentation for use with Android and is perfectly adequate for a simplistic app like the one I created for this project. Its format is also similar to the Arduino software, which makes it easy to use. I used a PC running Windows 8 and I tested the App on a Samsung Galaxy SIII and a Nexus tablet.

For the most part, you should follow the wiki to set everything up, but I have also included my own instructions below. I have simplified parts that I think the wiki does a good job of explaining and have expanded on other parts. I have also added additional tips that I used to get mine to work. Not everything worked perfectly every step of the way, so be patient. I have tried to include everything I did to get things working whenever I hit a road block. Note: If you are using a Mac, not all of my instructions will apply to you and I suggest you more closely follow the wiki page.

Here is the link for the wiki page on Processing with the Android: http://wiki.processing.org/w/Android

USB Debugging Once you have installed Processing, the Android SDK, and all of the necessary platforms and packages, you will need to enable USB debugging on your device.

On my Samsung Galaxy S III, I went to Settings then Developer options then checked USB Debugging. On a Nexus tablet, go to Settings then About tablet then click Build number seven times to activate USB debugging.

USB Drivers If you haven't already, plug your phone into your computer and install USB drivers for your device. I was able to download everything for my phone from this site: http://developer.samsung.com/android/tools-sdks/Samsung-Andorid-USB-Driver-for-Windows This is only necessary if you are using a PC.

Running a sketch (first attempt) Open processing and switch from Standard mode to Android mode by clicking on the drop down menu on the top right corner of the window and selecting Android. To switch to Android mode, you may need to restart Processing after you have done this.

Copy and Paste the following code into your Processing sketch. This is a sketch that will turn the screen green if the Android device is able to find the Seeed Bluetooth and then turns purple once it has connected to the Seeed shield. The Android will also send the letter "a" to the Arduino's serial.

Have the Arduino's serial monitor open when you run the Android App so you be make sure that the two are communicating (Serial communication is how we will get the lighting to change later on). When you run the program, make sure you click "Run on Device." I bypassed running on a virtual device because I always had access to my phone and I decided it was more trouble than it was worth to get the virtual device working. The first time you run the program, it likely will not work correctly. Do not worry. That is the next step.

Edit Android Manifest.xml The Android Manifest only shows up after you have attempted to run the program once. It can be found in the folder containing the .pde file for your code. Edit Android Manifest.xml by adding the following two lines in between the second and third lines in the original manifest: <uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/> Reference the screenshot shown above to make sure you have it right.

Connect Now run the sketch again. Everything should work now. Open the Arduino's serial monitor to make sure it receives the letter "a" when the bluetooth is connected. If it does not, here are a few things you can try to get it to work properly: 1. Make sure that the Bluetooth shield is set up properly and the red and green lights are flashing when you run the Android program. 2. Run the App again on your device 3. Restart your Android Device 4. Restart your computer I got mine to work using some combination of these additional steps.

Important tip: Every time you reconnect the bluetooth, you should reset or power cycle the Arduino and close your App and reopen it.

Step 5: Cut Enclosure

Cut the attached pattern for the enclosure out of the plywood.

Cut out the attached pattern for the acrylic out of the acrylic sheet.

Step 6: LED Strips

Cut the LED strip into nine smaller strips with nine LEDs each. Be sure to cut each strip in the middle of the flat copper sections.

Note where the wires from the original strip are soldered. Every strip should have wires soldered to the same side. The strip should have arrows on it to help determine the correct direction.

For the strips that do not have wires already attached, cut away the plastic casing covering the flat copper areas and solder wires onto them. You should solder a red wire for Vin, a black wire for ground, and a green wire for pin 12.

Important: Your LED strips will only light up if you have the AC Adapter plugged into the Arduino. They require more power than the USB cable provides.

Step 7: Glue

Tape down the LED strips to the bottom of the enclosure with even spacing between them. When you're happy with how they're arranged, glue them in place with epoxy.

Step 8: Solder and Glue Some More

Solder the green wires of each of the LED strips to the PC board. All of them should be connected and an additional green wire should be soldered to connect to pin 12 on the Arduino.

Solder all of the red wires of the LED strips to the PC board. They should all be connected to one red wire that should connect to Vin on the Arduino.

Solder the black wire of the each LED strips to together on the PC board and attach an additional wire to go to ground on the Arduino.

Glue on the sides of the box.

Step 9: Power

Thread the wire of the AC adapter through the hole in the bottom your box. Plug the Adaptaplug into the AC adapter. The tip of the Adaptaplug should be facing the side of the AC adapter labeled "TIP." Plug the Adaptaplug into the Arduino.

Step 10: Incorporate LED Strips

Now that you connect to the Seeed Bluetooth shield on the Arduino and send characters, it is time to start controlling the LED strips.

Run the following sketch on the Arduino:

Run the following sketch on the Android device:

Once you have all of this code running, you should be able to press the buttons on the app to change the color of the LED strips. Note: If the phone is inactive for too long, you will lose bluetooth connection and you should close the app on your phone and unplug the light board. You can then plug in the board again and reopen the app and it should connect again.

Step 11: Drill

Line up the cut out acrylic sheet with the pattern on the top of the enclosure and mark with a pencil the location of the holes.

Drill pilot holes using the 3/32" drill bit where you made markings on your enclosure.

Screw the acrylic onto the top of the enclosure using the wood screws and two washers (to prevent the screws from going all the way through the wood).

Sorry for the late response! I guess It's a little late for the Christmas party, but you still could for New Year's ;D. I have not read up much on VPN, but from the little I just did, I suspect that this is safe to do. You are only using Processing with your android device and I have not read anything bad about that software. Although, I guess that you assume some risk using any software with your phone. I personally would not worry about it.