Arduino PWM outputs and PWM controller questions.

Thread Starter

rigers

Joined Jun 14, 2011
20
Hello Everyone,

I wanted to drive a couple of LEDs using PWM from an Arduino. However the Arduino pins provide 5V and I needed it at 3.3V. I read online about PWM controllers but not quite sure how they work and how they are controlled.
Does anyone have any ideas how I could get 12 PWM signals at 3.3V using an Arduino? Also some info on PWM controllers would be appreciated.

Thanks in advance!
 

mcgyvr

Joined Oct 15, 2009
5,394
explain why you think you need 3.3V?
Then explain EXACTLY what you are trying to do (including part numbers/specs for the LED's).
 

Thread Starter

rigers

Joined Jun 14, 2011
20
The specification sheet of the LED states a max voltage of 3.8V. Can I run them at 5V but limit the current at a safe level or is it neccessary to be 3.3V?
LED Part number: HLMP-115.
 

BSomer

Joined Dec 28, 2011
434
You can run them on the 5 VDC outputs of the Arduino with the use of a current limiting resistor. However, if you are going to do more than one LED on an output you will have to use a transitor to switch the LED's on an off. This is due to the low current sinking/sourcing abilities of the outputs.
 

simo_x

Joined Dec 23, 2010
200
This is due to the low current sinking/sourcing abilities of the outputs.
And also depending on the Arduino source capability. Checkj the datasheet of the regulator mounted on the board to know the maximum souce current it can drive, or in addition, an external power supply can be used.

Bye
 

Thread Starter

rigers

Joined Jun 14, 2011
20
Each LED will have it's own pin and they won't be running at the same time (2 at a time max). So actually I'm going to use the Mega.

I would still like to know if I could have a 3.3V PWM though, as a general knowledge I guess.

Thank you!
 

mcgyvr

Joined Oct 15, 2009
5,394
Led's are driven by current..NOT voltage. you basically just need to ensure your supply voltage is higher than the Vf of the LED (or group of LED's if in series). Anyone can power than LED with a 1000V supply if they wanted to.. The important part is the 20mA rating for the LED which you ensure the LED gets only that via a resistor (or via a constant current supply)
 

mcgyvr

Joined Oct 15, 2009
5,394
Each LED will have it's own pin and they won't be running at the same time (2 at a time max). So actually I'm going to use the Mega.
There is a VERY..VERY good chance that you don't need a mega either.. Maybe you should tell us EXACTLY what you are trying to do so you can learn the proper way to do it. (Charlieplexing/Multiplexing might be one solution)
 

BSomer

Joined Dec 28, 2011
434
There are arduino's out there that run on 3.3V only. So those would undoubtedly have the 3.3V pwm that you are looking for. As for the 5V versions I am uncertain. You can use the pwm pins to control any voltage level you want. Just use a transistor (BJT or FET) connected to the pin.
 

Thread Starter

rigers

Joined Jun 14, 2011
20
I have 12 LEDs in a ring. Each LED runs separately and one a time. I need to vary the intensity of the LEDs with PWM. The Mega has 14 PWM while the UNO only has 6. I am using a Arduino because I need to be able to control the LEDs with a computer and collect data. I have the interface almost ready.
 

ErnieM

Joined Apr 24, 2011
8,377
One thing never do is connect a LED directly to any voltage source without some sort of current limiting, such as a series resistor.

ANYTHING is liable to happen, from the LED not lighting, being dim, lighting just fine, being too bright, LED & chip running hot, LED & chip burning out.

Simon sez don't do that.
 

ErnieM

Joined Apr 24, 2011
8,377
I have 12 LEDs in a ring. Each LED runs separately and one a time. I need to vary the intensity of the LEDs with PWM. The Mega has 14 PWM while the UNO only has 6. I am using a Arduino because I need to be able to control the LEDs with a computer and collect data. I have the interface almost ready.
Controlling the brightness of a LED using PWM is pretty simple. For a 5V logic output compute a nice value of resistor from:

R = (Vdrive - Vled) / Iled

Where Vdrive is the logic output voltage, Vled is the LED ON voltage, and Iled is the LED current when it is on. Make sure the micro can drive Iled.

Set up like that, the LED is running at full current or full brightness for a pulse width of 100%. If you drop the pulse to 50% you get 50% of the current and a lesser brightness (I don't think brightness and current have a direct linear relationship).

From what you've said 12 LEDs and 12 resistors should be all you need.
 
Top