Pwm and relay, or transistor

Hello I am currently controlling about 20 LED's via arduino digital pin and a relay. My question is, can I control the brightness of these LED's or is that not an option because of the way I am powering them? As I understand it controlling the brightness just means fluctuating the voltage provided to the LEDs..

Thanks

You can't drive PWN through a relay as it will not switch fast enough.

http://www.thebox.myzen.co.uk/Tutorial/LEDs.html

http://www.thebox.myzen.co.uk/Tutorial/PWM.html

Ditch the relay and use a transistor.

Most relays won't operate on and off fast enough to fatefully reproduce the PWM switcing frequency. Possibly a small reed type relay might, but really most PWM signals are usually wired to transistors or logic chips that can handle the speed, current and voltage of the desired load(s), LEDs in your case.

Lefty

if using small current, go for a transistor. High voltage and current require solid state relay but usually that limits on/off speed toggling of ca. 40 microseconds but bear in mind that 800 microseconds toggling time is considerd high speed in relays: http://www.vishay.com/company/press/releases/2007/070905ssr/

That link is to a solid state relay, which in effect is just a FET. It is not actually a relay at all. It is just that it has an optically isolated input. It will only handle DC.

So basically if I get a transistor that will work with the pwm pin? Can anyone explain how that actually works? Because doesnt the pwm pin work by varying the voltage coming out of the pin to make an LED dim for example, but if I'm using a transistor (or relay) wouldnt that always switch to supply a 12V (for example) power source and never actually vary the voltage? This is what I am confused about.

PWM signal in = PWM signal out Actually read Mike's links, you will be enlighted :o

D.

Because doesnt the pwm pin work by varying the voltage coming out of the pin to make an LED dim for example

nope, it toggles the pin on and off in different patterns to make an average voltage some place tween 0 and 5 volts, but the pin itself is still switching only between 0 or 5 volts

nope, it toggles the pin on and off in different patterns to make an average voltage some place tween 0 and 5 volts, but the pin itself is still switching only between 0 or 5 volts

Analog effects by digital means = beautiful :).

Can anyone explain how that actually works?

@aml25

read my lips website:- http://www.thebox.myzen.co.uk/Tutorial/PWM.html

I always argue that analogWrite() should have been called pwmWrite(), but get told by the powers that be that it is more clear to beginners (and artists?) that pwm output is better called analogwrite. ;)

Lefty

Lefty, I would wholeheartedly agree with you. ;)

transistor worked great, thanks for all the help