◈ CircuitBench ▶ Open simulator

Electronics Basics

Every circuit, from a blinking LED to a robot, follows a few simple rules. Learn them here, then try each one in the simulator.

Think of electricity like water in pipes. Voltage is the water pressure, current is how much water flows, and resistance is how narrow the pipe is.
Voltage, current, resistanceOhm's lawPowerSeries and parallelVoltage dividersLED resistorCapacitors and RCLogic levels and PWMCommon mistakes

Voltage, current and resistance

Voltage (volts, V) is the electrical push between two points, like water pressure. Current (amps, A) is how much charge flows past a point each second, like water flow. Resistance (ohms, Ω) is how strongly a part opposes that flow, like a narrow pipe. Voltage is always measured between two points; we usually measure against ground, the 0 V reference.

Ohm's law

The three quantities are linked by V = I × R. Rearranged: I = V / R and R = V / I.

Example. A 9 V battery across a 450 Ω resistor: I = 9 / 450 = 0.02 A = 20 mA. Double the resistor to 900 Ω and the current halves to 10 mA.

Add a battery (9 V), a 450 Ω resistor and a multimeter in Amps mode. Do you read about 20 mA? Now change the resistor to 900 Ω. What happens to the current?

Electrical power

Power in watts is P = V × I, which also equals I² × R and V² / R. Power turns into heat in resistors. A 5 V supply across 100 Ω dissipates 5² / 100 = 0.25 W, exactly the limit of a common quarter-watt resistor, so it would run hot. Choose values so parts stay comfortably below their ratings.

Series and parallel

Series parts share the same current, and resistances add: R = R1 + R2. Two 220 Ω resistors in series make 440 Ω.

Parallel parts share the same voltage, and currents add. For two resistors, R = (R1 × R2) / (R1 + R2). Two 1 kΩ resistors in parallel make 500 Ω. Adding parallel paths always lowers total resistance.

Voltage dividers

Two resistors in series split a voltage: Vout = Vin × R2 / (R1 + R2), measured across R2.

Example. Vin = 5 V, R1 = 10 kΩ, R2 = 10 kΩ gives 2.5 V. With R1 = 10 kΩ and R2 = 5 kΩ you get 5 × 5 / 15 = 1.67 V. Sensors like photoresistors and thermistors use this trick: their resistance changes, so the middle voltage changes, and the board reads it with analogRead.

Load the Ohm's law divider example and change R2. Watch the voltage in the middle change.

Choosing an LED resistor

An LED has a nearly fixed forward voltage (about 2 V red, 3 V blue/white). The resistor takes the rest: R = (Vsupply − Vf) / I. For 5 V, a red LED and 10 mA: R = (5 − 2) / 0.010 = 300 Ω, so a 330 Ω resistor is a good choice. A brighter 20 mA LED at 5 V would need 150 Ω. Without the resistor, too much current flows and the LED burns out.

Never connect an LED straight to a power source. Always put a resistor in series.

Capacitors and RC time constants

A capacitor charges through a resistor. The time constant is τ = R × C. After one τ it reaches about 63% of the supply, after 5τ about 99%.

Example. 10 kΩ and 100 µF: τ = 10,000 × 0.0001 = 1 second.

Build this circuit, Alt-click the capacitor's + pin to add a scope probe, and watch the curve rise over about 5 seconds.

Logic levels and PWM

Digital pins are either HIGH (the board's supply, 5 V on an Uno and 3.3 V on an ESP32) or LOW (0 V). A pin can safely supply only about 20 mA, so use a transistor for motors and other loads. PWM switches a pin on and off quickly; the fraction of time spent HIGH (the duty cycle) sets the average voltage. analogWrite(pin, 128) is about 50%, giving roughly 2.5 V average on a 5 V board.

Remember: V = I × R. If you know two of the three, you can always find the third.

Common mistakes

Next: learn to control these circuits with the Arduino tutorial or browse the component library.