Introduction: Interactive, Open Source Mood Light
This instructable will go through how to make an interactive, multi-function mood light. The core of this project is the BlinkM I2C RGB LED. As I was browsing the web one day, the BlinkM caught my attention, and I just thought that was way too cool to pass of. So, a couple of months later, I decided I'd make some sort of mood light using it. And here it is!
Step 1: What You'll Need
- The light source:
- The controller:
- Housing:
- Power/Connectors:
- Components:
- LM741 Op-Amp
- Electret Microhone (3-lead)
- 2.2k resistor
- 100k resisor
- 200k resistor
- 0.47uf electrolytic capacitor
- 0.047uf ceramic capacitor
- 2x 10k resistors
- Diode
For the 'tap' sensor, you will only need:
- Piezo element (you can salvage this from certain electronic toys, telephones, and many other electronic devices that beep, or you can get it from mouser, radioshack, etc.).
- 1M resistor
...And for the light sensor you'll need:
- CdS cell (LDR), preferably a very large one (more resolution).
- 10K resistor
- 3-pin header & crimped connector wires (optional)
- Other
Alternatively, you could use a homebrew development board to support the ATmega168 micro, and use a DIP-style ATmega168 (the long one with the larger leads). I'm not sure how well that would fit but it is certainly worth a try. If you don't own/have the money for a breadboard, you can solder down a regular ATmega168 to a PCB and add the regulator, programming connections, etc.
Step 2: Prep the 'touch Light'
First, we need to make the cheap-o 'touch light' we got at home depot mood light-friendly.
First, flip the light over and remove the battery cover and screws. Inside the battery compartment, you'll see the lightbulb fixture. Take it out, and discard it and the lightbulb.
Next, open the casing. Now we need to deal with the power. Remove the piece of metal in the center of the battery compartment as well as the wire that connects it to one of the battery contacts. Solder wires onto the battery contacts as shown. You may also want to label them if you don't have differently colored wire.
We also are going to make this mood light operable via a wall outlet transformer. Drill a hole using a drill bit about the same size as the diameter of the DC power jack. Then screw it in until it is flush with the casing.
The last modification we need to make here is to add the piezo tap sensor. It is best to mount it on the plastic 'rim' for better sensitivity. I have it pictured later in this instructable mounted elsewhere, but that's only because I have had to open and close the casing during testing so much that the wires started to break. Simply hot glue it to the plastic, but make sure it does not hinder the mechanical movement on the movabke dome! (i.e. do not let it stick out too much).
Step 3: Add Power Circuit Protection
This part is a simple add-on that uses diodes to protect the wall transformer/batteries from getting fried if you have the batteries installed at the same time you use the DC power jack. You can use any blocking diodes as long as the maximum voltage rating for them is higher than the rating of the wall transformer. The part labeled 'VIN' in the unregulated power strip on the breadboard (which goes to VIN on the arduino). The part labeled 'DCPower' is the DC power jack. For some reason, the program I used to make this schematic was really picky about labels, so that's what it let me name it.
NOTE: If you don't make this circuit, you will NOT be able to keep the batteries in the battery compartment at the same time you have the mood light plugged in to the wall transformer, otherwise it will damage it.
Step 4: Add the Breadboard, Arduino, and BlinkM
Now glue down (I used hot glue) the breadboard on top of the battery compartment. Luckily for us, it happens to fit perfectly.
Now plug in the positive (+) and negative (-) wires from step 2 into one of the breadboard's positive and negative power strips.
Now we can connect the arduino and the blinkm together. Here's the pin connections:
- A5 - Clock (labeled 'c' on the BlinkM)
- A4 - Data (labeled 'd' on the BlinkM)
Step 5: The Sensors - Sound, Tap, and Light
Next in line are the sensors. The light sensor is the simplest to construct. The wire going off to the right connects to the arduino. More info on WHICH pins the sensors connect to is in the next step.
The sound sensor is a little bit harder, but not ridiculously complex. PLEASE NOTE: I have not shown a voltage divider circuit here. The 2.5V in the schematic has to be provided via something called a 'voltage divider'. It is a very, very simple circuit consisting of multiple fixed resistors, or a pot (potentiometer). Use a 50K pot for this circuit. Google 'voltage divider' and look at the wikipedia entry for help on constructing one.
EDIT 9/27/08: I ditched this sound circuit and instead used one salvaged from a sound-activated light-up pendant. The circuit here doesn't work to well; I'm not sure why, but the design is flawed ;something is not quite right. I noticed the circuit from the pendant uses an SMD LM386 op-amp. I just soldered before the resistors going to the LEDs, VCC, and GND. Then all I had to do was manipulate the values in the software a little, and presto! better working sound-responsive mood light.
At the current time, the video of the light pulsating to music is when the original circuit was used. Maybe I'll upload another showing the improved design (it looks more like it's responding to the music due to the new circuit).
I was unsure how to solder the piezo element, so I guessed and soldered it as shown. It works, though. The polarity of the piezo does not matter. The resistor is on the breadboard (not shown).
Another IMPORTANT NOTE: The values for these circuits WILL differ from yours, so you WILL need to do some tweaking in the code. If you have any questions on these values, feel free to let me know.
Step 6: Find Space for the Sensors, and Connect It All
All the connections are:
- Pin A6: Sound sensor - NOTE: for non arduino nano users, other arduino's don't have a 7th analog pin. You will have to change this in the code.
- Pin A3: Piezo sensor (tap sensor)
- Pin A0: Light sensor
Step 7: Test It
Make sure that the power connections are good; plug it in using the power adapter, and try it using batteries. A common problem is poor connections to positive and ground.
NOTE: I know that the picture doesn't show the light sensor; I just took it before I added that part.
Step 8: Program It, Close It Up, & Use It
If you want to view the code but don't have the arduino software, you can open it with a word processing program (aka wordpad for windows users).
Ideas for new functions are welcome. Please feel free to post them; I want to make this open-source. The aim of the way I structured the code is so new functions can be added easily. Some of the functions are programmed into the BlinkM by the manufacturer (ThingM), but two of them I have made; 'Sound Light' and 'Mimic Light'. Right now it has the following:
- Mood Light - Slowly fades to random colors
- Candle - Flickers like a candle with oranges and yellows
- Water Reflections - 'Shimmers' with blues, turquoises, and cyan colors
- Seasonal Colors - Turns seasonal colors (I think they are blue, green, purple, and orange)
- Thunderstorm - Flashes occasionally simulating lightning
- Stop Light - Turns from red to yellow to green and back again
- Mimic Light - Records a sequence of up to 50 on/off cycles of light (you can use a flashlight), 'memorizes' the on/off times, and then plays them back in a never ending loop.
- Sound Light - Pulsates to the sound of music
Now comes the hard part. In order to close the mood light enclosure, you have to take a few careful steps.
First, you have to line up the support springs with the small tabs on the plastic dome. Since the DC power jack is on the rim, and the wires go to the breadboard , you have to slip the plastic dome over those wires FIRST, then line up the outer rim's screw columns with the indentations on the plastic dome. Make sure all the tabs line up with the placement of the support springs, which also correspond with the screw columns on the rim, and the srew holes on the base plate. Then, once you're sure everything lines up, snap the outer rim down onto the base plate. Next, make sure no wires are stuck in the springs, or are in a place where they may in the future. This would hinder the movement of the plastic dome. Lastly, replace the screws and enjoy!
Final notes: IMPORTANT: do NOT use batteries and plug in the wall adapter at the same time. I'm not sure what will happen but I'm sure it will destroy everything connected to the power!!
Attachments
Step 9: EXTRAS
This is of the 6 pre-programmed functions built into the BlinkM:
...This one is the custom sound/music responsive code I added (can you guess what song it is...?:
...And finally, but definitely not least, is the coolest (I think), and hardest function to make of them all; the 'mimic light' function:
7 Comments
14 years ago on Introduction
COoOOL DO you have a total cost estimate, I don't think I saw one.
Reply 14 years ago on Introduction
Well, if you already had some things such as the arduino (or just the microcontroller with voltage regulator, ICSP, indicator lights, etc) and the breadboard, it would cost you about $30. Generally speaking, if you had most of the common components needed to make this mood light, you could get away with spending less than $50 on the whole thing. But if you had none of the parts needed to make it (arduino/atmega168,most/ all bare components, the breadboard, blinkm, wall adapter) then you might end up spending up to $80. Does that help? I should probably add that in...
Reply 14 years ago on Introduction
Do we really have to use this exact type of LED ? Would it be possible to adapt this to Luxeon LEDs ? Cause I have some laying around...
Reply 14 years ago on Introduction
Yes. But it would probably make the code 5x as long, require 5x more work, and would be 5x as hard. Remember, the BlinkM isn't just an LED, it's an SMD microcontroller ATTACHED to an LED, and it already 'knows' all the fading sequences. Although, it WOULD be very easy to adapt the two functions I programmed myself using your luxeon LED's, because the only color being used is white.
14 years ago on Introduction
Amazing! This looks like great! Very detailed instructions! 5 stars! The only thing I would like to see is a video of the end result. Other then that, Great Instructable! -Joe
Reply 14 years ago on Introduction
Videos? Done.
Reply 14 years ago on Introduction
Great! Looks really nice! I would love to build one and stick it next to a strobe light haha.