Atlas Robotics
FundamentalsBasic

Voltage, current and power: applying Ohm's law in embedded systems

Atlasbot · 20/8/2026 · 10 min read

Voltage, current and power: applying Ohm's law in embedded systems
Ohm's Law: U = I × R — voltage equals current times resistance

Plug the LED straight into the 5V GPIO pin without a resistor, the LED will almost certainly burn out within a few seconds. Understanding voltage, current, and power — and Ohm's Law that connects them — is the bare minimum to keep from turning every circuit connection into a component-burning gamble.

Three basic quantities

  • Voltage (Voltage, U or V, unit Volt) — potential difference between 2 points, is the "push" that makes electrons move. It can be thought of as water pressure in a pipe — the higher the pressure, the stronger the water flows.
  • Current (Current, I, units Ampere/A) — the amount of electrons that actually move through a point in the circuit every second. Continuing with the water pipe example: the current is like the flow of water through the pipe.
  • Power (Power, P, unit Watt) — energy consumption/conversion rate, in P = U × I. This is the number that determines how much heat the components generate and how quickly the battery drains.

Ohm's Law — the most important formula

U = I × R

U: voltage (Volt)
I: current (Ampere)
R: resistance (Ohm, Ω)

Ohm's Law describes the relationship between 3 quantities in a resistor (or pure resistive device) - knowing 2 of the 3 values, calculating the remaining value. This is the formula most often used when calculating current-limiting resistors for LEDs, or estimating the current consumption of a circuit.

For example, calculate the current limiting resistor for LED

LEDs usually require about 20mA (0.02A) and a voltage drop of about 2V (depending on LED color, see datasheet). Supply 5V power from GPIO, need to calculate the resistance so that the residual voltage (5V - 2V = 3V) does not cause the current to exceed 20mA:

R = U / I = 3V / 0.02A = 150Ω

Choose a 150Ω resistor (or the closest standard value, e.g. 220Ω to be safer) in series with the LED — this is the math behind the "always have a resistor before the LED" advice that every Arduino tutorial says.

In short: U = I × R is a tool to calculate "how much resistance is needed so that the current does not exceed the safety limit of the component" — not a simple memorized formula.

Power: why does a motor need its own supply?

GPIO pins on most microcontrollers can only withstand very small currents - usually a maximum of 20-40mA per pin (see specific datasheet, for example: STM32 is usually limited to ~20mA/pin, the total current of the entire chip is also limited). A small DC motor can require starting currents of hundreds of mA to several A — far beyond the load capacity of the GPIO pin. Plugging the motor directly into the GPIO not only does not have enough current for the motor to run, but can also burn that GPIO pin (or even burn the chip) due to current exceeding the tolerance limit.

This is the reason why it is mandatory to use motor driver (L298N, TB6612...) — GPIO only sends small current control signals to the driver, the driver is the part that actually turns on/off the large current from the separate source (battery/adapter) to the motor.

Technical details

Formulas

Combining Ohm's law (U = I×R) with the power formula (P = U×I) yields two other forms of the power formula, used when only knowing the current or only knowing the voltage across a resistor:

P = U × I = I² × R = U² / R

For example: LED current limiting resistor is 150Ω, current through it is 0.02A
P = I² × R = 0.02² × 150 = 0.06W
→ 1/4W (0.25W) type resistor is enough to be safe (0.06W << 0.25W)

This is a calculation that is often overlooked when choosing a resistor — just calculating the correct Ω value (as in the LED example above) is not enough, you also have to check whether the power dissipation exceeds the resistor's rated power.

Parameters

Maximum current each GPIO pin can withstand (exceeding can easily burn out the pin or the entire chip):

Board/ChipMaximum current per GPIO pin
Arduino Uno (ATmega328P)~40mA
STM32 (most lines)~20-25mA
ESP32~40mA

Forward voltage (Vf) of LED according to color — determines the residual voltage that needs to be calculated into the formula R = U/I above:

LED colorTypical Vf
Red1.8 – 2.2V
Yellow/Orange2.0 – 2.2V
Green/Blue3.0 – 3.3V
White3.0 – 3.3V

Practical applications

Choose wires and connectors for AMRs based on the actual load current, rather than intuition: motor power wires (several A under load) need a much larger cross-section than sensor signal wires (only a few mA). Using thin signal wires for high-power circuits causes heating, voltage drop and even melted insulation. Connectors such as XT60 (rated for ~30A continuous current) are commonly used for the robot’s main battery wires, while smaller JST connectors are only suitable for low-current sensor signals.

Practical example: estimating power consumption to select a source

One board has: MCU (~100mA) + LiDAR (~340mA) + 4 motors (~500mA each when loaded)

Estimated total current: 100 + 340 + 4×500 = 2440mA ≈ 2.5A (at 12V voltage)
Power: P = U × I = 12V × 2.5A = 30W

This estimate helps choose a battery/power source with enough current supply - choosing a battery that only has enough 1-2A for a system that requires 2.5A will cause the voltage to drop at high load (motor starting), causing the robot to automatically restart or run erratically.

Common mistakes

  • Plug in an LED without a resistor — The LED burns out almost immediately because the current through the LED is not limited, skyrocketing far beyond the tolerance level (usually only ~20mA).
  • Plug the motor/relay directly into GPIO — exceeding the pin's current tolerance, can burn the GPIO pin or the entire chip — always through the intermediate driver/transistor.
  • Confusing nominal battery voltage with actual voltage — "12V" Li-ion batteries actually range from ~12.6V (full) to ~9-10V (nearly empty) depending on charge level — circuits designed to handle only nominal 12V can have problems at higher actual voltages when the battery is full.
  • Ignore power when choosing wires/power — wire too small compared to actual current causes voltage drop, wire heating, even fire — always calculate actual current (not just average current) before choosing wire cross section and power supply.

Conclusion

Voltage, current, power, and Ohm's law aren't far-fetched physics — they're direct calculation tools to choose the right resistor, source enough load, and know when an intermediate driver is needed instead of plugging it straight into the GPIO. The next article in this category is about Digital vs Analog — how the microcontroller "sees" these voltage levels.

Get new articles and lessons by email

When a new technical article or course module is published, Atlas Robotics sends you a short email. No spam.

Unsubscribe any time with the link in each email. See our Privacy policy.

Voltage, current and power: applying Ohm's law in embedded systems — Atlas Robotics