Basic LED Animations for Beginners (Arduino)
Let's keep in mind a couple of key notes about LEDs:
- Like any other diode, current will only flow in ONE direction.
- High enough voltages will make it flow either way, but only for a split moment, you know, the magic smoke...
If you aren’t familiar with the following concepts, we recommend checking out these tutorials before continuing. Many of these notes listed above were covered in an earlier tutorial explaining basics circuit rules using LEDs. If you want to revisit that tutorial, please feel free to check it out.
If you're new to Arduino, breadboards, or other electronic basics, please take a minute to visit these other tutorials and guides that are full of goodies.
How to Use a Breadboard
What is Electricity?
Note: This example assumes you are using the latest version of the Arduino IDE on your desktop. If this is your first time using Arduino, please review our tutorial on installing the Arduino IDE.
If you've never connected an CH340 device to your computer before, you may need to install drivers for the USB-to-serial converter. Check out our section on How to Install CH340 Drivers" for help with the installation.
LEDs, like other diodes, require a 'minimum' voltage to work. In circuit analysis, we call this a voltage drop. With diodes, we consider that forward voltage 'using' a chunk of the available voltage. Troubleshooting tip #1:
- Check that the voltage on the anode and cathode meets the minimum forward voltage for operation. I use the term minimum loosely because you can touch an old dying battery to the LED terminals and still see a faint light.
Currently, There's Too Much Current
We've established that there are minimum requirements for LEDs, but there are maximums as well. In most physics books, the analog example for current is water. Well, if you've ever had a pipe burst then you'll know the dangers of too much, too soon. Again, check the datasheet for your LED's and make sure you're not applying too much voltage. If you up the voltage, you up the current. Troubleshooting tip #2:
- If you see a blip of light followed by a dark spot inside the LED, then we've done and busted it. (Also, remember this tip if you have old LEDs that can't seem to light up, maybe someone made an oopsie.)
Resistance Can Be a Force for Good
A big key point for the first two topics is using resistors to limit the current. If your voltage is too high, then using the right resistor can drop that down to a safer level when used in series with the LED. Let's say that the voltage is fine but the diode keeps blowing and you're low on LEDs. While it's not ideal, there are resistors designed to blow at high current: fuse resistor.