Intro: Interactive Mood Lamp
In this Instructable, we will build a bright mood lamp, with an internal clock, microphone, and temperature sensor.
Through this sense of time, sound and temperature, the lamp is able to react by changing colors / brightness in response to its environment. This project uses an Arduino controlled, brilliant 10 watt RGB LED to really make the lamp capable of illuminating a whole room in vibrant color.
I really want this Instructable to get you thinking about what environmental information you can display as color - this project provides the basic hardware and software required for you to make a lamp with functionality that expresses your personality!
The design is intentionally modular - with the LED Drive Circuit and Power / Sensor Circuit constructed on separate boards. The temperature sensor plugs into a USB port that accepts any I2C sensor. One can easily swap in a barometer, light meter, hydrometer, accelerometer, so that the lamp can react to many more environmental characteristics.
This is a very flexible device and has lots of uses, for example:
1. Have the lamp wake you up at 8:00AM with a Sunrise Progression, going from dim red, to bright blue sky over a time period of 30 minutes.
2. Have the lamp respond to voices and ambient music at a party, becoming brighter as the noise gets louder.
3. Make the lamp a color clock, changing between random colors every minute or hour.
4. Have the lamp emulate firelight with a convincing amber flicker.
5. Have the lamp glow red in a hot room, or blue in a cold room. Warm the temperature sensor with your hand and watch the color swell from blue to green to red.
There are many more possibilities, only limited by your imagination.
That being said, let's get started!!!
Step 1: Gather Materials
THE LED DRIVE CIRCUIT
▢ Arduino UNO or similar.
▢ 12v, 2 amp wall adapter.
▢ LED Engin 10W RGB LED (http://www.mouser.com/ProductDetail/LED-Engin/LZ4-...
▢ 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.
THE SENSORS / INTERFACE
▢ TC74 I2C Temperature Sensor
▢ Adafruit Microphone.
▢ DS1307 Real Time Clock.
▢ 1k Potentiometer
▢ Female USB DIY kit
▢ Male USB DIY kit
▢ Extension cord On/Off switch.
▢ A nice knob for the potentiometer.
▢ Small brass rod for the temperature sensor
THE LAMPSHADE / HOUSING
▢ 12" x 12" x 3/8" Aluminum sheet
▢ 8" Acrylic Display Cube
▢ 4" Acrylic half-dome
▢ Small lengths of aluminum rod we used as feet for the lamp.
▢ Small furniture pads we put on the bottom of feet to keep it from scratching tables.
▢ Shrink Wrap
▢ Roughly 25 feet of wire (we used 24 gauge)
▢ 440 screws of various lengths (used to secure perfboards to the lampshade housing)
▢ Some washers
For our lamp, we used 3D printed parts, for the Feet, Control Knob Housing, Arduino Case, and more. It is not necessary to 3D print any parts for this project, although in our case it was easier than constructing the parts from existing materials.
Step 2: Construct the LED Drive Circuit
The LED Drive Circuit is the heart of the lamp - it allows the Arduino to switch the large currents necessary to power the LED. It features a beautiful 10W RGB LED, and resistors selected such that the color map is pure and flexible. It uses 4 TIP120 Darlington Transistors to switch the four channels of the LED.
The RGB LED is really a RGGB LED, meaning that it has 4 separate die. In this circuit, we can treat our RGGB led as four separate LEDS, each switched by their own pulse-width-modulated Arduino output. This means that we can control each channel (including the two identical green channels) independently, allowing for greater color control. On the LED star, each channel has its own input and its own ground. As one can see in the circuit diagram, we are drawing current from a 12v wall source, which we then route to 4 resistors that reduce the voltage to the proper input voltage for the LEDs. We solder the connections on the LED star, and then to 4 TIP120 darlington transistors, the gate of each is connected to the PWM Arduino outputs.
We have attached the 10W resistors to the aluminum body of the lamp for heat dissipation. It is recommended that you attach these resistors to some kind of heatsink regardless of your lamp design, as they do get very hot after a few minutes of lamp use. We have attached the 4 darlington transistors to a 80 by 100 mm perf board, and attached a small heatsink to each.
After this circuit is constructed, you will be able to turn on the LED to test each channel, if you have a power source.
Step 3: Construct the Power / Sensor Circuit
The Power / Sensor Circuit is where the Real Time Clock, Microphone, and USB port live. It also has the 12v plug that powers the whole lamp. There is a 12v bus, 5v bus, and ground bus. The RTC, Mic, Potentiometer and USB port live between 5v and ground, while the LED Drive Circuit lives between 12v and ground.
The Mic is an Adafruit electret microphone, the RTC is a DS1307 kit, and the temperature sensor is a TC74. Each sensor runs independently of the others, and each has a separate instructable on how to set them up. All the code needed to run them is included in this instructable in the code section.
https://learn.adafruit.com/piccolo (this demonstrates how to use the mic in a music visualizer project)
We put the entirety of this circuit on a 64 by 82 mm perfboard, with the RTC, battery, and Mic on the bottom (as pictured). The top of the board has the circuit connections, which will be hidden beneath the body of the lamp.
Step 4: Construct the Temperature Sensor
In order to be able to sense the temperature of a variety of different objects we wanted our temperature sensor on a short cable such that it could be moved around, placed in warm hands / beverages, ice cubes, and be really interacted with. The sensor plugs into the Power / Sensor Circuit via a USB port. This allows it to be easily removed for transport / swapped for other sensors.
To construct the sensor, we:
Gathered 4 x 3 foot lengths of 24 gauge wire.
Gathered the Male USB DIY kit
Gathered a short section of Brass Rod.
Gathered some shrink wrap and electrical tape.
Gathered the TC74 temperature sensor.
We stripped both ends of the lengths of wire, and soldered them to the TC74 and male USB kit. we then shrink-wrapped the bundle of wires to keep them neat. We slitted a short section of brass rod to accept the TC74, and glued it inside the slit. The brass rod makes the sensor easier to hold, and it transmits heat well!
Step 5: Construct the Control Knob
The Control Knob is the user's way of selecting the lamp mode. We're building a lamp that has a lot of different functions, so it makes sense to provide the user a convenient way to choose between them. At its heart is a 1k potentiometer, which we will put 5v across, and connect the sweeper to an analog input (A2). Based on the reading from A2, the code switches between various loops that control the lamp's functionality. This knob intentionally does not have discreet steps, so you can add as many modes as you like to the lamp. With increasing number of modes, the space on the dial for each mode decreases, and the harder it is to select a given mode, so keep that in mind...
To construct the knob, we gathered:
A 1k potentiometer
a 50mm x 50mm x 3mm piece of aluminum.
a nice knob
a 3d printed box
a paper template with tick marks (attached)
some shrink wrap
We soldered the 3 connections to the Power / Sensor circuit, and then soldered the potentiometer end of the connection. We applied shrink wrap to hold the 3 wires together. Then we attached the aluminum plate to the potentiometer, and attached the knob. We then snapped our 3D printed box onto the back of the knob to complete the assembly. The .stl file for the knob box is attached, and the GIF for the tics is attached too.
Step 6: Construct the Power Supply
The power supply converts the 120V AC power from the wall to 12V DC power needed for the lamp. The power supply is just an out of the box 12V 2A converter, all we did is add a nice on/off switch for our lamp.
Step 7: Construct the Lampshade / Aluminum Housing
This part of the Instructable is where we describe how the circuitry is housed and what kind of lampshade we chose for our LED. These are only suggestions, and there are many ways to house this circuitry / diffuse the light. For example, you could put this circuitry into an existing lamp to give it a classic feel. We chose a frosted cube as our overall aesthetic - but you can put the circuits in whatever housing you desire!
To construct our particular housing, we gathered:
Our 8" x 8" x 8" acrylic cube
Our 4" diameter craft globe
a 8.25" x 8.25" section of 3/8" thick aluminum.
a few 3D printed feet.
a 3D printed diffusing cap for the LED
some 440 screws
some washers (to use as spacers)
Mounting holes were drilled for both perfboards, and a hole was drilled a little off center so that the LED wires could be routed through the board. We routed our piece of aluminum such that the 8" cube snaps on top for a clean finish. We applied electrical tape to the bottom of the lamp, so that we could screw the perfboards into the lamp without worrying about unwanted electrical contact. The three removable diffusers were placed on top of the LED to spread out the light.
Step 8: Print / Buy the Arduino Case and Solder Connections
We slipped our Arduino into a case that we 3D printed, and then removed the temporary connectors in favor of headers, which we snapped into the Arduino. We then folded the arduino case onto the underside of the lamp.
At this point, the Lamp is physically complete, now we just need to load it up with some sweet software to make the lamp react to its environment!
Step 9: Load the Code
Here is some code that allows the lamp to react to temperature, sound, and play some preset color sequences to emulate firelight, a sunrise, a purple lava lamp, and more! Code for this lamp is very easy to write, use your own creativity to produce more modes, which you can access with the control knob!
After the appropriate libraries are installed and this code is loaded, the lamp will function as in the video! Enjoy!