Passive Components
Resistors, capacitors, potentiometers, diodes and transistors: what they do and how to wire them. Each entry explains what the part does, what it looks like in CircuitBench, how to wire it and, where relevant, an Arduino code example you can paste into the code panel. New to electronics? Start with the electronics basics and the Arduino tutorial.
Resistor
PassiveWhat it does. Limits current and divides voltage. The value in ohms (Ω) sets how much it resists current: I = V / R.
What it looks like. A small tube with coloured bands showing its value.
How to use it. Put it in series with an LED (220 Ω–1 kΩ at 5 V) or use two in a divider to make a lower voltage. Change the value in the inspector.
Capacitor
PassiveWhat it does. Stores charge and smooths voltage. It charges through a resistor with time constant τ = R × C and blocks steady DC once charged.
What it looks like. A small cylinder with two leads.
How to use it. Note the + and − legs: the + leg must be on the more positive side. Place it across a supply to smooth ripple, or with a resistor to make a delay, and watch the voltage rise on the scope.
Potentiometer
PassiveWhat it does. A variable resistor with three terminals: two ends of a track and a sliding wiper. It works as an adjustable voltage divider.
What it looks like. A round knob with three pins.
How to use it. Connect VCC to 5 V, GND to GND and SIG (the wiper) to an analog pin such as A0. Drag the knob slider and SIG moves from 0 V to 5 V.
Code example.
int knob = analogRead(A0); // 0..1023
int duty = map(knob, 0, 1023, 0, 255);
analogWrite(9, duty); // dim an LEDDiode 1N4148
PassiveWhat it does. Lets current flow one way only (anode to cathode) and drops about 0.6–0.7 V when conducting.
What it looks like. A small glass-style body with a stripe on the cathode end.
How to use it. Use it to block reverse polarity or to stop a motor’s voltage spike reaching a transistor. The striped end faces the more negative side.
NPN transistor
PassiveWhat it does. An electronic switch or amplifier. A small current into the base allows a much larger current from collector to emitter.
What it looks like. A small three-legged part labelled B, C and E.
How to use it. To drive a motor, connect the load between supply and the collector, the emitter to ground, and a pin through a resistor (about 1 kΩ) to the base.
Code example.
pinMode(8, OUTPUT);
digitalWrite(8, HIGH); // motor on through the transistor