Introduction: Mood Vase
I'm a fan of LEDs, lots of LEDs. So here's a slightly less crass way of using LEDs for decorative purposes.
While this is by no means a neat and polished solution, and probably not the first of its kind, however the pulse effect is as far as I have seen unique, and exactly what I wanted. I hope that this will inspire others to create similar.
The set-up It consists of a plain, unmodified vase, and a small battery-powered unit that sits behind a vase and shines three LEDs to give some nice ambient color.
The circuit is powered by a microcontroller, in my case, a PIC12F683, I've included source code for the PIC12F683, but presumably it can easily be ported to Atmel or other microcontrollers.
I am writing this instructable for those with experience with circuits and microcontrollers, I am happy to answer any questions anybody has.
Step 1: The Circuit: Overview
The circuit can be split into 5 parts:
1. The brains - this will control the LEDs and produce the colours and pulses of light
2. The power - I use lithium-ion cells, but the circuit works perfectly well using 3AA or AAA batteries typically this will run the circuit from a week up to a month depending on battery.
3. Light detection - this is so that the circuit turns on only when dark
4. Voltage reference - this is needed for low-battery detection, for lithium-ion cells, this is important since over-discharging damages the cells. For AA or AAA batteries, this is less important.
The circuit diagram is below, there's also a PDF with the same diagram since the picture is a little small and blurry.
You will need:
- PIC12F683 or other microcontroller
- either 1x 18650 or 3x AA
- 220uF electrolytic capacitor (or any value larger than 1uF)
- 10k resistor + zener diode (or 1N4001, see later)
- 3x 150R resistor, 3x NPN transistors
- 3x high-intensity LEDs, 3x 20R resistor (see later)
- 40k resistor, phototransistor
Step 2: The Circuit: Part 1
1. The circuit is powered by a PIC12F683, which I favour for its small footprint (8-pin package). For this application, we don't need much more processing power than this very basic microcontroller.
One major advantage of this particular family of microcontollers is the fact that they can run off any voltage supply from 2V up to 5.5V, without the need for a regulator.
2. Therefore the power supply needs to be between 2V and 5.5V, you can either use 3 AA or AAA cells (3v - 4.5v), or a single lithium ion cell (3v - 4.2v). I used a 18650 lithium ion cell since I had a whole bunch lying around (you can find 8 cells in most laptop batteries).
Step 3: The Circuit: Part 2, Optional Parts
3. Light detection: Adding light detection allows the LEDs to only turn on when dark. This is achieved simply using a phototransistor and resistor. (Or a photodiode + transistor combo)
When light falls on the phototransistor, a current flows, pulling the voltage after the resistor down. The resistor needs to be sized so that there's a decent voltage swing between light and dark that the microcontroller can detect. I used a photodiode + transistor, with a 40k resistor.
4. Voltage reference: This allows for low-battery detection. For Alkaline AA or AAA cells, this is not important. For NiMH, NiCad and Li-ion cells, over-discharging them may cause damage. The PIC compares the voltage reference with battery voltage. And stops turning on the LED when the voltage is too low.
You can use either a zener diode, or failing that, a general purpose diode is sufficient. I used a 10k resistor and a 1N4001 diode.
Step 4: The Circuit: Part 3, LEDs!
I'm using high-intensity LEDs. Normally, LEDs need a resistor in series to limit the current and avoid damage. However, when a low enough voltage is applied, the current through the LED is low enough to avoid over-current.
In the case of the Blue and Green LED's, according to their datasheet, applying 4.2V (the maximum possible for my lithium-ion cell), the current was only 35mA, which is borderline. If you are using 3 Alkaline cells, a resistor is recommended.
In the case of the Red LED, a 20Ohm resistor is needed.
The LEDs are connected through transistors, since the PIC conly supplies a maximum of 25mA per pin.
If you are using less power-hungry LEDs, you could get away with connecting the LEDs directly to the pins of the microcontroller.
Step 5: Construction
For the enclosure, I'm using this 18650 holder from eBay. The battery holder is designed to hold one 18650 cell, and provide an output jack. Inside is plenty of space for the circuit.
- Cut out a piece of prototype board to fit whatever container you're using, and transfer across any battery contacts that you need.
- Mount the LEDs onto the container - I did this by drilling three holes and epoxying the LEDs in place after soldering some ribbon cable to their contacts.
- Then build the circuit. Unfortunately, I didn't record the exact circuit-layout. I hope that the circuit is simple enough for people to understand without more diagrams.
Step 6: Code
Attached is some C code for the circuit. It is coded for the Hi-tech C compiler, which is available in "lite" mode.
Note that some of the values used in the code is specific to the components that I used, so some tweaking is necessary.
For those who want to use other microcontrollers, I hope the code is straightforward enough to understand and be easily portable. I'd be happy to answer any questions about it.
Step 7: Enjoy!
I have selected a vase that transmits the light well, and gives a vibrant glow. Some interesting effects can be seen when water is added
Currently, the vase switches on only when dark, and has a long delay between pulses. The vase switches off after 250 pulses (presumably anyone watching would have gotten bored by then and gone to bed). These values can be tweaked or functions removed from the code.
The fade-in/out of each pulse is smooth, it appears to stutter on video because the camera was trying to adjust exposure on-the-fly.