PickettTheory

Understanding the Building Blocks of Electronics

Electronics Theory — Learn Circuit Fundamentals

What is a Circuit?

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.

๐Ÿ”‹ Power Source

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

โžฟ Wires (Conductors)

What it does: Provides the path for electricity to flow. Made of conductive materials like copper.

๐Ÿ‘† Click to learn more

๐Ÿ“ Resistor

What it does: Limits the flow of electric current. Like a narrow pipe that slows down water flow.

๐Ÿ‘† Click to learn more

๐Ÿ’ก Load (LED Example)

What it does: Uses the electrical energy to do work - in this case, produce light. The "purpose" of the circuit.

๐Ÿ‘† Click to learn more

๐ŸŽš๏ธ Switch

What it does: Controls whether the circuit is ON or OFF by making or breaking the connection.

๐Ÿ‘† Click to learn more

โš Ground

What it does: Acts as the reference point (0V) that electricity returns to. Completes the circuit.

๐Ÿ‘† Click to learn more

โšก

How Circuits Work

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.

๐Ÿ”‹ Closed Circuit

A complete unbroken loop. Current flows, components work. The path goes from + terminal, through components, back to โˆ’ terminal.

โœ‚๏ธ Open Circuit

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.

โšก Short Circuit

Current finds a low-resistance path bypassing components. Causes high current, heat, and potential damage. Fuses protect against this.

๐ŸŒŠ Conventional Current

By convention, current flows from + to โˆ’. In reality, electrons flow from โˆ’ to +. Both models are used in electronics.

โšก Key Fact: Voltage is the "pressure" pushing current. Current is the "flow rate" of charge. Resistance is anything opposing that flow.
๐Ÿ“

Ohm's Law

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
Voltage (V) = Current (A) ร— Resistance (ฮฉ)

๐Ÿ” Find Voltage

V = I ร— R
Example: 0.02A through 470ฮฉ = 9.4V

๐Ÿ” Find Current

I = V รท R
Example: 9V รท 470ฮฉ = 0.019A (19mA)

๐Ÿ” Find Resistance

R = V รท I
Example: 9V รท 0.02A = 450ฮฉ

โšก Power Formula

P = V ร— I
Also: P = IยฒR and P = Vยฒ/R. Measured in Watts (W).

๐Ÿ’ก LED Resistor Tip: To find the correct resistor for an LED: R = (Supply voltage โˆ’ LED forward voltage) รท LED current. E.g. (9V โˆ’ 2V) รท 0.02A = 350ฮฉ. Use the next standard value up (360ฮฉ or 390ฮฉ).
๐Ÿ”—

Series & Parallel Circuits

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.

โฌ› Series Circuit

  • One path for current
  • Same current everywhere: Itotal = Iโ‚ = Iโ‚‚
  • Voltage splits: Vtotal = Vโ‚ + Vโ‚‚
  • Resistance adds: Rtotal = Rโ‚ + Rโ‚‚
  • One break stops everything
  • Used in: Christmas lights (old), fuses

โฌ› Parallel Circuit

  • Multiple paths for current
  • Same voltage across each: Vtotal = Vโ‚ = Vโ‚‚
  • Current splits: Itotal = Iโ‚ + Iโ‚‚
  • Resistance reduces: 1/Rtotal = 1/Rโ‚ + 1/Rโ‚‚
  • One break doesn't stop others
  • Used in: Home wiring, LED strips
๐Ÿ  Real World: Your home is wired in parallel โ€” each socket gets the full 230V and turning one appliance off doesn't affect others.
โšก

Capacitors

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.

Q = C ร— V
Charge (C) = Capacitance (F) ร— Voltage (V)

๐Ÿ”ต Electrolytic

High capacitance (1ยตFโ€“10,000ยตF). Polarised โ€” must be connected + to + and โˆ’ to โˆ’. Used for power supply smoothing.

๐ŸŸก Ceramic

Small capacitance (1pFโ€“100nF). Non-polarised. Used for decoupling and noise filtering in high-frequency circuits.

โฑ๏ธ RC Time Constant

ฯ„ = R ร— C. Time (seconds) for a capacitor to charge to ~63% of supply voltage. After 5ฯ„ it's considered fully charged.

๐Ÿ”Š AC vs DC

Capacitors block DC current but pass AC signals. This makes them useful for coupling audio signals and filtering power rails.

โš ๏ธ Polarity Warning: Installing an electrolytic capacitor backwards can cause it to overheat and rupture. Always check the โˆ’ marking (white stripe) and the longer leg (+).
โ–ถ

Diodes & LEDs

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.

โ–ถ Standard Diode

~0.7V forward voltage drop (silicon). Used in rectifier circuits to convert AC to DC. The cathode is marked with a silver band.

๐Ÿ’ก LED

Light Emitting Diode. Forward voltage ~1.8Vโ€“3.5V depending on colour. Always needs a current-limiting resistor to prevent burnout.

โšก Zener Diode

Designed to operate in reverse breakdown at a precise voltage. Used as voltage regulators and references in power supplies.

๐Ÿ”’ Schottky Diode

Very low forward voltage (~0.2โ€“0.4V) and fast switching. Used in high-frequency circuits and preventing reverse current in battery systems.

๐Ÿ’ก LED Colours & Voltage: Red/Yellow โ‰ˆ 2.0V ยท Green โ‰ˆ 2.2V ยท Blue/White โ‰ˆ 3.2V. Higher voltage LEDs need less resistance for the same current.
๐Ÿ”Œ

Transistors

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.

๐Ÿ“ฆ BJT โ€” NPN

Terminals: Base, Collector, Emitter. A small base current controls a larger collector current. Common for switching loads like motors and LEDs.

๐Ÿ“ฆ BJT โ€” PNP

Opposite polarity to NPN. Current flows from Emitter to Collector, controlled by pulling Base low. Used in high-side switching.

โšก MOSFET

Voltage-controlled device (Gate, Drain, Source). Extremely low power consumption in logic state. Used in power switching and microcontroller output stages.

๐Ÿ”ข Gain (hFE / ฮฒ)

The current amplification factor. If ฮฒ = 100 and base current = 1mA, then collector current = 100mA. Allows small signals to control large loads.

๐Ÿ”Œ Switch Rule: For a transistor to be fully ON (saturated), the base current must be at least IC / ฮฒ. Always calculate โ€” too little base current and the transistor won't fully switch.
๐Ÿง 

Logic Gates

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.

AND Gate

Output is HIGH only when ALL inputs are HIGH. Symbol: D-shape. Used in safety interlock systems.

ABOUT
000
010
100
111

OR Gate

Output is HIGH when ANY input is HIGH. Symbol: Curved shield. Used in alarm systems.

ABOUT
000
011
101
111

NOT Gate (Inverter)

Flips the input. HIGH becomes LOW, LOW becomes HIGH. One input only. The bubble symbol means inversion.

AOUT
01
10

NAND & NOR

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.

XOR Gate

Exclusive OR โ€” output HIGH only when inputs are DIFFERENT. Used in binary adders, error detection, and encryption circuits.

ABOUT
000
011
101
110

Boolean Laws

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

ใ€œ

AC vs DC

Two types of electrical power

ใ€œ Alternating Current (AC)

  • Direction reverses periodically
  • UK mains: 230V, 50Hz
  • US mains: 120V, 60Hz
  • Efficient for long-distance transmission
  • Used in homes, industrial power
  • Transformers change AC voltage easily
  • Dangerous โ€” can cause fibrillation

โŽ“ Direct Current (DC)

  • Flows in one direction only
  • Batteries: 1.5V, 3.7V, 9V, 12V
  • All microcontrollers run on DC
  • USB: 5V DC
  • Produced by batteries, solar cells, rectifiers
  • Easier to store (batteries/capacitors)
  • Safer for electronics work
๐Ÿ”Œ Rectification: AC is converted to DC using a bridge rectifier (4 diodes) followed by a smoothing capacitor. This is inside every phone charger and power adapter.
๐Ÿ›ก๏ธ

Electrical Safety

Essential rules for working with electronics

โš ๏ธ Mains Voltage (230V/120V AC) is lethal. Never work on mains-connected equipment without proper training and isolation. Even capacitors in unplugged devices can hold dangerous charge.

โœ… Safe Voltages

Always work with low-voltage DC for learning: 3.3V, 5V, 9V, 12V. Use a bench power supply with current limiting, not mains directly.

๐Ÿ”ง ESD Protection

Electrostatic discharge can destroy microcontrollers and ICs instantly. Use an anti-static wrist strap and mat when handling sensitive components.

๐Ÿ”ฅ Short Circuit

Always use a fuse or current-limited supply. A short circuit can overheat wires, melt insulation, and start fires within seconds.

๐Ÿ”‹ Battery Safety

Never short-circuit batteries. LiPo cells can catch fire if overcharged, over-discharged, or punctured. Use a proper battery management system (BMS).

๐Ÿ‘“ Eye Protection

Wear safety glasses when soldering. Solder flux can spit. Capacitors under stress can vent. Laser modules require appropriate laser safety eyewear.

๐Ÿ’จ Ventilation

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.

๐Ÿ›ก๏ธ Current Kills, Not Voltage: It takes as little as 10mA through the heart to cause fibrillation. However, high voltage is what forces dangerous current through the body's resistance. Stay safe โ€” when in doubt, power off.
๐Ÿ”Š

Operational Amplifiers (Op-Amps)

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.

๐Ÿ“Œ Pinout (8-pin DIP)

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.

๐Ÿ” Inverting Amplifier

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.

โž• Non-Inverting Amplifier

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.

โš–๏ธ Voltage Comparator

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.

๐Ÿ”‹ Unity Gain Buffer

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.

โž— Summing Amplifier

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.

Inverting Gain = โˆ’Rf / Rin  |  Non-Inverting Gain = 1 + Rf / Rin
Resistor ratio sets the gain โ€” op-amp itself has near-infinite open-loop gain (~100,000ร—)

๐Ÿ“ Virtual Ground

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.

โšก Slew Rate

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 & Differentiator

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.

๐Ÿ›ก๏ธ Rail-to-Rail Op-Amps

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.

๐Ÿ”Š Golden Rules of Op-Amps (closed loop): 1) No current flows into the input terminals. 2) The op-amp adjusts its output to make V+ = Vโˆ’. These two rules let you analyse almost any op-amp circuit by inspection.
โฑ๏ธ

555 Timer IC

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.

๐Ÿ“Œ Pinout (8-pin DIP)

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

โšก Monostable Mode

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.

ใ€œ Astable Mode

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).

๐Ÿ”€ Bistable Mode

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.

Monostable: t = 1.1 ร— R ร— C  |  Astable: f = 1.44 / ((Ra + 2Rb) ร— C)
t in seconds, R in ohms, C in farads, f in Hz

๐Ÿ” Duty Cycle

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).

๐ŸŽ›๏ธ Control Voltage (Pin 5)

Normally bypassed with 10nF cap to GND. Applying a voltage here shifts the internal threshold โ€” allows voltage-controlled oscillation (VCO). Used in tone modulators.

๐Ÿ”Š Tone Generator

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.

๐Ÿ’ก LED Flasher

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.

๐Ÿ›ก๏ธ CMOS 555 (TLC555)

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.

โณ Long Timers

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.

โฑ๏ธ Internal Voltage Divider: The 555 has three equal 5kฮฉ resistors inside forming a divider (hence the name โ€” 5-5-5). The comparators trip at 1/3 Vcc (trigger) and 2/3 Vcc (threshold). These thresholds scale automatically with supply voltage.
๐ŸŽ›๏ธ

PWM & Motor Control

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

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.

โšก Average Voltage

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.

๐Ÿ”Œ MOSFET Switch

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.

๐Ÿ” H-Bridge

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).

๐Ÿค– Servo Motors

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.

๐Ÿ’ก LED Dimming

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.

Vavg = Vsupply ร— Duty% / 100  |  Frequency = 1 / Period
Example: 12V at 60% duty = 7.2V average ยท 20ms period = 50Hz

๐Ÿ”ข PWM Frequency Selection

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.

๐Ÿ›ก๏ธ Dead Time & Shoot-Through

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

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.

๐Ÿ“ Back-EMF & Current Sensing

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).

๐ŸŽ›๏ธ Flyback Diode is Mandatory: When a motor's PWM switches OFF, the collapsing magnetic field generates a voltage spike that can be 10ร— the supply. A Schottky diode (e.g. 1N5819) across the motor clamps this spike and protects your driver IC.
๐Ÿ“ก

Filters & Frequency Response

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.

๐Ÿ”ป Low-Pass Filter (LPF)

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.

๐Ÿ”บ High-Pass Filter (HPF)

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.

ใ€ฐ๏ธ Band-Pass Filter

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.

๐Ÿšซ Band-Stop (Notch) Filter

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.

Cutoff Frequency: fc = 1 / (2ฯ€ ร— R ร— C)
At fc the output is โˆ’3dB (70.7% of input). Phase shift = โˆ’45ยฐ. Above fc (LPF) signal is attenuated at โˆ’20dB/decade.

๐Ÿ“ Cutoff Frequency Examples

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)

โšก LC Filters

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)).

๐Ÿ”Š Active Sallen-Key Filter

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.

๐Ÿ“ป Decoupling Capacitors

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.

๐Ÿ“‰ Roll-Off & Order

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.

๐ŸŽš๏ธ PWM Smoothing

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).

๐Ÿ“ก Impedance Matching: For a filter to work as designed, the source impedance must be much lower than R, and the load impedance much higher than R. Violating this changes the cutoff frequency. Op-amp buffers on input and output eliminate these loading effects.
๐Ÿค–

Microcontrollers

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.

๐Ÿ“Œ GPIO โ€” Digital I/O

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.

ใ€œ ADC โ€” Analog to Digital

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.

๐ŸŽ›๏ธ PWM Output

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.

๐Ÿ“ก UART โ€” Serial Communication

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.

๐Ÿ”— I2C โ€” Two-Wire Bus

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.

โšก SPI โ€” High-Speed Bus

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.

๐ŸŸฆ Arduino (ATmega328P)

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.

๐ŸŸข Raspberry Pi Pico (RP2040)

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.

๐Ÿ”ต STM32

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.

๐ŸŒ ESP32

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.

ADC Value = (Vin / Vref) ร— (2^N โˆ’ 1)  |  Vin = ADC_Reading ร— Vref / (2^N โˆ’ 1)
N = bit depth. 10-bit at 5V: each ADC step = 4.88mV ยท 12-bit at 3.3V: each step = 0.806mV

๐Ÿ”บ Pull-Up & Pull-Down Resistors

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.

โšก Level Shifting

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 Considerations

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.

โฑ๏ธ Interrupts & Timers

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.

๐Ÿค– Pin Current Budget: GPIO pins are not power outputs. An Arduino pin sources max ~40mA, with a 200mA total port limit. Use transistors (BJT or MOSFET) to drive LEDs in strips, relay coils, motors, or any load above 20mA. Never draw power from signal pins.
โš ๏ธ 3.3V vs 5V Logic: Most modern MCUs (ESP32, RP2040, STM32) are 3.3V. Connecting a 5V sensor or module directly will permanently damage the MCU. Always check operating voltages and use level shifters. When in doubt, 3.3V is the safer choice.

๐Ÿ”‹ Power Source Explained

The energy provider of every circuit

๐Ÿ”‹ Example: AA Battery

A standard AA alkaline battery provides 1.5V

It can deliver this voltage until it's depleted. If you need more voltage, you stack them in series: 2ร—AA = 3V, 4ร—AA = 6V, etc.

The capacity (how long it lasts) is measured in mAh (milliamp-hours). A typical AA has ~2000-3000 mAh.

โžฟ Wires (Conductors) Explained

The pathways that carry electricity

โšก Example: LED Circuit

In an LED circuit: Wire connects battery + โ†’ resistor โ†’ LED โ†’ back to battery -

If ANY connection is broken (wire disconnected, component loose), the circuit is "open" and the LED won't light!

This is why breadboards and connectors are so important - they must make solid electrical contact.

๐Ÿ“ Resistor Explained

The current controller

๐Ÿ’ก Example: LED Current Limiting

You have a 9V battery and want to power a red LED (needs 2V and 20mA max current)

Calculation:

Voltage across resistor = 9V - 2V = 7V

Using Ohm's Law: R = V/I = 7V / 0.02A = 350ฮฉ

Use a 330ฮฉ or 470ฮฉ resistor (standard values) to safely limit current!

๐Ÿ’ก Load (LED Example) Explained

The component that does the work

โš ๏ธ What Happens Without a Resistor?

If you connect an LED directly to a battery without a resistor:

The LED will try to draw unlimited current โ†’ It will get extremely bright for a brief moment โ†’ Then it will burn out and die!

Always use a current-limiting resistor with LEDs!

๐ŸŽš๏ธ Switch Explained

The circuit controller

๐Ÿ’ก Example: Flashlight Switch

A flashlight uses a simple SPST slide or push button switch:

Switch OFF: Circuit is open โ†’ No current flows โ†’ LED stays dark

Switch ON: Circuit is complete โ†’ Current flows through resistor and LED โ†’ LED lights up!

The switch is usually placed between the battery positive and the rest of the circuit.

โš Ground Explained

The reference point for all voltages

๐Ÿ”‹ Example: 9V Battery Circuit

In a 9V battery LED circuit:

Positive terminal: +9V (relative to ground)

Negative terminal: 0V = Ground (our reference point)

Current flows from +9V โ†’ through components โ†’ back to 0V (ground)

Voltage "drops" across each component, always measured relative to ground!

โš ๏ธ Common Mistake

Problem: "My Arduino and sensor won't communicate!"

Likely cause: Grounds aren't connected

Solution: Connect Arduino GND to sensor GND

Even if both have separate power supplies, they MUST share a common ground for signals to be interpreted correctly!