Controlling an LED
For this part of the tutorial you will need:
- Usb to Mirco USB cable.
- Ethernet Cable.
- A computer.
- An SD card (4GB or bigger).
- A breadboard
- Female to male jumper cables or the Adafruit Assembled Pi Cobbler Breakout.
- 330 Ohm resistor.
A bit of Electronics
A voltage source is a constant is a source of electrical energy which has a fixed voltage and can be used to power electric and electronic devices, such as a LED.
Most alkaline batteries such as the one on the diagram have 1.5 Volts (or 1.5V for short) but for the sake of the simplicity of this example we will say that this battery is a 5V battery. Current flows from the positive terminal of the battery, through the LED and the resistor and to the negative terminal of the battery. If the circuit is not completed NO current will flow through the components and, in this case, the led won’t light up.
A LED is a Light Emitting Diode, and what that means is that (as a diode) will only conduct current in one direction. If it is connected in the opposite direction it won’t burn out but simply it won’t get light up.
A LED has two terminals, one is the positive (anode) and the other is the negative (cathode) and the electrical symbol may show you the direction of the current that the LED needs to have to get turned ON. In the physical object you may se a little “flag” on the case which normally indicates the negative terminal, also the shortest wire usually indicates the same thing. In the real world if it should work and it doesn’t, probably it is inverted, so feel free to try connecting it in the opposite direction.
To correctly turn on the led we need a resistor. A resistor is an electrical component that limits the current, in this case, traveling through the resistor. If the current is not limited, the LED or the voltage source may brake, so as a rule of thumb, every time you use a LED, you must lightly need a resistor.
In this tutorial we will use two resistors, each marked with specific colors depending on its value. If you are unsure of the value of a resistor you may consult a resistor color code
table or use any online software that calculates it for you.
For more detail: Controlling an LED