Understanding the Building Blocks of Electronics
A circuit is a complete path that allows electricity to flow from a power source, through components, and back to the source. Think of it like a water pipe system where electricity flows instead of water.
Every circuit needs three basic things: a power source (like a battery), a load (like an LED), and a complete path for electricity to flow.
What it does: Provides the electrical energy needed to make the circuit work. Like a water pump in a pipe system.
๐ Click to learn more
What it does: Provides the path for electricity to flow. Made of conductive materials like copper.
๐ Click to learn more
What it does: Limits the flow of electric current. Like a narrow pipe that slows down water flow.
๐ Click to learn more
What it does: Uses the electrical energy to do work - in this case, produce light. The "purpose" of the circuit.
๐ Click to learn more
What it does: Controls whether the circuit is ON or OFF by making or breaking the connection.
๐ Click to learn more
What it does: Acts as the reference point (0V) that electricity returns to. Completes the circuit.
๐ Click to learn more
Current, voltage, and the complete loop
A circuit is a complete, closed path that allows electric current to flow. Think of electricity like water in a pipe โ the battery is the pump, the wires are the pipes, and the components are devices powered by the flow.
A complete unbroken loop. Current flows, components work. The path goes from + terminal, through components, back to โ terminal.
A break anywhere in the loop stops all current flow. Like a gap in a pipe โ nothing works. A switch creates a controlled open circuit.
Current finds a low-resistance path bypassing components. Causes high current, heat, and potential damage. Fuses protect against this.
By convention, current flows from + to โ. In reality, electrons flow from โ to +. Both models are used in electronics.
The fundamental relationship between V, I, and R
Ohm's Law states that the current through a conductor is directly proportional to the voltage across it and inversely proportional to the resistance. It is the single most used equation in electronics.
V = I ร R
Example: 0.02A through 470ฮฉ = 9.4V
I = V รท R
Example: 9V รท 470ฮฉ = 0.019A (19mA)
R = V รท I
Example: 9V รท 0.02A = 450ฮฉ
P = V ร I
Also: P = IยฒR and P = Vยฒ/R. Measured in Watts (W).
Two fundamental ways to connect components
Components in a circuit can be connected in series (one after another) or in parallel (side by side). Each arrangement behaves very differently.
Storing and releasing electrical charge
A capacitor stores electrical charge between two conductive plates separated by an insulator. It charges up when connected to voltage and releases that charge when the voltage is removed โ like a small rechargeable reservoir.
High capacitance (1ยตFโ10,000ยตF). Polarised โ must be connected + to + and โ to โ. Used for power supply smoothing.
Small capacitance (1pFโ100nF). Non-polarised. Used for decoupling and noise filtering in high-frequency circuits.
ฯ = R ร C. Time (seconds) for a capacitor to charge to ~63% of supply voltage. After 5ฯ it's considered fully charged.
Capacitors block DC current but pass AC signals. This makes them useful for coupling audio signals and filtering power rails.
One-way valves for electrical current
A diode allows current to flow in only one direction โ from anode (+) to cathode (โ). In the reverse direction it blocks current completely (up to its breakdown voltage). This makes diodes essential for rectification, protection, and signal routing.
~0.7V forward voltage drop (silicon). Used in rectifier circuits to convert AC to DC. The cathode is marked with a silver band.
Light Emitting Diode. Forward voltage ~1.8Vโ3.5V depending on colour. Always needs a current-limiting resistor to prevent burnout.
Designed to operate in reverse breakdown at a precise voltage. Used as voltage regulators and references in power supplies.
Very low forward voltage (~0.2โ0.4V) and fast switching. Used in high-frequency circuits and preventing reverse current in battery systems.
Amplifiers and electronic switches
A transistor is a three-terminal semiconductor device that can amplify signals or act as a switch. It is the fundamental building block of all modern electronics โ billions are in every smartphone.
Terminals: Base, Collector, Emitter. A small base current controls a larger collector current. Common for switching loads like motors and LEDs.
Opposite polarity to NPN. Current flows from Emitter to Collector, controlled by pulling Base low. Used in high-side switching.
Voltage-controlled device (Gate, Drain, Source). Extremely low power consumption in logic state. Used in power switching and microcontroller output stages.
The current amplification factor. If ฮฒ = 100 and base current = 1mA, then collector current = 100mA. Allows small signals to control large loads.
Boolean logic โ the language of digital electronics
Logic gates process binary signals (HIGH = 1 = ~5V or 3.3V, LOW = 0 = 0V) according to Boolean rules. All digital systems โ from calculators to computers โ are built from combinations of these gates.
Output is HIGH only when ALL inputs are HIGH. Symbol: D-shape. Used in safety interlock systems.
| A | B | OUT |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
Output is HIGH when ANY input is HIGH. Symbol: Curved shield. Used in alarm systems.
| A | B | OUT |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
Flips the input. HIGH becomes LOW, LOW becomes HIGH. One input only. The bubble symbol means inversion.
| A | OUT |
|---|---|
| 0 | 1 |
| 1 | 0 |
NAND = AND + NOT (inverted output). NOR = OR + NOT. Both are "universal gates" โ any logic circuit can be built using only NAND or only NOR gates.
Exclusive OR โ output HIGH only when inputs are DIFFERENT. Used in binary adders, error detection, and encryption circuits.
| A | B | OUT |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
A AND 1 = A
A OR 0 = A
A AND 0 = 0
A OR 1 = 1
NOT NOT A = A
De Morgan's: NOT(A AND B) = NOT A OR NOT B
Two types of electrical power
Essential rules for working with electronics
Always work with low-voltage DC for learning: 3.3V, 5V, 9V, 12V. Use a bench power supply with current limiting, not mains directly.
Electrostatic discharge can destroy microcontrollers and ICs instantly. Use an anti-static wrist strap and mat when handling sensitive components.
Always use a fuse or current-limited supply. A short circuit can overheat wires, melt insulation, and start fires within seconds.
Never short-circuit batteries. LiPo cells can catch fire if overcharged, over-discharged, or punctured. Use a proper battery management system (BMS).
Wear safety glasses when soldering. Solder flux can spit. Capacitors under stress can vent. Laser modules require appropriate laser safety eyewear.
Solder fumes contain rosin flux vapour โ use a fume extractor or work in a well-ventilated area. Lead-free solder is safer but still produces fumes.
Versatile analog building blocks for amplification, filtering, and signal processing
An op-amp is a high-gain differential amplifier in an IC package. It amplifies the difference between two inputs (V+ and Vโ). With just a few resistors, the same op-amp can be a voltage amplifier, comparator, oscillator, filter, or mathematical operator.
Pin 2: Inverting input (Vโ) ยท Pin 3: Non-inverting input (V+) ยท Pin 6: Output ยท Pins 4 & 7: Negative and positive supply rails. Common ICs: LM741, LM358, TL071.
Input connects to Vโ through Rin. Feedback resistor Rf connects output to Vโ. Gain = โRf / Rin. Output is inverted. Example: Rin=10kฮฉ, Rf=100kฮฉ โ Gain = โ10.
Input connects to V+. Feedback divider to Vโ. Gain = 1 + (Rf / Rin). Output is in phase with input. Always gain โฅ 1. Great for buffering high-impedance sensors.
No feedback โ output swings to rail (HIGH or LOW) based on which input is greater. Used to detect threshold crossings: temperature alarms, zero-crossing detectors, light sensors.
Output connected directly to Vโ. Gain = 1. Acts as an impedance buffer โ copies voltage but draws virtually no current from the source. Protects sensitive signal sources.
Multiple input resistors to Vโ. Output = โ(V1/R1 + V2/R2 + V3/R3) ร Rf. Mixes multiple signals. Used in audio mixers, DAC circuits, and weighted adders.
In a closed-loop inverting amp, the Vโ input is held at virtually 0V by feedback โ it's called a "virtual ground". This simplifies circuit analysis enormously.
Maximum rate the output can change (V/ยตs). If the input changes faster than the slew rate, the output distorts. LM741: 0.5 V/ยตs. TL071: 13 V/ยตs. Choose IC for frequency.
Integrator: replace Rf with a capacitor โ output is the integral of the input (ramp from constant). Differentiator: replace Rin with capacitor โ outputs the rate of change.
Standard op-amps can't reach their supply rails. Rail-to-rail types (e.g. MCP6001, LMV358) output near 0V and near Vcc. Essential for single-supply 3.3V/5V systems.
One of the most versatile and widely used ICs ever made
The NE555 timer (introduced 1972) generates precise time delays and oscillations using just a few resistors and a capacitor. It operates in three main modes: monostable (one-shot pulse), astable (free-running oscillator), and bistable (flip-flop). Runs from 5Vโ15V and can source/sink up to 200mA.
1: GND ยท 2: Trigger (starts timing, active LOW) ยท 3: Output ยท 4: Reset (active LOW) ยท 5: Control Voltage ยท 6: Threshold (stops timing) ยท 7: Discharge ยท 8: Vcc
Triggered by a LOW pulse on pin 2. Output goes HIGH for a precise time then returns LOW. One single pulse regardless of trigger length. Timer ends when capacitor reaches 2/3 Vcc.
No external trigger needed โ continuously oscillates. Output is a square wave. Charge time (HIGH): 0.693ร(Ra+Rb)รC. Discharge time (LOW): 0.693รRbรC. Frequency = 1.44 / ((Ra+2Rb)รC).
Pin 2 (trigger) sets output HIGH. Pin 4 (reset) sets output LOW. Behaves like an SR latch โ holds its state until triggered. No capacitor needed. Used for debouncing switches.
In astable mode: Duty = (Ra + Rb) / (Ra + 2Rb) ร 100%. For 50% duty cycle, use a diode to bypass Ra on discharge path โ or use the CMOS 555 variant (TLC555).
Normally bypassed with 10nF cap to GND. Applying a voltage here shifts the internal threshold โ allows voltage-controlled oscillation (VCO). Used in tone modulators.
Astable 555 directly driving a small speaker or buzzer produces an audible tone. Frequency = 1.44/((Ra+2Rb)รC). Ra=1kฮฉ, Rb=10kฮฉ, C=10nF โ approx 1.3kHz.
Classic beginner project: astable 555 with Ra=4.7kฮฉ, Rb=47kฮฉ, C=100ยตF โ ~0.2Hz flash rate (5s cycle). Add second LED on opposite phase via inverter for alternating flash.
Operates from 2Vโ15V, draws only 1ยตA quiescent current vs 6mA for bipolar 555. Essential for battery-powered circuits. Same pinout, more stable frequency at low voltages.
For delays beyond a few minutes, use large RรC values or chain two 555s. With R=10Mฮฉ and C=470ยตF: t โ 5166s (86 minutes). Leakage current limits accuracy at very long intervals.
Pulse Width Modulation โ controlling power with digital signals
PWM (Pulse Width Modulation) varies the average power delivered to a load by rapidly switching between fully ON and fully OFF. The ratio of ON time to total period is the duty cycle. Since the switching happens faster than the load responds, it sees a steady average voltage. Used for motor speed control, LED dimming, servo positioning, and digital-to-analog conversion.
Duty cycle = (ON time / Period) ร 100%. 0% = always OFF. 100% = always ON. 50% duty at 12V delivers average 6V to the load. Higher frequency = smoother result.
Vavg = Vsupply ร (Duty / 100). A 5V PWM at 75% duty gives 3.75V average. Add an RC low-pass filter (see Filters section) to smooth PWM into a true DC analog voltage.
A logic-level MOSFET (e.g. IRLZ44N) driven by a microcontroller PWM pin can switch amps of motor current. Add a flyback diode across the motor โ never omit this.
Four switches (MOSFETs or BJTs) in an H-bridge arrangement allow bidirectional motor control โ forward, reverse, brake, and coast. ICs: L298N (5A), L293D (1A), DRV8833 (1.5A).
Servos use PWM at 50Hz (20ms period). Pulse width 1ms = 0ยฐ, 1.5ms = 90ยฐ, 2ms = 180ยฐ. Microcontrollers generate this easily. Servos have built-in position feedback and gearing.
PWM dimming maintains constant LED colour temperature at all brightness levels (unlike resistor dimming which changes colour). Use 1kHz+ frequency to avoid visible flicker. Persistence of vision threshold ~100Hz.
Motors: 1โ20kHz (audible whine at low freq). LEDs: >200Hz (flicker-free). Servos: 50Hz. Audio DAC: >40kHz (above hearing). Higher freq = more switching losses in MOSFETs.
In H-bridges, both high and low side switches must never be ON simultaneously โ this causes shoot-through (dead short). Gate drivers add dead-time to prevent this. Critical in power electronics.
Stepper motors move in discrete steps (e.g. 200 steps/revolution). Driven by sequences of pulses to coil pairs. Drivers: A4988, DRV8825. Steps can be microstepped for smoother motion.
Running motors generate a back-EMF opposing the supply. Back-EMF โ motor speed โ used to measure RPM without sensors. A small series resistor (0.1ฮฉ) measures current via voltage drop (I=V/R).
Shaping signals by allowing or blocking specific frequencies
A filter selectively passes or blocks signals based on frequency. Passive filters use only resistors, capacitors, and inductors. Active filters add op-amps for amplification and sharper roll-off. Filters are essential in audio, power supplies, communication systems, and noise reduction.
Passes low frequencies, blocks high. RC circuit: R in series, C to ground. At cutoff frequency, output = 70.7% of input (โ3dB). Used to smooth PWM output and remove high-frequency noise.
Passes high frequencies, blocks low (and DC). C in series, R to ground. Same cutoff formula. Used to remove DC offset from audio signals and isolate AC components of a waveform.
Passes a range of frequencies between two cutoff points. HPF + LPF in series (or resonant LC). Used in radio tuners, audio equalisers, and communication receivers.
Blocks a specific frequency band โ the opposite of band-pass. Twin-T notch filter eliminates one frequency precisely. Classic use: removing 50/60Hz mains hum from audio signals.
R=10kฮฉ, C=1ยตF โ fc = 15.9Hz (audio subsonic filter) ยท R=1kฮฉ, C=100nF โ fc = 1.59kHz ยท R=100ฮฉ, C=10nF โ fc = 159kHz (RF bypass)
Inductor (L) + capacitor (C) filters have steeper roll-off (โ40dB/decade) than RC (โ20dB/decade). Used in power supply output filters and RF circuits. Resonant frequency: f = 1/(2ฯโ(LC)).
Op-amp based 2nd-order filter with โ40dB/decade roll-off. Butterworth: maximally flat passband. Chebyshev: steeper roll-off with ripple. Bessel: best phase linearity for audio.
Every IC power pin needs a 100nF ceramic capacitor to GND, placed as close as possible. Acts as a local charge reservoir and high-frequency low-pass filter, preventing noise from corrupting the supply rail.
1st order (single RC): โ20dB/decade above fc. 2nd order (two RC stages): โ40dB/decade. Each additional order adds โ20dB/decade steepness. Higher order = sharper cutoff = more components.
To convert 1kHz PWM into smooth DC: choose fc at least 1/10th of PWM frequency. For 1kHz PWM: fc = 100Hz โ R=10kฮฉ, C=160nF (use 150nF). Ripple โ Vavg/(fรRรC).
Programmable digital brains โ the core of modern embedded systems
A microcontroller (MCU) is a complete computer on a single chip: processor, RAM, flash memory, and I/O peripherals in one package. Unlike a microprocessor (which needs external memory and peripherals), an MCU is self-contained and designed to run embedded code that interacts directly with hardware.
General Purpose Input/Output pins. Configurable as input (read button/sensor) or output (drive LED/relay). Logic HIGH = Vcc (3.3V or 5V), LOW = 0V. Most MCU pins source 8โ25mA maximum โ use transistors for larger loads.
Converts analog voltage to a digital number. 10-bit ADC: 0โ1023 (Arduino Uno). 12-bit ADC: 0โ4095 (STM32, RP2040). Resolution = Vref / 2^N. Used to read potentiometers, temperature sensors, microphones.
Hardware PWM channels generate precise duty cycles without CPU overhead. Used for motor speed, LED dimming, servo control, and buzzer tones. Arduino: analogWrite(pin, 0โ255) = 0โ100% duty at ~490Hz.
Two-wire asynchronous serial: TX (transmit) and RX (receive). Common baud rates: 9600, 115200 bps. Used to communicate with PCs, GPS modules, Bluetooth/Wi-Fi modules. No clock line โ both ends must agree on baud rate.
SDA (data) and SCL (clock). Multiple devices share one bus, each with a unique 7-bit address. Speeds: 100kHz (standard), 400kHz (fast). Needs pull-up resistors (4.7kฮฉ typical). Used for sensors, displays, EEPROMs.
4 wires: MOSI, MISO, SCK, CS. Full-duplex, faster than I2C (up to 50MHz+). Each device needs its own CS (chip select) line. Used for SD cards, display drivers, fast ADCs, and flash memory.
5V, 16MHz, 32KB flash, 2KB RAM. 14 digital I/O, 6 PWM, 6 ADC pins. Huge library ecosystem. 5V logic โ level-shift before connecting 3.3V peripherals. Best for beginners and prototyping.
3.3V, dual-core ARM Cortex-M0+ at 133MHz, 264KB RAM, 2MB flash. 26 GPIO, 2 UART, 2 SPI, 2 I2C, 16 PWM, 3 ADC. Programmable in MicroPython or C/C++. Excellent for real-time applications.
Professional 32-bit ARM Cortex-M series. 3.3V. Wide range from STM32F0 (48MHz, budget) to STM32H7 (480MHz, dual-core). Used in industrial, automotive, and medical devices. Steep learning curve, powerful peripherals.
3.3V dual-core 240MHz, Wi-Fi + Bluetooth built in, 34 GPIO, 12-bit ADC, touch sensing, Hall sensor, 4MB flash. Programmable via Arduino IDE or ESP-IDF. The go-to choice for IoT and wireless projects.
Floating inputs pick up noise and read randomly. A pull-up (10kฮฉ to Vcc) holds pin HIGH until pulled LOW by a switch. A pull-down (10kฮฉ to GND) holds pin LOW. Most MCUs have built-in pull-ups โ enable in software.
5V and 3.3V devices must not be connected directly โ 5V signals damage 3.3V MCU pins. Use a voltage divider (R1=1kฮฉ, R2=2kฮฉ) for one-way logic, or a dedicated level shifter (TXB0108, BSS138 FETs) for bidirectional I2C/SPI.
Power the MCU from a regulated supply (LDO or SMPS). Decouple Vcc pin with 100nF + 10ยตF capacitors to GND. USB power from a PC is limited to 500mA. Use external 5V/1A+ adapter for motor projects.
Hardware interrupts respond to pin changes instantly without polling. Timers run independently of main code โ used for PWM generation, measuring pulse width, scheduled tasks, and watchdog resets to recover from crashes.