Maker Pro
Maker Pro

Led blinking instead of staying solid

amaykehy

Feb 9, 2020
1
Joined
Feb 9, 2020
Messages
1
Hello,
I am very new to electronics and trying to play around with Arduino and leds.
The leds that I have seem to not be able to remain solid. Initially I thought I had a problem with the code but I used existing sample code and it remained the same. After many attemps I even took the Arduino out of the equation and connected the LEDs directly to 5V voltage, without resistors and with differents values of resistors.
Always the same results: the LEDs keep on blinking (at a frequency of ~2-3 cycles/second).
I tried several of the LEDs I have (green and red) and they all behave the same.
Is it a malfunction or are there some LEDs that are designed to do that?
I have bought the LEDs a few years ago so I don't have the exact reference and I cant find any text on the LEDs themselves.
Thanks for your help.
 

Bluejets

Oct 5, 2014
6,901
Joined
Oct 5, 2014
Messages
6,901
There are LED's which flash without any extra circuitry.
Not a good practice to use an LED without any current limit resistor unless one knows the specs as it could be irreversibly damaged.
 

hevans1944

Hop - AC8NS
Jun 21, 2012
4,878
Joined
Jun 21, 2012
Messages
4,878
LEDs are dirt cheap. Spend a buck and buy a dozen or so to play with. Throw away the mystery blinking red and green LEDs, or maybe save them to make decorative lights someday after you have mastered the mysteries of Arduino.

Small red LEDs need about 20 mA of current and drop about 1.8 V when forward biased at that current level. The Arduino produces about 5 V on its digital outputs, so figure about 3.2 V across the series current-limiting resistor (you MUST use one with every LED!) at 20 mA to arrive at a value of 3.2 / 0.02 or about 160 ohms. Find a resistor that value or higher. A 220 ohms resistor is a "standard" value that is close enough, and the power dissipation in the resistor is inconsequential. See the chart below from an earlier thread for the forward voltage of other colored LEDs.

upload_2018-11-30_19-19-14-png.44037


Or download a datasheet for more particulars regarding whatever LEDs you buy. Ditch the blinking LEDs and get on with your life of learning how to blink LEDs and control major appliances with your Arduino. Arduinos are lots of fun, but only after you get to know them intimately. Code, test, code and wash, rinse, repeat until you get it right.
 
Last edited:

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
Um... red LEDs are more like 2.2V not 1.2.

Then the calculation becomes 2.8 / 0.02 = 140 Ohms.

But I would design for a lot less than 20mA. Any modern LEDs will be very bright at 20ma, and are okay for indoor use at 1mA.

Bob
 

hevans1944

Hop - AC8NS
Jun 21, 2012
4,878
Joined
Jun 21, 2012
Messages
4,878
Um... red LEDs are more like 2.2V not 1.2.

Then the calculation becomes 2.8 / 0.02 = 140 Ohms.

But I would design for a lot less than 20mA. Any modern LEDs will be very bright at 20ma, and are okay for indoor use at 1mA.

Bob
Thanks, Bob! I realized my mistake (and edited the post to correct it) after seeing another post from November 2018 that had a reply from @73's de Edd that had a nifty LED chart attached. So, I grabbed a copy and added it to my post. I often use 330 ohm resistors with LEDs and 5 V circuits. I also sometimes use 1000 ohm resistors too, but those yield pretty dim LEDs.

If using the Arduino to explore the wonderful world of pulse width modulation (PWM), using higher current in the steady state (continuously on) will make the LED more visible at low duty-cycles (mostly off state).

It is important not to exceed the current limitations of either the LED or the device that is driving it, in this case an Arduino output port. So, it is better to err on the side of too large a resistor value rather than too small. But, what the hell, you can't learn much of anything worthwhile without smoking a few parts, eh? Gee... I haven't blown up an LED since sometime in the previous century... connecting a charged-up, high-capacitance-value, electrolytic directly across the LED leads will do it easily if you use a hundred volts and several hundred or a few thousand microfarads. Be sure to wear safety glasses and stand well away from where the fireworks will occur.
 
Last edited:
Top