For our Electronics Final Project, we built an interactive mood lamp, which builds off of a previous project (see https://www.instructables.com/id/Interactive-Mood-... for a version 1), but is different in that the user can interact with the lamp via bluetooth! Who needs a potentiometer when you can just sync up your lamp to your android or iOS device?

Step 1: Gather Materials


▢ Arduino UNO or similar.

▢ 12v, 2 amp wall adapter.

▢ LED Engin 10W RGB LED

▢ 4 x 10W rated resistors: 1x15 ohm, 3 x 12 ohm.

▢ 4 x TIP120 Darlington transistors.

▢ 4 x TIP120 heatsinks.

▢ 80 by 100 mm perf board.

▢ 64 by 82 mm perf board.


▢ Adafruit nRF8001 Bluefruit LE Breakout Board (https://www.adafruit.com/product/1697)


▢ 8" x 7 3/4" x 3/8" Aluminum sheet

▢ 8" Acrylic Display Cube

▢ 4" Acrylic half-dome

▢ Roughly 25 feet of wire (we used 24 gauge)

▢ 440 screws of various lengths (used to secure perfboards to the lampshade housing)

▢ 8" x 7 3/4" x 3/8" four pieces of wood used for the lamp base

Step 2: Construct the Housing

This lamp consists of an 8 inch cube made of frosted acrylic that is screwed onto a square sheet of aluminum. This aluminum heat sink houses all of the electrical components and is attached to a wood base with silicone paste. There are also acrylic light diffusers inside the cube as you can see in the image.

We first cut the five panels for the cube using Adobe Illustrator and a laser cutter. There are three 8x8 inch panels and two 7.75x8 inch panels to compensate for the thickness of the acrylic; these dimensions ensure that the final lamp is a perfect cube. With all of the pieces cut, we glued them together and after the glue cured, we sandblasted the acrylic to achieve a frosted finish on the exterior. Similarly we made two nesting cylinders of acrylic and frosted these to serve as light diffusers for the LED.

We cut a 7.75 inch square of aluminum with 5/16 inch thickness to act as heat diffuser as the LED is 10 watts and gets HOT. We tapped holes in the aluminum to attach perfboards, resistors, the arduino and other electrical components (see the image of circuitry).

Lastly we built a square wooden base, sanded it and painted it with black spray paint. The main function of the base is aesthetic as it conceals the ugly electrical components and yields a sleek finished project. We attached the aluminum/acrylic housing to the wooden base using silicone paste. Silicone works well because it is semi-permanent but can also be removed with a razor if we need to access inner components.

Step 3: Design & Construct the Circuit

Adafruit (the company that manufactures the Bluetooth chip we used) provides some source code and a recommended pinout. We basically made all of the connections in accordance with this provided pinout, the details of which are available in the circuit diagram provided.

How you choose to set up your circuit is a matter of preference, but the foundation of the circuit is as follows. The three main modules here are the arduino, the bluetooth chip, and the LED. The RGBW LED package we used comes with a heatsink base (see materials section). You provide 12 volts to each LED in the package along with a power resistor. After the LED package, the current from each LED goes into the collector of a Darlington TIP120 transistor. The emitters of all the transistors are then grounded. The Darlingtons act as switches so that when they are powered (by the arduino), current can flow and the LED comes on. When the Darlington is off, current cannot flow and the LED is off. Using pulse width modulation (PWM) pins on the arduino, we can control the time average of the intensity of each LED, effectively changing the color of the lamp.

The specifics of the connections between the LED and the arduino are arbitrary and depend on how you write your code. We provided our pinout that works with our sketch.

The bluetooth nRF8001 chip connects to the arduino as well and the details of these connections are provided in the circuit diagram. Also we should note that where it says 12 volts in the diagram, this is provided by a common power source provided by a wall adapter that powers the whole lamp.

Step 4: Download the BlueFruit App

In order to get the lamp to work with the adafruit breakout board, you must download the adafruit app called "Bluefruit LE." The app is available for iOS devices and androids, and can be downloaded on iTunes. If you are using an iOS device, this app will only work for iPhones and iPads.

Once you have downloaded the app, you must turn on your device’s bluetooth, which can be found in settings. Plug in your lamp’s power supply, and begin to scan for peripherals in the Bluefruit app. You should find an option that says “UART.” This is your BLE Breakout Board!

When you connect to the Breakout Board, you will have the option to choose in which way you want to connect. This will depend on your coding options. Below is a small description about what each option does:

Info: This option provides general information about the Breakout Board.

Pin I/O : This option allows you to change the input and output of your arduino pins. If you remember from before we had our pins: R=3, B= 5, G=6, and W=4. Since the RBG pins are PWM pins, you can set these pins as input, output, or PWM. Since they are the LEDs, it is best to set this to PWM. You can then use the slider to change how bright each LED is.

UART: You can use this option to link your computer’s serial monitor with the app. In this option, you can send messages as either HEX or ASCII back and forth from the computer to the phone. You can use this to send text messages if you really wanted!

Controller: The main option that we used for the lamp was the controller method. Inside the controller option, there are tons of different options. The controller app uses the iOS’ or androids’ embedded accelerometer, magnetometer, gyroscope, quaternion, and location detection to gather data about the phone. We will use some of these functions later. Additionally, the controller option has two other choices at the bottom: the Control Pad and the Color Picker. We use both of these to program the lamp’s functions. The Control Pad has a series of eight buttons (four numbers and four arrows), which can each be controlled separately to perform different functions. The Color Picker allows the user to select any color on the color wheel, and send the data to the LED pins to alter the color of the lamp manually.

Step 5: Build & Modify the Bluetooth Code

For this project, we primarily did not use the Pin I/O or UART options. We used entirely the Controller option, and the items within that to program the LEDs.

The Gyro: Based on the position of the phone, the LEDs change color (x-axis: Red, y-axis: Green, z-axis: Blue). Note that the gyro measures the change in the phone's position; not just its overall position. If you want the color of the LEDs to last, more work needs to be done to the code under the gyro method in the loop.

The Magnetometer: This method changes the LEDs based on the surrounding magnetic field to the phone (super cool with magnets!).

The #1 Button: This is the "campfire mode," which changes the color of the LEDs from a range of bright oranges, yellows, and reds quickly, to simulate a campfire.

The #2 Button: This is the "Random Color Mode," which changes the color of the LEDs randomly every second.

The #3 Button: This is the "Rave Mode," which quickly changes the colors between RGB to simulate strobe lights.

The #4 Button: This is the "Purple Mode," which is supposed to fade between different shades of purple, but is currently broken, and so only displays one color.

The Color Picker: This allows the user to manually change the color of the LEDs by selecting a color on a color wheel, and hitting send.

For more information, see below:

BLE Breakout Board Intro Guide: https://learn.adafruit.com/getting-started-with-th... (NOTE: The Firmata code mentioned in this guide DOES NOT WORK FOR THE nRF8001 Breakout Board! For the correct Firmata code, see the comment section on the Firmata github page linked in the guide).

BLE Firmata information: http://redbearlab.squarespace.com/bleshield/ (For more information on the Firmata code).

Wow that's amazing
<p>I love the different colors! It would be great at a wedding reception to set the mood!</p>

About This Instructable




More by gmehta95:Interactive Bluetooth Mood Lamp 
Add instructable to: