Go Down

Topic: Can switching regulators and transistors be smoothly PWM'd? (Read 2043 times) previous topic - next topic

switching

Using a 5V Attiny, I want to control the full brightness range on some 1.8V and 2.8V LEDs. If I set up two switching regulators leading to transistors and then PWM a transistor for each light, can I expect smooth variable output? Or is there a better solution?

They're part of a $15 switch, so I'm afraid to PWM at the full 5V. Thanks for reading!

Boardburner2

LED are fast and do not have the lag of incandescent bulbs.
Pwm basically switches them on and off instantly, do it fast enough and the eye percieves this as a change in intensity,

So yes it is possible to get the full range of brightness as far as the eye can discriminate.

You will however need a current limiting resistor you cannot drive 5V directly into the led.

INTP

Transistors are capable of faster switching speeds than the Arduino can even send commands.

allanhurst

If you want to switch the input of switchmode PSU with PWM - probably NOT! they're designed to have a (fairly) slowly  varying input voltage and deliver a constant output voltage..

Switch the LED's with pwm on the output as mentioned above.

And  "LED are fast and do not have the lag of incandescent bulbs."  actually makes things easier for an incandescant  bulb if you want apparently constant light - they smooth out the light variations by the thermal time constant of the filament....



regards

Allan

switching

Sorry for not being clear - the idea is that two switching regulator will always be powered, with transistors on the 2.8/1.8V outputs. My microcontroller will PWM (using the built-in PWM functions) those transistors to light up the LEDs.

Regulator (constant) -> transistor (PWM'd) -> LED

I don't trust myself to PWM the lights directly - if I put the duty cycle a bit too high and an LED burns, ordering another switch will be $25. If I'm only playing with a safe voltage like 2.8, I can't screw it up. Limiting resistors are also out, they waste too much power.

allanhurst

The voltage drop across an LED is pretty fixed - so you must drive them with a current-limited source  - or you WILL burn either the LED or the driver out.

So you must use either a resistor or a clever current controlled  power source

regards
Allan



switching

Even if it has only the exact rated voltage available? One is 20mA at 2.8V, I can't just use it with the 2.8V regulator?

Edit: Oh, okay. I guess I need a current limiting resistor in case the voltage out fluctuates a little bit. I'll add one. But I'm still okay to PWM the transistors as planned, right?

Thanks for the help, everyone

Boardburner2

A LED may have a nominal voltage of 2.8 V but it varies from led to led , current is what kills them.

Normal practice is to drive them from a higher voltage and employ a suitable value of series current limiting reasister.

EDIT

Can you explain what you wish to do.

At 20 mA it is possible to drive an LED directly from the pin of an arduino with a series resistor, without an external supply or transistor.

More than one LED however you could exceed the capacity of the arduino in which case external PSU and transistors are needed.

Wawa

It seems you want to use a constant voltage supply, set to the Vf (working voltage) of the LEDs.
And then PWM the supply for brightness control.
Can't do that.

LEDs are better used with constant current, because Vf varies with temp, brightness and age.
A constant voltage supply could damage the LEDs.

The LEDs must be small, because "part of a switch" is mentioned.
An Arduino pin can drive/PWM small (<=20mA) LEDs directly through a current limiting resistor.
Post the link to the switch, so we can advise the resistor value.
Leo..

allanhurst

OK.. the LED takes 20mA at about 2.8V

The arduino supply is 5V.

So the resistor you need = (5 - 2.8)/0.02 == >  110 ohms .

100 or 120 would be fine if you've only got E12 values

regards
Allan.

Wawa

(2.8) or ( 2.8 ) 8) 8) 8)

Red LEDs have a lower Vf of ~2volt.
CL resistor = (5 - 2) / 0.02 = 150ohm.

All other colours/white are ~3volt.
CL resistor = (5 - 3) / 0.02 = 100ohms.

These are minimum values, and ok if you PWM the LEDs.
20mA could be too bright without PWM.

Watch the total current rating of the chip if you use more than a few LEDs.
Leo..

allanhurst

Hi Leo....

Quote
All other colours/white are ~3volt.
(2 - 3) / 0.02 = 100ohm.
are you sure?



regards(?!)

Allan

Wawa

are you sure?
No. This was a general answer.
Red/green/yellow 3mm/5mm indicator LEDs could all be ~2volt.
The high-brightness green/yellow, and blue/white are usually ~3.3volt.
High-brightness red is usually ~2.4volt.
To be sure, you have to look at the datasheet. Or measure it yourself with a curent source.
I would just use 220ohm for all, and PWM to the needed brightness.
20mA through a red LED and 10mA through a green LED does not mean that the red LED will be seen brighter.
Leo..


allanhurst

Hi Leo..

I was just wondering where you could buy a         
 
Quote
All other colours/white are ~3volt.
(2 - 3) / 0.02 = 100ohm.
resistor

- I make that -100 ohms.

Be a handy device if you could get one.................

regards

Allan.

Wawa


Go Up