Ohm’s law is a basic concept used in almost every electronics project that, although simple, can be difficult to understand at first. There are four main components used when discussing ohms law, and the flow of electricity in general:
Voltage: Defined as the amount of potential energy between two points. Most commonly represented as the symbol V. Measured in volts.
Current: Defined as the flow of electrons through a circuit. Commonly represented by the symbol I. Measured in Amperes, or Amps for short.
Resistance: Defined as the amount of reduction that a given device or material reduces the electrical current flowing through itself. Resistance is represented by the symbol R and is measured in units of ohms (Ω).
Ohm’s law is most often represented by the equations V = I x R and I = V/R. If you don’t understand these equations yet don’t worry, they will be explained.
The most commonly used analogy to understand how voltage, current, and resistance work together is the water tank and hose. Lets say we have a large water tank with a hose coming out of the bottom, when the valve is opened it is safe to say water will come out of the hose.
The three main aspects to the water flowing through the hose are the pressure from the water in the tank pushing downwards, the size of the hose, and the water flowing through it. The less water there is in the tank, the less pressure(voltage) there is pushing the water through the hose (current). In this situation the water tank acts like a battery where the voltage is the pressure and the amount of water in the tank would be the amount of charge left in the battery. As voltage goes up or down, the current follows suit.
The size of the hose will also make a big difference as to how much water can get through the pipe at one time, a large hose allows more water to pass through at once. In a circuit the size of the hose is defined by the resistors you use.
Now that we understand the relationship of voltage, current, and Resistance we can get back to the math. Using the Beaglebone Black as our power source we can do a simple equation to find out what we need to power a component. Lets say the component needs to draw 5v and at 40 mA. The Beaglebone Black can put out 5v with up to 250 mA. An LED will draw all available amperes from the power source so to keep it from burning up we must use a resistor to limit it.
Ohm’s law combines the relationship between resistance, voltage, and current as best described in this image
So using Ohm’s Law we can find out what size resistor we need. The equation is:
We know the voltage we want is 5v and the current needs to be 40 mA, so plugging in the numbers we get
So we need to use a 125 Ohm resistor in series with the LED to keep it at the manufacturers recommended amperage rating.
It is important to note that the above example was a hypothetical use of Ohm’s law. LED’s have a third factor to them called voltage drop that must be calculated when selecting the proper resistor. All LED’s will have a spot in their datasheet called the “forward voltage” this is the maximum voltage that should be used to power the LED. You must subtract the forward voltage from the source voltage and then divide that by the amperes to get your resistor value. So the Ohms law equation stays the same
the only thing that will change from the above example is that rather than using 5v for “V” we will subtract the forward voltage, lets say 1.8 from the 5v source voltage which gives us 3.2V. Substitute the new value into the equation and we get
R = 80 Ohms.
And that’s how you properly calculate a resistor for your LED.