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.
Programmable Logic Controllers: the computers that run factories
A PLC (Programmable Logic Controller) is a ruggedised industrial computer that controls machinery β conveyors, presses, packaging lines, traffic lights, building systems. Where a hobby microcontroller runs one program on a breadboard, a PLC runs 24/7 in electrical cabinets, survives vibration, electrical noise, and temperature extremes, and is programmed in a language electricians can read: ladder logic.
A PLC runs an endless loop: 1) Read all inputs into memory, 2) Execute the logic top-to-bottom, 3) Write all outputs at once. One full loop is a "scan," typically 1β20 ms. This matters: an input that changes mid-scan isn't seen until the next scan, and outputs only update at the end β never mid-logic.
Programs look like relay wiring diagrams: two vertical power rails with horizontal "rungs" between them. Each rung reads left to right: conditions (contacts) on the left, actions (coils) on the right. If the logical path across a rung is TRUE, the coil energises. It was designed so plant electricians could read programs like the relay panels they replaced.
Normally Open β| |β passes power when its input is ON (like a push button making contact). Normally Closed β|/|β passes power when its input is OFF. Contacts don't switch real electricity β they test the state of an input, output, or internal bit in memory. Series contacts = AND logic; parallel branches = OR logic.
A coil β( )β sets a bit ON when its rung is true, OFF when false. Output coils drive real hardware: motor contactors, valves, lamps. Internal coils (memory bits) store states like "machine running" for use in other rungs. Set (S) and Reset (R) coils latch a bit ON or OFF until the opposite instruction fires.
The most famous rung in industry β Start/Stop motor control: a Start button (NO) in parallel with the motor's own output contact, in series with a Stop button (NC). Press Start β motor coil energises β its contact closes and "seals in" around the Start button, so the motor stays running when you release it. Press Stop β the rung breaks β motor drops out. Every PLC programmer learns this first.
TON (On-Delay): output turns ON after the input has been true for the preset time β e.g. "run the fan 5 s after the motor starts." TOF (Off-Delay): output stays ON for a time after the input goes false β e.g. "keep the cooling fan running 30 s after shutdown." RTO (Retentive): accumulates time across interruptions until reset β used for maintenance-hour counters.
CTU (Count Up) increments on each rising edge of its input β count bottles past a sensor, boxes on a pallet. CTD (Count Down) decrements. When the accumulated count reaches the preset, the counter's done bit turns ON β "24 bottles counted β index the crate." Counters keep their value between scans and need an explicit Reset.
Inputs: push buttons, limit switches, proximity sensors, photo-eyes β usually 24V DC signals. Outputs: relay outputs switch anything but are slow; transistor outputs switch fast DC for indicator lamps and solenoid valves. Sinking vs sourcing describes current direction β mixing them up is the most common wiring fault in new installations.
An Arduino costs Β£20; a PLC costs Β£200βΒ£2000. The difference: certified reliability, screw-terminal I/O at 24V industrial levels, hot-swappable modules, online editing (change logic while the machine runs), and decades of guaranteed spare parts. Use a microcontroller for products and prototypes; use a PLC when downtime costs money and an electrician must maintain it.
Energy storage in magnetic fields β the partner to capacitors
An inductor is a coil of wire that stores energy in a magnetic field when current flows through it. It resists changes in current the same way a capacitor resists changes in voltage. Together, inductors and capacitors form the foundation of filtering, oscillators, and power conversion.
When current flows through a coil, it creates a magnetic field. If current changes, the field collapses and induces a voltage opposing the change (Lenz's Law). This is called back-EMF. The faster the current changes, the larger the opposing voltage.
Measured in Henries (H), millihenries (mH), microhenries (Β΅H). The larger the coil, the more inductance. Adding a ferromagnetic core (iron, ferrite) multiplies inductance dramatically. Typical values: 1Β΅H (RF) to 100mH (audio).
XL = 2ΟfL. At higher frequencies, inductors present higher resistance to AC signals (opposite to capacitors). At DC (f=0), an ideal inductor is a short circuit β just wire resistance. At high frequency, it blocks AC completely.
E = Β½LIΒ². An inductor storing 1A through 1H holds 0.5 joules. Unlike capacitors, inductors store energy in a magnetic field, not an electric field. When power is cut, this energy must go somewhere β causing voltage spikes that can destroy transistors.
When an inductor (relay coil, motor) is switched off, the collapsing field produces a reverse voltage spike that can reach hundreds of volts. A flyback diode (also called a freewheeling diode) placed across the inductor provides a safe path for this energy, protecting your transistor or MOSFET driver.
Two coils sharing a magnetic core. The turns ratio determines voltage step-up or step-down: Vs/Vp = Ns/Np. Power is conserved: if voltage doubles, current halves. Used in mains power supplies, audio isolation, and impedance matching. Transformers only work with AC β not DC.
Air core: Low inductance, used at RF. Ferrite core: High inductance, used in switch-mode power supplies (SMPS). Toroid: Self-shielding ring core, low EMI, used in power supplies. Choke: Blocks high-frequency noise in power lines.
An inductor and capacitor in a tank circuit oscillate at f = 1/(2ΟβLC). Energy sloshes back and forth between magnetic field (L) and electric field (C). This principle underlies radio transmitters, receivers, and analog oscillators.
Understanding waveforms, frequency, and how signals carry information
Every electrical measurement in electronics is a signal β a voltage or current that varies with time to carry information. Understanding how signals are characterised, measured, and manipulated is fundamental to all electronics work beyond simple DC circuits.
Amplitude: Peak voltage from zero (or peak-to-peak). Frequency (f): Cycles per second in Hz. Period (T): Time for one cycle, T = 1/f. Phase: Time offset between two signals of same frequency, measured in degrees (0β360Β°) or radians.
Root Mean Square β the DC-equivalent heating value of an AC signal. For a sine wave: Vrms = Vpeak Γ 0.707. Mains voltage is quoted in RMS (230Vrms = 325V peak). Multimeters measure AC in RMS. Use RMS for power calculations: P = VrmsΒ²/R.
For square/PWM waves: Duty Cycle = (t_on / Period) Γ 100%. 50% duty = equal on/off time. PWM at 25% duty, 5V peak β 1.25V average. Average voltage = Vpeak Γ duty cycle. Used to control motor speed, LED brightness, and servo position.
The range of frequencies a circuit can handle. An audio amplifier might have 20Hzβ20kHz bandwidth. An oscilloscope probe must have bandwidth higher than the signal being measured. The -3dB frequency is where amplitude drops to 70.7% of its value β the conventional bandwidth limit.
A square wave is actually a sum of sine waves: fundamental frequency + all odd harmonics (3rd, 5th, 7thβ¦). This is Fourier decomposition. A 1kHz square wave contains 1kHz, 3kHz, 5kHz, 7kHz... components. This is why filters and bandwidth matter for square wave circuits.
Logarithmic ratio used to express gains and losses. Voltage: dB = 20 Γ log10(Vout/Vin). Power: dB = 10 Γ log10(Pout/Pin). Key values: +6dB β voltage doubled Β· -3dB = voltage Γ· β2 (half power) Β· 0dB = no change Β· -20dB = Γ·10 in voltage.
Analog: continuous voltage β can be any value within a range (audio, sensor outputs). Digital: only two voltage levels (HIGH/LOW). Digital signals are more immune to noise but require ADC conversion to represent real-world values. Most real-world signals are analog; most processors are digital.
SNR = 20Β·log10(Vsignal/Vnoise) in dB. Higher SNR = cleaner signal. CD audio: 96dB SNR. A noisy sensor might have 40dB. Improve SNR by shielding cables, decoupling power supply, using differential signalling (like RS-485), and averaging multiple ADC readings.
Voltage regulators, MOSFETs, and controlling power efficiently
Power electronics deals with converting, controlling, and conditioning electrical power. From the humble voltage regulator to switch-mode power supplies and motor drives, these circuits handle energy rather than just signals.
The simplest voltage regulator β drops excess voltage as heat. 7805: 5V out, needs at least 7V in. LM317: adjustable 1.25β37V. Low Dropout (LDO) types like LD1117 work with just 1.1β1.3V headroom. Efficiency = Vout/Vin. At 5V out from 12V in: only 41% efficient β the rest is wasted as heat.
Switch transistors on/off at 20β500kHz to transfer energy efficiently through an inductor. Buck converter: steps voltage down. Boost converter: steps voltage up. Buck-boost: either. Typical efficiency 85β95% vs 40β60% for linear regulators. More complex but essential for battery-powered devices.
N-channel MOSFET (IRFZ44N, 2N7000): Gate voltage above threshold (~2β4V) fully turns it ON β low resistance (RDS_on). Used for high-side and low-side switching. Gate is voltage-controlled (no gate current needed). P-channel MOSFETs switch the high side more simply but have higher RDS_on. Logic-level MOSFETs (threshold 2β3V) can be driven directly by MCU pins.
Li-Po / Li-Ion: 3.7V nominal, 4.2V full, 3.0V cutoff. High energy density. Never discharge below 3V or overcharge above 4.2V β use a BMS. NiMH: 1.2V/cell, safe, rechargeable. LiFePO4: 3.2V, safer chemistry, longer cycle life, used in EVs and solar storage. Always use the correct charger.
Power = heat. P_dissipated = (Vin β Vout) Γ Iout for linear regulators. Thermal resistance (Β°C/W): junction-to-case + case-to-ambient. TO-220 package on heatsink: 5β10Β°C/W. Without heatsink: 50Β°C/W. Junction temperature must stay below 125β150Β°C. Add heatsinks whenever dissipating more than 0.5W in a small package.
Four switches arranged in an H-shape allow current to flow through a motor in either direction (forward/reverse). Common ICs: L298N (2A), TB6612FNG (1.2A), DRV8833 (1.5A). Enable pin controls speed via PWM. Always include flyback diodes across motor terminals to suppress back-EMF spikes.
How the physical world connects to electronic circuits
A sensor converts a physical quantity (temperature, light, pressure, motion) into an electrical signal. A transducer converts energy from one form to another in either direction (a speaker and microphone are both transducers for sound/electrical energy). Understanding how to interface sensors correctly is essential for any embedded system project.
NTC Thermistor: Resistance decreases with temperature. Use voltage divider with fixed resistor, read with ADC. Cheap but nonlinear β use Steinhart-Hart equation. LM35: Analog, 10mV/Β°C, 0β150Β°C, direct ADC. DS18B20: Digital, 1-Wire protocol, Β±0.5Β°C accuracy, multiple on one wire. DHT22: Temperature + humidity, digital, 2-wire.
LDR (Photoresistor): Resistance decreases in light. Use voltage divider, read with ADC. Slow response, adequate for ambient light. Photodiode: Fast, linear β used in optical links, receivers. Phototransistor: Amplified photodiode, used in IR receivers. BH1750: I2C digital lux sensor with calibrated output.
HC-SR04 Ultrasonic: Sends 40kHz burst, measures echo time. Range 2cmβ4m. Distance = (time Γ 343m/s) / 2. Good for robotics. IR Proximity (TCRT5000): Detects nearby objects at ~1cm. VL53L0X: Time-of-Flight laser, I2C, 0β2m, Β±3% accuracy. PIR (HC-SR501): Detects motion via infrared β used in alarm systems.
MPU-6050: 3-axis accelerometer + gyroscope on one I2C chip. Accelerometer measures linear acceleration (including gravity). Gyroscope measures rotation rate in Β°/s. Combine with complementary or Kalman filter to get stable angle estimation. Used in drones, robots, gesture detection.
Electret Microphone: Requires 3.3β10V bias through 10kΞ© resistor, outputs AC audio signal. Add op-amp preamp (Γ100 gain) before ADC. INMP441: I2S digital MEMS microphone, direct to ESP32. BMP280/BME280: Barometric pressure + altitude + temperature, I2C/SPI. Altitude from pressure: every 100m rise β 12 hPa drop.
Rotary encoder: Two quadrature signals (A/B) give both position and direction. Count rising edges on A; check B to determine direction. Hall Effect sensor (SS49E): Analog output proportional to magnetic field β used for non-contact current sensing, gear tooth detection. Potentiometer: Simplest position sensor β resistive divider, read with ADC.
The craft behind real circuits β tools, technique, and inspection
Soldering is the process of joining electrical conductors using a fusible metal alloy (solder). A good solder joint is both electrically and mechanically reliable. Poor soldering β cold joints, bridges, or insufficient heat β is the cause of more project failures than bad circuit design.
Lead solder (Sn63/Pb37): melt point 183Β°C β iron at 320β350Β°C. Lead-free (Sn96.5/Ag3/Cu0.5): melt point 217Β°C β iron at 350β380Β°C. Too cold: cold joints, dull finish. Too hot: damaged pads, burnt flux, delaminated PCB. A quality iron with temperature control (Hakko FX-888D, TS100) is worth the investment.
Good joint: Bright, shiny (leaded) or slightly matte (lead-free), concave fillet, flows all around pin and pad. Cold joint: Dull, grainy, cracked β electrically intermittent. Reheat and add fresh solder. Bridge: Solder connects two adjacent pads β use solder wick or desoldering pump to remove. Insufficient: Not enough solder for mechanical strength.
Soldering iron: Temperature controlled, 40W+. Solder: 0.5β0.8mm rosin-core. Flux: Cleans oxide, improves flow β reapply for rework. Desoldering wick: Copper braid absorbs solder. Solder sucker: Pump for through-hole desoldering. PCB holder/third hand: Keeps work stable. Tip cleaner: Brass wool or wet sponge β clean before every joint.
1. Heat pad and lead simultaneously for 2β3 seconds. 2. Apply solder to the joint (not the iron). 3. Remove solder, then iron. 4. Inspect β should flow with a concave fillet. 5. Clip excess lead after joint cools. Common mistake: heating only the lead, not the pad β solder doesn't flow onto cold copper.
Surface Mount Devices. Drag soldering: apply flux, drag iron across IC pins. Solder paste + hot air: apply paste, place components, heat with hot air gun (350Β°C). Reflow oven: professional method. 0402 and smaller need magnification. Tweezer tip iron helps with fine pitch ICs. Flux is your best friend β use generously and clean afterwards.
PCB layers: copper traces, soldermask (green/black/red coating), silkscreen (white labels). FR4 standard substrate. Track width vs current: 0.25mm handles ~0.5A, 1mm handles ~2.5A (IPC-2221). Ground planes reduce noise and thermal resistance. Via: plated hole connecting layers. Minimum via diameter 0.3mm in most fab processes.
A systematic approach to finding and fixing faults
Debugging is a skill that separates experienced engineers from beginners. The difference is not luck β it's a systematic process: observe the symptom, form a hypothesis, test it, and iterate. Random component swapping without measurement is the slowest route to a working circuit.
Start every debug session by verifying power. Measure Vcc at the IC pin, not just at the power connector. Check for voltage sag under load β a weak supply may read 5V unloaded but 3.2V with everything connected. Measure GND continuity between all boards in the system. Most failures trace back to poor power delivery.
Continuity: Test wiring before powering up. Voltage: Always measure with respect to GND. Diode test: Check LEDs, protection diodes. Resistance: Measure off-circuit to avoid parallel paths giving false readings. DC current: Must break the circuit to insert meter in series. Set to highest range first, work down.
See what the multimeter can't: signal shape, glitches, timing relationships. Check clock signals β are they present and at the right frequency? Look for noise on power rails (ripple, switching spikes). Verify UART/SPI/I2C communication by checking for activity. Measure rise/fall times for signal integrity.
Components running too hot reveal problems. A linear regulator burning hot means high current draw β find the load. A transistor running hot when it should be off suggests it's never fully saturated. LEDs running hot means current is too high. Thermal imaging cameras (FLIR, cheap USB units) are excellent for quickly spotting hot spots on a PCB.
Don't debug the whole system at once. Isolate subsystems: disconnect modules one at a time and see if the problem disappears. Comment out code sections to find software issues. Replace ICs one at a time to find a faulty component. Add test points (pads or loops of wire) at key nodes on your PCB during design β they're invaluable for debugging.
Intermittent: Cold solder joint β flex the PCB while probing. Works on bench, fails in product: Power supply too weak. MCU crashes: Floating inputs, missing decoupling caps. No comms: Wrong baud rate, missing pull-up resistors (I2C). Motor won't spin: Insufficient current, flyback diode wrong way. Oscillates: Op-amp without feedback resistor, insufficient bypass caps.