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.
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.
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.
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.
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.
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.
Common mistakes
- No common ground. Every part and board must share a ground.
- LED without a resistor. Turn on Protect in the View menu and the simulator will warn you.
- Floating inputs. An unconnected input reads random values; use
INPUT_PULLUP. - Motor on a pin. Use a transistor and a diode instead.
- 5 V into an ESP32 pin. Its pins are 3.3 V only.
Next: learn to control these circuits with the Arduino tutorial or browse the component library.