Programmers and Teachers:
Ohm's Law Calculator
Lesson on Ohm's Law
How to Use Ohm's Law
Named after physicist Georg Ohm, Ohm’s law defines the relationship between an electrical conductor’s resistance, the voltage across it, and the current through it. The formula for Ohm’s law is given as:
V = IR
Where V is voltage, I is current, and R is resistance.
When working with Ohm’s law, we use the standard electrical units of volts (V) for voltage, amperes (A) for current, and ohms (Ω) for resistance. It is best practice to convert units after finishing calculations with Ohm’s law.
For example, if we want to find the voltage drop across a resistor in kilovolts (kV), we will first calculate voltage using the standard units which will provide the answer in volts. Then, we divide the voltage by 1000 to convert from volts to kilovolts.
Let’s go through an example problem together. An electrical circuit has a resistor of unknown resistance. The voltage drop across the resistor is measured to be 4.6 volts, and the current through the resistor is measured to be 2.3 milliamps. What is the resistance of the resistor?
1.) We have two known values and must find the third value (resistance).
2.) Plugging the knowns into Ohm’s law, we get:
V = IR
4.6 = (0.0023)R
3.) Now we can solve for R, the resistance.
4.6⁄0.0023 = R
R = 2000
4.) The resistor’s resistance is 2000 ohms, which converts to 2 kiloohms.
How the Calculator Works
The code itself uses the same basic Ohm’s law formula that is given in the lesson above. The only exception to this is when power needs to be calculated. In certain situations, it uses Joule’s law to calculate power, which says that P = I2R.
Unit conversions are handled the way the lesson above suggests. The Ohm’s law calculations happen with standard electrical units before resulting values are converted to the desired output units.
The calculator’s code prevents it from performing any calculations if it detects inputs that would result in an invalid calculation or answer. The rules it follows are simple, if any inputs are not a positive real number, then no calculations will occur. When it detects any input change, it tries again from the beginning.