The Steampunk Forum at Brass Goggles
April 25, 2014, 10:10:36 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Change your password now! And see our official statement on Heartbleed impact
 
   Home   Blog Help Rules Login Register  
Pages: [1] 2   Go Down
  Print  
Author Topic: How to make an LED light fade in when power is applied?  (Read 13233 times)
Anders
Zeppelin Captain
*****
United States United States


Obtainer of Rare Antiquities


WWW
« on: December 07, 2009, 07:28:35 am »

Hello good sirs and ladies.  I am currently researching the requirements for a project idea I had tonight, and one of the items on my list is finding out what it would take to make an LED light fade in when the power is switched on (as opposed to coming on instantly).  Also, would this be able to make the light fade out when power is removed?  Finally, what would it take to make the light pulse slightly while the power remains on?

I failed Circuits 1 in college two years ago, and that's all the electronics I've ever been exposed to.  Ohm's law and I are good friends, but otherwise I would appreciate "Electronics for Dummies" kinds of explanations.  Thank you very much for your time.
Logged
von Corax
Immortal
**
Canada Canada

The Leverkusen Institute of Paleocybernetics


« Reply #1 on: December 07, 2009, 07:39:57 am »

Just off the top of my head, I should think a good beefy capacitor in parallel with the LED should give you a good, visible fade-in and might be able to produce an acceptable fade-out as well. As for pulsating, my first instinct would be to use the PWM output from a microcontroller, but if, as you say, you are not much past V=IR then you may not be interested in going that route.
Logged

By the power of caffeine do I set my mind in motion
By the Beans of Life do my thoughts acquire speed
My hands acquire a shaking
The shaking becomes a warning
By the power of caffeine do I set my mind in motion
The Leverkusen Institute of Paleocybernetics is 5838 km from Reading
OldProfessorBear
Zeppelin Overlord
*******
United States United States


Werebears RULE!


WWW
« Reply #2 on: December 07, 2009, 10:00:19 am »

It's basically the same thing, just a difference of speed. To control the apparent brightness of an LED, you need to feed it pulsed power. The longer the on-pulse as compared to the off-pulse, the brighter the light will appear, and vice versa. You need to do this at some frequency faster than the eye can detect, and gradually increase the on-pulse from 0% to 100% of the cycle (to fade in), or gradually decrease from 100% to 0% (to fade out).

You can use the same system, but at a speed slow enough so the eye can detect it, to cause visible pulsating. You can also use a simpler circuit to cause abrupt pulsing, i.e., a flashing effect.

Circuits to do these things can be found all over the aetherwebs.
Logged

Another Entirely Reasonable Opinion from
Bill P_______, Nul.D. (Unseen U.), F.R.S.*, Restorer of Old Photographs,
Sexagenarian Boy Genius and SUPREME NERD GOD!!! (score=98)
Down in the Belly of Brooklyn, NY, US
* http://forum.retrofuturist.org
Dave the Troll
Zeppelin Captain
*****
United Kingdom United Kingdom


Corporal Grease - Her Majesty's Own Mars Engineers


« Reply #3 on: December 07, 2009, 02:25:05 pm »

To control the apparent brightness of an LED, you need to feed it pulsed power.


This isn't quite true.
You can control the brightness by pulsing or by reduced current.

The later is probably easier.  A capacitor across LED will do the job.  When you switch on the capacitor will need to charge before the LED comes completely on and will need to discharge before it goes completely off.

As for pulsing this thread shows what I did with a 555 timer.

A 555 timer gives a pulses with frequency and mark-space ratio dependent on its external components.  But the signal at the components rather than at the recommended output is a nice ramp which will give you the pulsation you desire if connected to an LED.
Logged
Anders
Zeppelin Captain
*****
United States United States


Obtainer of Rare Antiquities


WWW
« Reply #4 on: December 07, 2009, 04:30:23 pm »

Thank you very much for your replies.  Not much information stuck in my head from that Circuits course, but I am finding that direct recall is not necessary when you're not being tested on it!  I am now reminded of parts of the class that I took notes on which might be useful.

If the pulsing effect requires a little more knowledge of circuitry, then I would not shy away from learning it.  It's just that I'll need it explained as to a complete dunce.  Wink  I have been told that there is something called an "Arduno" which is common for beginning circuitry projects.  Would that be a viable choice?

Finally, for the benefit of future readers, I found a super-basic LED wiring guide on Instructables.com which refreshed my memory on a lot of important concepts: http://www.instructables.com/id/LEDs-for-Beginners/
Logged
Der Tinkermann
Zeppelin Admiral
******
Netherlands Netherlands


keeper of scapegoats,sitting ducks,and black sheep

brosiman
WWW
« Reply #5 on: December 07, 2009, 06:34:58 pm »

Another circuit you might be interested in is,what is called,a Pummer circuit:
Spoiler (click to show/hide)
Logged
Anders
Zeppelin Captain
*****
United States United States


Obtainer of Rare Antiquities


WWW
« Reply #6 on: December 08, 2009, 12:41:16 am »

Der Tinkermann,
What, exactly, does a "Pummer circuit" do?  The Google seems to suggest it has to do with turning lights on at night.  Not exactly what I'm after, but I could tuck it away for a future project idea.
Logged
von Corax
Immortal
**
Canada Canada

The Leverkusen Institute of Paleocybernetics


« Reply #7 on: December 08, 2009, 03:40:07 am »

An Arduino is precisely what I had in mind when I mentioned microcontrollers. A microcontroller is essentially a relatively-simple microprocessor combined with a small amount of memory, a set of directly-addressable digital input and output pins, and (usually) several ADCs for analog input and some means of outputting one or more analog signals, all on a single chip. The Arduino combines one such device (the Atmel ATMega328) with a voltage regulator and a USB interface on an inexpensive (~US$30) developer board with a row of header sockets down each side, along with a programming environment capable of loading a program onto the chip. The IDE is open-source and is available for Mac, Linux and Windows; the Arduino board itself is also open-source, and there are several fully-compatible clones on the market, including some modified for specific applications. Also, there are quite a number of add-on boards, called "shields," which plug into the Arduino board for various special functions.

The Arduino uses pulse-width modulation (PWM) to simulate an analog output. When you write a value to one of the analog pins, the chip switches the pin rapidly between 0V and +5V, varying the ratio of on-time/off-time to produce a signal which most loads see as a specific voltage somewhere between 0 and +5. (If your circuit doesn't like this, the output can be filtered to produce a true analog signal.)

You do need to be comfortable writing simple programs, and you should have at least a passing familiarity with C or Java, but there are plenty of tutorials available online.

Hope this helps.
Logged
Anders
Zeppelin Captain
*****
United States United States


Obtainer of Rare Antiquities


WWW
« Reply #8 on: December 08, 2009, 08:38:26 am »

Ah, this is excellent!  I am not sure what it was, but something about the way you explained it finally gave me something to hook my brain onto.  I can write programs all day (and sometimes I get paid for it), but finally understanding what's "under the hood" gave me that link between the code and the physical realm.  The Arduino looks appealing at this point.  Does anyone have a favorite vendor?
Logged
oldskoolpunk
Zeppelin Admiral
******
United States United States


WWW
« Reply #9 on: December 08, 2009, 08:49:22 am »

Just off the top of my head, I should think a good beefy capacitor in parallel with the LED should give you a good, visible fade-in and might be able to produce an acceptable fade-out as well.

I agree.  Using a microcontroller for a lamp dimmer is overkill.

Try putting a 100uf electrolytic capacitor in parallel with the LED.  Make sure the polarity of the capacitor is correct, and that its voltage rating is higher than the output of the power supply driving the thing.  Observe how slowly the LED illuminates. Use a larger or smaller capacitor as desired.

If you want "flickering", look into 555 timer chips.

Logged
Dave the Troll
Zeppelin Captain
*****
United Kingdom United Kingdom


Corporal Grease - Her Majesty's Own Mars Engineers


« Reply #10 on: December 08, 2009, 10:19:02 am »

This is the circuit you need for fade in and out.


Maximum current through the LED (which therefore determines brightness, get this from the LED info).
I = (3V - 1.7V) / (R1 + R3)

(you can change this by adding another battery and so increasing the 3V, the 1.7V is the LED voltage, again get this from the LED info).

e.g. 30mA -> R1+R3 ~ 50 ohms

Time constant for the LED coming on is T = R3*C (since the capacitor is charged through R3), so the bigger C, the slower the LED will fade on.
Time constant for the LED going off is T = R1 * C (since the capacitor discharges through R1 and the LED).

R2 should be large.  Once the LED has gone off the remainder of the charge from the capacitor will discharge through it, so that the LED doesn't come on instantly next time.
Logged
JingleJoe
Immortal
**
United Kingdom United Kingdom


The Green Dungeon Alchemist


WWW
« Reply #11 on: December 08, 2009, 04:06:10 pm »

Dave, thats is brilliant! Grin
Logged

Green Dungeon Alchemist Laboratories
Providing weird sound contraptions and time machines since 2064.
bisclavret
Deck Hand
*
United States United States


« Reply #12 on: December 09, 2009, 04:28:49 am »

I agree.  Using a microcontroller for a lamp dimmer is overkill.

Yes, using an arduino is overkill. A picaxe, however is inexpensive and easy to learn (an even with the programming overhead it would handle such LED effects).
Logged
Anders
Zeppelin Captain
*****
United States United States


Obtainer of Rare Antiquities


WWW
« Reply #13 on: December 09, 2009, 03:53:23 pm »

I agree, a microcontroller just for dimming the light would be overkill, but for the pulsating effect I think it is a valid option (for me, anyway--it looks like something I'd want to know anyway, and from what I've seen getting a pulsing light with regular circuit components seems rather daunting).
Logged
Dave the Troll
Zeppelin Captain
*****
United Kingdom United Kingdom


Corporal Grease - Her Majesty's Own Mars Engineers


« Reply #14 on: December 10, 2009, 09:52:37 am »

A month or two ago, I found the scrap of paper with the 555 circuit on that I used for pulsing heart.  If it turns up again, I'll post and explain.

(Or if I feel altruistic later, I may even reconsider it from scratch).

...an arduino ... is inexpensive and easy to learn (an even with the programming overhead it would handle such LED effects).

How inexpensive?
Although I'd always go for the analogue solution to the problem presented, I could do with a cheap microcontroller option of projects that warrant one.
Logged
von Corax
Immortal
**
Canada Canada

The Leverkusen Institute of Paleocybernetics


« Reply #15 on: December 10, 2009, 11:44:03 am »

How inexpensive?
Although I'd always go for the analogue solution to the problem presented, I could do with a cheap microcontroller option of projects that warrant one.

The Arduino (which is actually a complete board, with voltage regulator, clock crystal and USB interface) runs around US$30.00. The ATMega328, which is the microcontroller chip itself, is around US$6.00. The ATTiny chips (which will do what Anders, the OP, wants) run closer to US$1.50 or so.
Logged
Dave the Troll
Zeppelin Captain
*****
United Kingdom United Kingdom


Corporal Grease - Her Majesty's Own Mars Engineers


« Reply #16 on: December 10, 2009, 12:21:29 pm »

I may have to have a play with the Arduino.

As for the 555, the datasheet shows a graph (Figure 7) of the signal on the threshold pin (Pin 6).  This seems to be the signal that you want on your pulsing LED.

So build the Astable circuit (Figure 5) with an LED in series with RA and it will pulse as required.  The Vcc that you use in the calculations for choosing the time constants should be 1.7V less than the actual Vcc (since this will be lost across the LED).
Logged
alfa1
Zeppelin Captain
*****
Australia Australia



« Reply #17 on: December 11, 2009, 10:45:29 am »

Depending on how rapid you want the pulsing to be, remember that flashing LEDs are readily available off the shelf.
Also, depending on the application, an LED fake candle may also do the job just as well.
Logged
Dave the Troll
Zeppelin Captain
*****
United Kingdom United Kingdom


Corporal Grease - Her Majesty's Own Mars Engineers


« Reply #18 on: December 11, 2009, 12:13:54 pm »

Depending on how rapid you want the pulsing to be, remember that flashing LEDs are readily available off the shelf.
Also, depending on the application, an LED fake candle may also do the job just as well.

The problem with flashing LEDs is that they look like flashing LEDs.  The Steampunk look is non-electrical, so things switching on and off slowly or pulse rather than flash gives a better aesthetic.
Logged
JingleJoe
Immortal
**
United Kingdom United Kingdom


The Green Dungeon Alchemist


WWW
« Reply #19 on: December 13, 2009, 12:07:50 am »

This is the circuit you need for fade in and out.


Maximum current through the LED (which therefore determines brightness, get this from the LED info).
I = (3V - 1.7V) / (R1 + R3)

(you can change this by adding another battery and so increasing the 3V, the 1.7V is the LED voltage, again get this from the LED info).

e.g. 30mA -> R1+R3 ~ 50 ohms

Time constant for the LED coming on is T = R3*C (since the capacitor is charged through R3), so the bigger C, the slower the LED will fade on.
Time constant for the LED going off is T = R1 * C (since the capacitor discharges through R1 and the LED).

R2 should be large.  Once the LED has gone off the remainder of the charge from the capacitor will discharge through it, so that the LED doesn't come on instantly next time.

I just tried this circuit and it only just works Tongue You need a really big capacitor for any noticeable fade, I even tried putting a 1000 microfarad and 2200 microfarad capacitor in series and the light still only faded in a tiny bit although it did fade out slower. I used an 18 megaohm resistor for R2, but a 180k resistor seemed to make no difference. R1 and 3 were both 22 ohm
In conclusion, this works but not as well as I'd hoped unless you have a huge capacitor.
Logged
Dave the Troll
Zeppelin Captain
*****
United Kingdom United Kingdom


Corporal Grease - Her Majesty's Own Mars Engineers


« Reply #20 on: December 14, 2009, 10:05:59 am »

In conclusion, this works but not as well as I'd hoped unless you have a huge capacitor.

I guess we need to go for transistors for current control then.  I'll give it some thought.
Logged
Dave the Troll
Zeppelin Captain
*****
United Kingdom United Kingdom


Corporal Grease - Her Majesty's Own Mars Engineers


« Reply #21 on: December 14, 2009, 02:35:07 pm »

Someone want to try this?


(Transistor drawn may be of wrong type).

Capacitor charges with time constant CR1 (since base current is negligible).  Setting R1 relatively high will mean than C can be a more reasonable value.

V2 follows V1 - 0.7V.

Max current through LED is 2.3/R3.  Choose R3 accordingly.
R2 should be such that there is at least a 0.7V drop across it.  R2 = 0.7 * R3 / 2.3
Logged
Der Tinkermann
Zeppelin Admiral
******
Netherlands Netherlands


keeper of scapegoats,sitting ducks,and black sheep

brosiman
WWW
« Reply #22 on: December 14, 2009, 06:28:43 pm »

I'll give that one a go since I like playing with LED's.


edit:Well,that seems to work(did a very quick test,without bothering too much about values)
« Last Edit: December 14, 2009, 09:13:00 pm by Der Tinkermann » Logged
Dave the Troll
Zeppelin Captain
*****
United Kingdom United Kingdom


Corporal Grease - Her Majesty's Own Mars Engineers


« Reply #23 on: December 15, 2009, 09:32:27 am »

edit:Well,that seems to work(did a very quick test,without bothering too much about values)

Care to take a quick video to share the results with everyone?

I don't get much chance at home to play electronics, but if we get the forum so that thinkers can come up with ideas and others post visible results then I'll be more inclined to come up with ideas/solutions.

My first degree is in Electronic Engineering and Maths, but I've never put the electronics side to much use.
Logged
Anders
Zeppelin Captain
*****
United States United States


Obtainer of Rare Antiquities


WWW
« Reply #24 on: December 15, 2009, 02:18:56 pm »

I just want to say that I truly appreciate these efforts!  I have been so busy that I've barely had time to get rolling on other parts of this project, but it has been immensely helpful to hear discussion and even reports of success here!  Thank you.
Logged
Pages: [1] 2   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.206 seconds with 16 queries.