Mood vase using PIC12F683 microcontroller
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.
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
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).
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.
For more detail: Mood vase using PIC12F683 microcontroller
Current Project / Post can also be found using: