Op-amps and Integrated Circuits
Op-amp circuits, comparators, the 555 timer, logic gates, voltage regulators and converters, and how to read a datasheet.
Integrated circuits
An integrated circuit (IC, or “chip”) packs many transistors, resistors and capacitors onto one piece of silicon. Chips range from a single op-amp to a complete microcontroller. You can treat most of them as a black box with a datasheet that tells you what each pin does and what the chip needs around it.
| Package | What it is | Hand-soldering |
|---|---|---|
| DIP | Dual in-line, through-hole, 2.54 mm pitch | Easy; fits breadboards and sockets |
| SOIC / SOP | Small outline, gull-wing leads, 1.27 mm pitch | Easy with practice |
| SOT-23, SOT-223 | Small transistors and regulators | Easy for three to six pins |
| TQFP / QFP | Leads on four sides, 0.4–0.8 mm pitch | Needs flux and a fine tip; drag soldering |
| QFN / BGA | Pads underneath | Hot air or reflow oven only |
- Pin 1 is marked with a dot or notch; count pins counter-clockwise (viewed from the top) from it.
- Power pins (Vcc/Vdd and GND/Vss) must be connected, with a 100 nF capacitor close to them (see Capacitors).
- Chips are damaged by static discharge and by pins taken beyond the supply range. Handle accordingly.
Op-amps
An operational amplifier has two inputs, the inverting (−) and non-inverting (+), and one output. It amplifies the difference between the inputs by an enormous factor (100 000 or more). That gain is far too large to use directly, so the op-amp is almost always used with negative feedback: part of the output is fed back to the − input, and the circuit’s gain is then set by external resistors alone.
The two rules of an ideal op-amp with feedback
- The inputs draw no current. (A real input takes pico- to nanoamps.)
- The output does whatever it takes to make the two inputs equal. So with feedback, the − input sits at the same voltage as the + input (a “virtual ground” if + is at ground).
Almost every op-amp circuit can be worked out from just those two rules.
Basic op-amp circuits
inverting: AV = − Rf ÷ Rin non-inverting: AV = 1 + Rf ÷ Rg follower: AV = 1
Worked example: gains of 10 kΩ and 1 kΩ
- Inverting: AV = −10 ÷ 1 = -10. An input of +0.2 V gives −2 V. The input impedance is only Rin (1 kΩ).
- Non-inverting: AV = 1 + 10 ÷ 1 = 11. An input of 0.2 V gives 2.2 V, in phase. The input impedance is very high.
- Voltage follower (output tied directly to the − input): gain 1. It copies the voltage but can drive a load that the source cannot. Use it as a buffer between a high-impedance sensor and a circuit.
- Summing amplifier: several inputs through their own resistors into the inverting node add together. This is how a mixer or a simple DAC works.
- Differential amplifier: amplifies the difference between two inputs and rejects what is common to both: the basis of instrumentation amplifiers.
Op-amp specifications that matter
| Spec | What it means | Why it matters |
|---|---|---|
| Supply range | Voltage the chip needs (single or split ±) | LM358 and MCP6002 work from a single 3–5 V supply; many older parts need ±5 V or more |
| Input and output swing | “Rail-to-rail” means the signal can reach the supply voltages | A non-rail-to-rail part’s output may stop 1.5 V short of the rails, which breaks 3.3 V designs |
| Gain-bandwidth product (GBW) | Gain × usable bandwidth is constant | Bandwidth = GBW ÷ gain. A 1 MHz part at a gain of 11 has only about 91 kHz of bandwidth |
| Slew rate | Fastest rate the output can change (V/µs) | Limits large, fast signals (even when the bandwidth looks fine) |
| Input offset voltage | Small unwanted voltage difference at the input (µV to mV) | Matters when amplifying tiny signals from a thermocouple or bridge |
| Input bias current | Current into the inputs (pA for JFET/CMOS types) | Matters with high-impedance sources (pH probes, photodiodes) |
| Noise | nV/√Hz | Matters in audio and low-level sensing |
| Part | Type | Typical features | Use |
|---|---|---|---|
| LM358 / LM324 | Dual / quad, bipolar | Single supply 3–32 V, 1 MHz, output cannot reach the upper rail | General-purpose, cheap |
| MCP6002 / TLV2372 | Dual, CMOS | Rail-to-rail, 1.8–6 V, low power | Battery and 3.3 V circuits |
| TL072 / NE5532 | Dual, JFET / bipolar | Low noise, ±5 to ±18 V | Audio, filters |
| OPA2134, AD8605 | Precision / low noise | Low offset, low drift | Instrumentation |
Comparators
A comparator is an op-amp used without feedback: its output goes high if the + input is above the − input, and low otherwise. It turns an analog voltage into a digital decision (a threshold detector).
- Use a real comparator (LM393, LM339, MCP6541) rather than an op-amp: comparators are faster to switch and recover quickly. Many have an open-collector output that needs a pull-up resistor.
- Hysteresis. A noisy input near the threshold makes the output chatter. Positive feedback through a resistor gives two thresholds, one for rising and one for falling, so small noise cannot toggle the output (a Schmitt trigger). The same idea is built into Schmitt-input logic chips (74HC14).
- Example uses: low-battery warning, light-activated switch with an LDR in a divider, zero-crossing detector, over-temperature alarm.
The 555 timer
The 555 is a classic chip containing two comparators, a latch and a discharge transistor. With a few resistors and a capacitor it makes an oscillator or a one-shot pulse. CMOS versions (TLC555, 7555) use far less power and work at lower voltages.
astable: f ≈ 1.44 ÷ ((Ra + 2 Rb) × C) duty = (Ra + Rb) ÷ (Ra + 2 Rb) monostable: t = 1.1 × R × C
Worked example: Ra = 1 kΩ, Rb = 68 kΩ, C = 10 nF
- f = 1.44 ÷ ((1 000 + 136 000) × 10 × 10−9) = 1 051 Hz, a period of 951 µs.
- High time = 0.693 × (Ra + Rb) × C = 478 µs; low time = 0.693 × Rb × C = 471 µs. The duty cycle is 50.4 %.
- Making Ra small relative to Rb gives a near-50 % square wave; the basic astable can never go below 50 %.
- One-shot (monostable): R = 100 kΩ and C = 10 µF give t = 1.1 × 100 000 × 0.00001 = 1.1 s after a trigger pulse.
- Accuracy is limited by the resistor and capacitor tolerances (5–20 %), so use a crystal or a microcontroller for exact timing.
Logic gates and logic families
| Gate | Output is HIGH when… | A B → Output (0 and 1) |
|---|---|---|
| NOT (inverter) | the input is LOW | 0 → 1, 1 → 0 |
| AND | both inputs are HIGH | 00→0, 01→0, 10→0, 11→1 |
| OR | either or both inputs are HIGH | 00→0, 01→1, 10→1, 11→1 |
| NAND | not both inputs are HIGH | 00→1, 01→1, 10→1, 11→0 |
| NOR | neither input is HIGH | 00→1, 01→0, 10→0, 11→0 |
| XOR | the inputs differ | 00→0, 01→1, 10→1, 11→0 |
- Families. The 74HC (and 74HCT, 74LVC, 74AHC) CMOS series runs from 2–6 V (HC) with very low input current; the old 74LS series is TTL and uses more power. CD4000 CMOS runs from 3–15 V. Pick HC or LVC for new designs.
- Logic levels. A 3.3 V chip’s output (about 3.3 V) is read as HIGH by a 5 V CMOS input only if it exceeds about 3.5 V, which it may not. A 74HCT input has a lower threshold (2 V) and accepts 3.3 V signals. A 5 V output into a 3.3 V input can damage it unless the input is 5 V tolerant: use a level shifter or a resistor divider.
- Unused inputs must be tied to the supply or ground (not left floating), or the chip draws excess current and behaves erratically.
- Fan-out. A CMOS output can drive many CMOS inputs, but only a few mA of load; use a buffer for heavier loads.
- Everyday chips: 74HC595 shift register (more outputs from three pins), 74HC165 (more inputs), 74HC14 Schmitt inverter (debouncing), 74HC00 NAND gate.
ADCs and DACs
An analog-to-digital converter (ADC) turns a voltage into a number, and a digital-to-analog converter (DAC) does the reverse. Resolution is the number of bits n; the voltage represented by the smallest step is the least significant bit (LSB).
LSB = Vref ÷ 2n code = Vin ÷ Vref × 2n
| Resolution | Levels | LSB at 3.3 V reference |
|---|---|---|
| 8-bit | 256 | 12.9 mV |
| 10-bit (Arduino Uno) | 1 024 | 3.22 mV |
| 12-bit (ESP32, STM32) | 4 096 | 0.81 mV |
| 16-bit (external ADC) | 65 536 | 50.35 µV |
- Example: a 12-bit ADC with a 3.3 V reference reads 1.65 V as 2 048 counts (half of 4 096).
- Real-world accuracy is worse than the bit count. Noise, reference error and offset often cost 2 bits or more on a microcontroller’s built-in ADC, so a 12-bit converter may deliver 10 usable bits.
- Anti-alias filter. Signals faster than half the sampling rate fold into the data as false lower frequencies; put an RC low-pass filter before the ADC (see Capacitors).
- Sensor work: see Sensors and the 4–20 mA / 0–10 V Analog Scaling Tool.
Reading a datasheet
- First page: what the part is, key features and a typical application circuit. This often shows exactly how to connect it.
- Absolute maximum ratings: limits that must never be exceeded, even briefly. This is not the operating range.
- Recommended operating conditions: the supply and temperature range where the specifications hold.
- Electrical characteristics: a table of typical, minimum and maximum values. Design with the minimum and maximum, not the typical.
- Pin diagram and description: check it for the package you have, since the same chip comes in several.
- Application information and layout guidance: where the decoupling, filter and layout advice is.
Related
- Analog Circuits and Sensing: the overview of this guide.
- Transistors: the building blocks inside every chip.
- Batteries and Power Supplies: voltage regulator ICs.
- Embedded Systems: microcontrollers, buses and ADCs in practice.
FAQ
Why is my op-amp output stuck at one rail?
Usually there is no negative feedback (the output is saturated), the feedback is wired to the + input instead of −, or the input is outside the allowed range. Check the circuit against the datasheet and confirm that the supply is present.
Can I use an op-amp as a comparator?
For slow signals, yes, but a real comparator is faster, switches cleanly and is made for it. Op-amps can also behave badly after saturating.
Why does my LM358 not swing to the positive supply?
Its output stage cannot reach the upper rail: it stops about 1.5 V short. For single 3.3 V or 5 V circuits where full swing matters, use a rail-to-rail part such as the MCP6002.
What is the difference between a 74HC and a 74HCT chip?
Both are CMOS and run on 5 V. The input thresholds differ: HCT inputs are TTL-compatible (HIGH above 2 V), so they accept a 3.3 V signal; HC inputs need about 3.5 V for a 5 V supply.
Why do I need a pull-up on a comparator output?
Many comparators (LM393) have an open-collector output that can only pull low. The pull-up resistor supplies the HIGH level, and it can go to a different supply, which makes level shifting easy.
References
- Horowitz, P. and Hill, W., The Art of Electronics, 3rd ed., Cambridge University Press: chapters 4 and 5 (op-amps), 6 and 7 (digital).
- Manufacturer datasheets: LM358 and LM393 (Texas Instruments), TL072, NE555, MCP6002 (Microchip), 74HC family (Nexperia, TI).
- Texas Instruments, Op Amps for Everyone (application guide).
- Platt, C., Make: Electronics, 3rd ed., Make Community.
Last reviewed: October 2026. Values are typical: check the datasheets of the parts you use.
