Skip to content
Tutorials Center
My learning

Topics

Lesson 2 of 37 ยท Getting Started

Electronics Basics: Voltage, Current and Ohm's Law

The electronics every Arduino beginner needs: voltage, current, resistance, Ohm's law, LED resistor calculations, series and parallel circuits, and safe habits.

You can write Arduino code without knowing electronics, but you cannot wire a circuit safely without it. Three quantities explain almost everything you will do in this course: voltage, current and resistance. They are related by one short formula, Ohm's law, and with it you can choose the right resistor for an LED, understand why a motor must not be powered from a pin, and read a datasheet without fear.

A good picture is water in pipes. Voltage is the water pressure, current is how much water flows per second, and resistance is how narrow the pipe is. Higher pressure pushes more flow; a narrower pipe lets less through.

Voltage, current and resistance

  • Voltage (V), measured in volts, is the electrical "push" between two points. An Uno's output pin is at about 5 V when high and 0 V when low, measured against the ground (GND) pin, the common reference every voltage is compared to.
  • Current (I), measured in amperes (A), is the flow of charge. Arduino work uses milliamps: 1 mA = 0.001 A. A small LED needs roughly 5 to 20 mA.
  • Resistance (R), measured in ohms (ฮฉ), is how strongly a part opposes current. Resistors are parts made to have a known resistance.

Current only flows around a complete loop: from a source, through the parts, and back to ground. If the loop is broken (an unplugged wire, a button that is not pressed) no current flows.

Ohm's law

Georg Ohm found that for a resistor the three quantities are tied together:

TEXT
V = I ร— R        I = V / R        R = V / I

If 5 V is across a 250 ฮฉ resistor, the current is 5 / 250 = 0.02 A, which is 20 mA. Double the resistance and the current halves.

Power is the energy turned into heat or light per second: P = V ร— I. A resistor dissipating 0.1 W is warm; the common small resistors are rated for 0.25 W, so check the numbers when currents are large.

C Stand-in: an Ohm's law calculator

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with scanf or fgets), it gets the next line from this box.

Run it: a 100 ฮฉ resistor passes 50 mA, which is more than an Uno pin should supply (the absolute maximum is 40 mA per pin, and 20 mA is a comfortable design limit). A 10 kฮฉ resistor passes only 0.5 mA, which is why it is popular for "pull-up" duty, as you will see in Pull-Up Resistors and Debouncing.

Choosing an LED resistor

An LED is not a resistor. Once its forward voltage is exceeded it conducts almost freely, so without a resistor in series the current would climb until the LED or the pin is damaged. Each LED color has a forward voltage (Vf) that it drops while lit: red about 2.0 V, green about 2.1 V, blue and white about 3.0 V. The resistor takes the rest of the supply voltage:

TEXT
R = (Vsupply โˆ’ Vf) / I

For a red LED at 15 mA on a 5 V pin: (5 โˆ’ 2.0) / 0.015 = 200 ฮฉ. Resistors come in standard values, so you pick the next value up, here 220 ฮฉ, and the LED runs a little dimmer and safer.

C Stand-in: pick a series resistor for an LED

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with scanf or fgets), it gets the next line from this box.

Series and parallel

When parts are in series (one after another on the same path), the same current flows through all of them, resistances add (R = R1 + R2) and the supply voltage is shared among them. When parts are in parallel (side by side), each gets the full voltage and the currents add; the combined resistance is smaller than either one.

TEXT
Series:    R = R1 + R2
Parallel:  1/R = 1/R1 + 1/R2

A voltage divider, made from two series resistors, is one of the most useful tricks in sensor work and gets a full lesson in Voltage Dividers.

flowchart LR
    P["5 V pin"] --> R["220 ohm resistor"]
    R --> L["LED"]
    L --> G["GND"]

Figure: the simplest output circuit. Current leaves the pin, passes the resistor and LED, and returns to ground.

Habits that save hardware

  • Never connect 5 V directly to GND. That is a short circuit and can damage your board or computer port.
  • Never power motors, relays or long LED strips from a pin. Pins supply tens of milliamps, not amps. Use a transistor or driver and a separate supply.
  • Check polarity. LEDs, electrolytic capacitors and many modules only work one way round. The longer LED leg is the anode (+).
  • Wire with the power off, and double-check before plugging in.
  • Join grounds. If two supplies share a circuit, their GND lines must be connected.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. A 5 V supply is applied across a 1000 ohm resistor. What current flows?

    I = V / R = 5 / 1000 = 0.005 A, which is 5 mA.
  2. 2. Why does an LED need a series resistor?

    Once the forward voltage is exceeded, an LED has very little resistance, so the resistor sets the safe current.
  3. 3. Two 220 ohm resistors are in series. What is the total resistance?

    Series resistances add: 220 + 220 = 440 ohm.
  4. 4. Which should NOT be powered directly from an Arduino pin?

    Motors draw far more current than a pin can supply and also produce voltage spikes; use a driver.

Summary

  • Voltage pushes, current flows, resistance opposes; Ohm's law is V = I ร— R.
  • Arduino pins supply only tens of milliamps; keep LED currents around 5 to 20 mA.
  • Size an LED resistor with R = (Vsupply โˆ’ Vf) / I and round up to a standard value.
  • Series resistances add; parallel parts share voltage and add current.
  • Power loads need drivers and their own supply, with grounds joined.

Next: Your First Sketch: Blink