4
\$\begingroup\$

The LEDs I have can nicely run on 3.3V, with a minimal power dissipation to bring down 3.3V to 2.0V.

My Arduino has 5V for its digital pins however, and I do not know of a way to use 3.3V unless I use the 3.3V pin and not the digital pins.

To avoid unnessesary power/heat (even if not too much) is it possible to control my LEDs through a lower voltage than what the digital pins provide?

My first thought would be the analogue pins, of which range from 0..255,

5V / 1.5V (analogWrite(pin, 192)) = 3.33V, would this be a good replacement?

Any other suggestions on driving many, but low voltage LEDs?

\$\endgroup\$
2
  • 2
    \$\begingroup\$ I don't think that the Arduino has analogue outputs. \$\endgroup\$ Dec 3, 2011 at 23:22
  • 1
    \$\begingroup\$ @Leon, ah, I was thinking about an RGB LED but that was PWM not analogue. Entirely possible there are none. \$\endgroup\$ Dec 3, 2011 at 23:29

3 Answers 3

3
\$\begingroup\$

Indeed, an approach would be, using the PWM capabilities of your controller. You can generate a PWM waveform by using the analogWrite() function.

Parameters for your function: pin: the pin to write to. value: the duty cycle: between 0 (always off) and 255 (always on).

So, if your duty cycle is 255 that means you will have 5V, for 3.3V duty cycle should be somewhere close to 168.

However remember that "On most Arduino boards (those with the ATmega168 or ATmega328), this function works on pins 3, 5, 6, 9, 10, and 11". All you need to know about this matter, you can find here http://arduino.cc/en/Reference/analogWrite

Anyhow, don't forget that when dealing with LEDs - polarity is important and also you should (actually must) have a resistor in the circuit so that the current is limited.

Just one more thing - analogWrite, as you may already know, does not use the digital to analogue converter - it uses the PWM capabilities of you controller. This is just FYI :) Regarding the issue that you mentioned "To avoid unnessesary power/heat (even if not too much)" as Olin mentioned above, run you LEDs at low currents. For a standard LED 20mA would be the nominal value. However 20mA is the "recommended" maximum output for your controller outputs :)

Solution: If you think 15mA is OK for the LED and your planning on feeding it at 5V (from a digital output pin) and considering that the diode forward voltage is, as you said, 3.3V use this right here http://led.linear1.org/1led.wiz and you'll see that you're gonna need a 120 Ohm resistor :) A bigger value would lead to a less brighter LED and a smaller value to a brighter one, but keep in mind that a too low value resistor will lead to your controller port being... fried :)

Plan using a lot of LEDs? Try a LED matrix approach, either way I think that what you want is the resistor version, not the PWM.

Good luck and all the best, sorry for the rusty english, Dan

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Thank you Dan, this is neat information. I'd love to tinker with PWM! \$\endgroup\$ Dec 13, 2011 at 3:50
  • 1
    \$\begingroup\$ Well, you should :) although it may look scary at first, it's really practical once you get the hang of it and great to use in almost any application which supports it. You can get some real nice "eye candy" effect (think about all the cars that dim the lights in or out, when unlocking/locking, instead of a simple and plain on/off). This and not to mention that PWM is used in a very large variety of actuator control (RPM in DC motors, Electronic Speed Controllers for brushless motors... ) \$\endgroup\$
    – Dan
    Dec 13, 2011 at 15:09
4
\$\begingroup\$

Show a schematic of the particular arduino you are using. If it has a linear regulator making 3.3V from 5V, then there will be no power savings in running the LEDs from 3.3V. The resistor in series with the LED will dissipate less at 3.3V, but the remaining power a resistor resulting in the same current for 5V would dissipate is just made up in the 3.3V regulator instead. That may overload the 3.3V regulator whereas using the 5V power supply spreads out the extra dissipation.

The difference between 3.3V and 5V is not that great. If you are worried about power and the 3.3V supply turns out not to be a switcher, the simplest answer is to get higher efficiency LEDs and run them at lower current.

How many LEDs do you need to run? How much current thru each? Have you checked that the arduino power supply is capable of the extra load? The extra current capability of the 5V and 3.3V supplies are probably different. Check the spec sheet to see what current is available. If you need a lot of power, you probably have to arrange for it yourself from a separate wall wart or something.

\$\endgroup\$
1
\$\begingroup\$

PWM duty cycles need to be calculated using RMS. Basically

Duty Cycle = RequiredVoltage² / PeakVoltage²

So in this case, 3.3v would be: 3.3² / 5² = 0.4356 You multiply that by 255 to get the analog write value = 111.078 So, the CORRECT value is 111 NOT 168.

To show you why this is correct, imagine your load draws 5mA at 3.3V, that means it has a resistance of 660 ohms, consuming 16.5 mW of power. Now, if you ran the same load at 5V it would draw 7.6mA which is 38mW of power, OVER DOUBLE the amount of power consumed at 3.3V. If you ran your duty cycle at 168 you would basically be running your load at 38mW for 66% of the time and zero for 34% of the time, giving you an average power use of 25mW. Too high. If you ran at the correct value of 111 you would be running your load at 38mW for 43.5% of the time and zero for 56.5% of the time giving you an average power use of 16.5mW which is the EXACT value consumed at 3.3V.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.