A resistor is an electrical component that limits or regulates the flow of electrical current in an electronic circuit. Resistors are also used to provide a specific voltage for an active device, for example a transistor.
Illustration of a generic resistor for microcontrollers
Color code of resistors
Color coding of resistors
You can encounter two different codes on a resistor: 5-band or 4-band codes as seen on the chart above. The only difference is that the 5-band code have an additional band on them, which is the type that is most commonly used.
When you want to know the ohm of a resistor, you look at the resistance as XYZ where X is replaced with the corresponding number of the color on the first band. Y is replaced with the number of the color of the second band and Z is replaced with the corresponding number of the color of the third band. For example would a 5-band resistor with red, red, black, black and black be translated to 220 since red bands is replaced with a 2 and black bands is replaced with 0. This would the be multiplied with 1 ohm due to the fourth band being black. The last band, tolerance, can be forgotten as this is only used for extremely expensive and precise equipment, which most people won’t even encounter.
Which resistor should I pick?
There is a lot of different resistors that is commonly used for microcontrollers. For a lot of basic projects a 220 Ohm resistor will suffice. If you are doing a more complex project, you can read up on how to calculate the total resistance needed in your system by clicking here.
For a more comprehensive walkthrough of resistors, read this Wikipedia article.