0%
0%

# Guerilla LED Candles

Simple, candle-like glowing LEDs that only turn on at night. Trying to make it cheap and use what I have at home.

Similar projects worth following
2.3k views
I noticed some holes, covered with plastic covers on my dorm's walls. I tought it would be a nice little "art intervention" to stick something inside. And since I'm only learning the basics, let's start with some LEDs glowing.

The goal is to make LEDs glow and have some sort of candle/fire effect (brightness varying a little, slowly). And they should only turn on at night- which means there will be somekind of light sensor.

It has to be simple, cheap and it should run on (few?) coin batteries. I'll be happy if it lasts more than one day. And it has to look cute.

• ### Lights are shining again

After almost giving up on the analog version of this project, I decided to ask my friend Grega for help. It turned out to be a good idea, since we've come up with a simple proof of concept that works well.

I thought this should be simple and it is. In theory, if you add sine wave signal to a constant voltage you should get the result I was looking for. Right?

We got the sine wave output from a smartphone function generator app, via headphones output. I would never think if it by myself- and it works great! I don't know what is the voltage of the output of my smartphone, but I assume it's around 1V peak to peak. That said, I can play with different voltage divider values (to get the constant DC) and see what works best. I am testing this with a 9V battery, but will probably use coin cell battery later.

I'm using a 0.5Hz sine wave, 100% amplitude (how can I measure this?).
Here's the screenshot of my function generator (application):

# White LED:

For white LED, I set the voltage divider values to output 2.6V (with load). Without the load - with only a multimeter attached across R2- I got 2.9V.

R1= 10k
R2= 4k

Vout = 2.9V
Vled= 2.6V

R1= 10k
R2= 3.3k

Vout = 2.3V
Vled = 1.8V

# Red LED:

* It's hard to focus the camera in dark, red color doesn't help either...*

R1 = 10k
R2 = 2.7k

Vout = 1.9V
Vled = 1.7V

# Conclusion

So this works! I'm happy with the results, as I wanted a slow and subtle "waving" of LED brightness. Now I "only" have to figure out, how to make that sine wave thing somehow.

• ### Giving up on theory

I decided to study the 555 fade in/out circuit, to understand its working and to take the control of the LED into my own hands...
I failed, realising I'm just a young padawan that has a lot yet to learn about electronics. Since I don't understand all the details (calculating the fade-in/fade-out times and the frequency and amount of "breathing" effect), I won't even try to explain the maths and current flows and everything. Whatever. It kinda works somehow. Meh.

I also tried getting into the simulators, but couldn't make it work in EasyEDA neither in CircuitLabs (I didn't even try to get into the more professional spice stuff, I don't understand sh*t there...). Too bad I don't study EE :)

BUT! Theory shouldn't be an obstacle to the "hacker attidute and the hands-on imperative" (Steven Levy, Hackers: Heroes of the Computer Revolution), right? I mean it still glows up/down somehow and nobody will ever know what I really wanted to achieve. For artistic purposes and for version 0.1 (AND after three full afternoons of studying theory and wnb calculating stuff) it's good enough :)

With a red LED it works like this (I didn't want red, but okay):

And with a white LED it looks like this (added 2.4k resistor across the C and E terminals of the transistor, to lift the emmiter voltage a bit- suggested by @Bharbour ,tnx for the interest and the patience to explain things to me):

I ordered some low power 555 timers, some ATtiny microcontrollers and LDRs and phototransistors. And button batteries. Maybe I'll return to this theoretical study after I have some fun with microcontrollers, or after trying some other circuits or just adapting this one to work at 3v (for coin cells). I learned a lot from this: from some kind of very basic circuit analysis, to capacitor working (and important calculations), BJT transistors and their modes of operation, LEDs...

Now it's time to go back to more known territory of computer code and take a break from all this analog wizardry :'D

• ### Teaching LEDs how to breathe

There's tons of literature and tutorials about the 555-timer and it's applications. I thought I would use it in astable mode and change duty cycle, but then I found a circuit that was very close to what I need.

# Examining the "Breathing LED circuit"

This circuit is fading the LED up and down, it looks simple and it doesn't use many components. Great!
But how doest it work? Can I modify it, so it won't turn all the way off?

I quickly noticed that this circuit doesn't use pin 7 (discharge), so it's probably not astable mode and it doesn't work like I imagined it would (changing PWMs duty cycle to dim the LED).

From what I understand it works like this: pins 2 (threshold) and 6 (trigger) are "monitoring" the voltage across the capacitor (C1). When the voltage is smaller than 1/3 Vcc (in our case 3V), pin 3 (output) will go HIGH. When the voltage gets above 2/3 Vcc (6V in our case) output will go LOW.

In the beginning, the 555s output will be HIGH (capacitor discharged, voltage < 1/3 Vcc) therefore charging the capacitor (increasing voltage drop across it). As capacitor charges, less and less current flows trough it, and more current goes to the base of the transistor. This increasing current entering transistor's base gets amplified and causes the LED to turn on slowly.

When the capacitor charges up to 2/3 Vcc (6V) the output will go LOW, and the capacitor will begin to discharge trough the transistor. It's output current will drop (exponentially?) with time, which means the LED will fade off slowly. When the capacitor gets below 2/3 Vcc the process repeats.

# Getting the RC values right

Obviously, changing the values of the capacitor and the resistor will change the speed of flashing. I tried replacing the resistor (R1) with a 47k potentiometer. I played with it, trying out different capacitor values (from 100uF to 470uF) but I couldn't get the right result.

In every case the LED was fading up/down nicely, but turning off completely. If I cranked up the resistance, I could keep the LED on all the time, but then it wouldn't fade down at all (or really just a little bit, barely visible and too fast).

I guess I should dive deeper into the working of the transistor and start calculating things. Any hints or ideas how to figure this out? Is it even possible to achieve this kind of fading upd/down (but never turning it off completely) with this configuration?

• ### Hello world!

My original idea was to build the "LED candles" in 1-2 days and place them all over my student's dorm hallway. It would look cool at night , since we have long and dark hallways. It would be cool to put them in theese covered holes in the wall (what's the right word for theese?), they are all over the place.

As a beginner in electronics, I tought it was a cool 1-2 day project to learn some basics. While It turned out to be great for learning, it wasn't a 2 day project :'( (of course, I never estimate the time needed right).

I'll first do the right-kind-of-glowing and later I'll focus on the light sensor part.

I guessed I'd need a LED, battery, capacitors and some resistors. And I had "RC-circuit" and "RLC- circuit" keywords in my mind, but didn't know much about it. After some time googling for some already-made implementations of my idea (combining keywords LED and glowing, flashing, fading, fire, candle... ) I figured out it would be the best to use the famous 555-timer (I actually had some at home). All the analog variants used too many components. Oh and, the best keyword for what I wanted was "Breathing LED" :)

But nobody did exactly what I imagined. All the variants fade the LEDs on and off completely, while I wanted them to be turned on constantly with a subtle up/down fading effect.

How would you do it?

Share

## Discussions

bulrush15 wrote 07/24/2018 at 15:08 point

Neat! They sell LEDs that flicker randomly like a candle on Ebay and Aliexpress. Just make sure you talk to the seller so you get the right LED, because most Chinese sellers confuse "blinking" with "random flickering".

Are you sure? yes | no

Bharbour wrote 12/08/2017 at 22:00 point

You are correct about the output pin 3 on the 555 sinking current to ground. That is essential to using the 555 in this circuit setup. Your circuit is still an "astable" circuit, it is not the most conventional version of astable mode.

The way your circuit is hooked up using the output which sources or sinks current (called a totem pole output) allows the duty cycle to be pretty close to 50%, where the standard "astable" hookup can't really get to 50%. In your circuit, the capacitor C1 charges and discharges through the same resistor R1. When the output pin switches low, C1 discharges through R1 into the output pin. A small amount of current (about 50uA or so) will flow into the base of the transistor, but 180uA will flow through R1 into pin 3 on the 555. Both of these numbers were calculated at 2/3Vbat or the high to low transition point. In reality both the currents will decay exponentially, but for a first order "figuring out how the circuit works" kind of thing it is useful. You are correct that the LED does not switch off instantly because the capacitor voltage is what is controlling it via the base of the transistor. The transistor is operating as a current amplifier in this circuit.

Using a CMOS version of the 555 will extend the battery life a lot, probably 3X. The old I2L analog design shows a power supply current of 11mA, while the CMOS version is under .5mA.

One of the things that is consuming power is the transistor:
Q1 power = (Vcollector - Vemitter) x Icollector

This is not a large amount of power in this situation, but since it is running off batteries, it is worth knowing about. The other reason is that if you change over to a microcontroller and use PWM duty cycle to control the brightness, this power becomes VERY small because the transistor is either fully on (Vvollector - VEmitter ~ 0.2V) or fully off (Iemitter ~ 0) with very little time in between.

If you use the micro controller and are very attentive to the sleep modes and such, you should be able to get the average current down some. I am not sure that the MCU approach will give you a large benefit over using a CMOS 555 and the linear circuit because the LED power is really going to be the lions share of the power when the circuit is fully optimized.

Are you sure? yes | no

Bharbour wrote 12/07/2017 at 23:42 point

To slow the ramping down, increase R1.

Another name for the "emitter follower" is "voltage follower". In this case, using the base current is not that useful. The voltage on the emitter will be 0.6V (one diode drop) below the voltage on the base. This rule holds until the emitter current/beta > the current available to the base. Since beta is pretty high (100 - 200) and the emitter current is pretty low (less than 20mA), you can just consider that the emitter voltage will be 0.6V below the base voltage. If the emitter voltage is held above the base voltage - .6V like adding the 2.4K resistor, the transistor will not conduct until the base voltage rises above the emitter voltage + .6V

If you think about the LED current path without the transistor (Ileda), you have the battery voltage (Vbat) through the new 2.4K resistor (call it R4) in series with R3 (470) with the anode of the LED sitting at it's voltage drop (Vd) above ground.

Ileda = (Vbat - Vd)/(R3+R4) = 2.05mA

Using the voltage dropped across R4 with ILeda through it, you get the minimum voltage for the emitter (the transistor is not conducting ):

Vemitter = Vbat - (Ileda*R4) = 4.06V

Add .6V to Vemitter and this is the base voltage where the transistor will start to conduct and contribute current to the LED or about 4.66V. Once the transistor starts conducting, the current in R4 will go down, but the transistor is carrying the load now.

Because the voltage drop across the LED (Vled) is sort of constant (to a first order anyway), the current gets limited by the 470 ohm resistor R3 as the emitter voltage rises. There should be a graph of the voltage drop across the LED as a function of current in the data sheet if you are interested.

The battery life probably won't be great. I grabbed the capacity of an Energizer EN22 9V battery from the data sheet off Digikey, and at 10 - 25mA discharge rates, it looks like about 550mAH. A really rough estimate on the battery life will be 550maH / 16mA = 34 hours. This is really rough because the current will be floating around as the LED current changes and the 555 supply current can vary widely with the specific vendor of 555 that you get. It's probably an order of magnitude estimate.

Something that you might enjoy would be messing with a simulation of this circuit. Linear Tech (now Analog Devices) offers a free analog sim package called LTSpice that works pretty well. The user interface is a little wierd, but you can play with resistor values and cap values and see how the led current behaves and the transistor operation. It can be a black hole for time, but a way to learn something.

Are you sure? yes | no

jurc192 wrote 12/08/2017 at 16:25 point

Aah now I get it. I had difficulties how to think about theese "fixed" voltage drops (like in transistor or LED), how to count them in when calculating current etc. Now it makes more sense.
I now understand how changing the emmiter voltage affects operation of the transistor and LED. (thanks for the in-depth explanation! :)

The glowing atm is kinda "clumsy" tho (tried plugging a potenciometer as R4), it sticks to the high or low value too long and time of fading-in is shorther than time of fading-out.... however, I think I spet enough time studying theory behind this circuit. I'll just go with what we have done until now. For "v0.1 release" it will do :)

Maybe I'd just like to clear out how the discharging part works. When capacitor reaches 2/3Vcc, 555's output goes LOW. The LED doesn't turn off because the capacitor "takes over" and empties it's charge trough transistor (that's why we get slow fade out). Is that right? Does all the charge from capacitor go trough the transistor (to the LED), or does it go into 555's output as well? I've noticed that when 555 output is low, it sinks current to the GND and this kinda confused my "understanding"...

I also tried simulating the whole thing, first in EasyEDA and then in CircuitLab but I couldn't get it working in any of them (I didn't take more than 2-3 hours for it tho). LTSpice is mainly for windows so...hmh, maybe next time.

I'll order some ATTinys and try to do it with them. Also I could try some other configurations with low power (cmos) 555's. Maybe unsing PWM to drive the led and changing it's duty cycle would be more efficient, than this approach with RC?

Are you sure? yes | no

Bharbour wrote 12/07/2017 at 17:44 point

Something you might do to get the minimum brightness up would be to put a resistor across the collector/emitter terminals on Q1.  Something around 2.5K to start. This will set a minimum current and when the capacitor on the 555 charges enough that the emitter voltage rises above what is coming through the resistor, Q1 will start conducting and the brightness will increase as the cap charges. On the discharge cycle, the transistor will conduct until the base voltage gets to within 0.6V of the voltage set by the two resistors and the LED drop, then the transistor will stop conducting and the LED current will be supplied by the new resistor only. If you want some more help on this let me know.

Are you sure? yes | no

jurc192 wrote 12/07/2017 at 21:27 point

With 2.4k resistor across the transistor it looks like this:

And with red led it looks like this (which I think is pretty much what I had in mind):

I really appreciate your interest in this project (I would expect people to be bored by just a single LED :')!

I have to admit that I'm not able to totally understand everything (you're suggesting) just yet, but I'm getting really close to have things cleared.
I'm currently (last 3 days) doing slow analysis of what is going on in the circuit (I want to be able to make the white LED glow like I want it, kinda like the red one in the video but maybe a bit slower). I had to study capacitor chargin/discharging stuff first, then transistor basics and regions of operation and yesterday I studied emmiter-follower stuff.

Now I'm trying to figure out how to calculate the current across the LED in different times- but for this I need to know the base current. (Bcs I really want to understand why the led shuts off totally or stays on fully too long. Also I want to really understand why the red LED works fine (lower forward drop) and white not. I don't really understand this yet, but your comments are helpful)
For example, how can I calculate the current entering the base of the transistor at the time when Vc = 1/3 Vcc? I can't intuitivelly tell how the current (that goes from the output trough resistor) splits between base and the capacitor branch (when capacitors is for example 3V charged)?

When I'll understand charging part fully I'l update project logs and move to discharging part. And then add light sensor-switch stuff and adapt everything to low power :)

Are you sure? yes | no

## Similar Projects

Project Owner Contributor

### Diy Led Chaser

hariramanil810

Project Owner Contributor

### Electronics Workshops Resources

Yann Guidon / YGDES

Project Owner Contributor

### Yet Another Electronic Lampyridae

Yann Guidon / YGDES

Project Owner Contributor

Sam Ettinger

# Does this project spark your interest?

Become a member to follow this project and never miss any updates