LED has a forward voltage, typically around 1,7V. As I understand this is the amount of voltage needed to conduct current in the forward direction. Setting analogWrite(1), sets ~0,2V which is much less than a forward voltage but even so the LED glows (very poor but still). So even when the voltage is much less than the forward voltage, diode can conduct a current?
No. analogWrite produces "fake" analog voltage. Google PWM.
Edit: any diode conducts current even at low forward voltage, but only very very tiny amount. I am not sure if a red LED produces any red light at 0.2V, surely not visible amount. In fact a LED works as a (poor) photodiode and when illuminated it will produce reverse current. A tiny amount and low voltage but well measurable with a common DMM.
Yeah, I know that. So the diode can conduct current due to for some short time we output 5V?
So the diode can conduct current due to for some short time we output 5V?
Yes - [u]PWM[/u]. (Of course, the LED doesn't get the full 5V because the voltage is divided between the LED & resistor.)
Actually, when the LED is "dim", it's at full-brightness for a short time but our eyes don't perceive the full brightness. If the pulse is short-enough you wont see it at all!
If you were to slow-down the PWM you'd see it blinking. (You can experiment with that by modifying the Blink Example.)
If you use PWM with a regular incandescent light bulb the bulb does actually dim because it can't heat-up & glow fast enough. For the same reason, we can use PWM to control the speed of a motor... The motor can't speed-up or slow-down as fast as the PWM.
michalt38:
Yeah, I know that. So the diode can conduct current due to for some short time we output 5V?
Yes, far too much current unless you provide a current-limiting resistor.
It will actually be limited by the inherent resistance (about 36 Ohms nominal) of the Arduino output drivers, but this will be overloading them and potentially causing damage to the Arduino, if not the LED also.
michalt38:
Yeah, I know that. So the diode can conduct current due to for some short time we output 5V?
LEDs can tolerate much higher peak current when they are operated on a low duty cycle PWM. The data sheets often specify it. However, the AVR (and other) processor digital outputs aren't like that. The rated maximum current for a digital output is absolute.
Consequently, it is not safe to drive an LED from a digital output without a limiting resistor, even if it is pulsed with PWM. It's okay for the LED, but not for the processor.
aarg:
However, the AVR (and other) processor digital outputs aren't like that. The rated maximum current for a digital output is absolute.
The absolute maximum is for DC current only. There are no specs for pulsed current.
Do I feel a flame war argument evolving? ![]()