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.

PackageWhat it isHand-soldering
DIPDual in-line, through-hole, 2.54 mm pitchEasy; fits breadboards and sockets
SOIC / SOPSmall outline, gull-wing leads, 1.27 mm pitchEasy with practice
SOT-23, SOT-223Small transistors and regulatorsEasy for three to six pins
TQFP / QFPLeads on four sides, 0.4–0.8 mm pitchNeeds flux and a fine tip; drag soldering
QFN / BGAPads underneathHot 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 amplifierNon-inverting amplifier−+Vin1 kΩ10 kΩVoutGain = −Rf ÷ Rin = −10 kΩ ÷ 1 kΩ = −10Vin = +0.2 V gives Vout = −2 V.The input sees Rin (1 kΩ); the output is inverted.−+Vin10 kΩVout1 kΩGain = 1 + Rf ÷ Rg = 1 + 10 kΩ ÷ 1 kΩ = 11Vin = 0.2 V gives Vout = 2.2 V. Output is in phase.
The two basic amplifiers. The inverting amplifier has a gain set by Rf ÷ Rin; the non-inverting amplifier has a gain of 1 + Rf ÷ Rg.

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

SpecWhat it meansWhy it matters
Supply rangeVoltage 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 voltagesA 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 constantBandwidth = GBW ÷ gain. A 1 MHz part at a gain of 11 has only about 91 kHz of bandwidth
Slew rateFastest rate the output can change (V/µs)Limits large, fast signals (even when the bandwidth looks fine)
Input offset voltageSmall unwanted voltage difference at the input (µV to mV)Matters when amplifying tiny signals from a thermocouple or bridge
Input bias currentCurrent into the inputs (pA for JFET/CMOS types)Matters with high-impedance sources (pH probes, photodiodes)
NoisenV/√HzMatters in audio and low-level sensing
PartTypeTypical featuresUse
LM358 / LM324Dual / quad, bipolarSingle supply 3–32 V, 1 MHz, output cannot reach the upper railGeneral-purpose, cheap
MCP6002 / TLV2372Dual, CMOSRail-to-rail, 1.8–6 V, low powerBattery and 3.3 V circuits
TL072 / NE5532Dual, JFET / bipolarLow noise, ±5 to ±18 VAudio, filters
OPA2134, AD8605Precision / low noiseLow offset, low driftInstrumentation

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.

5552 TRIG6 THR5 CTRL7 DIS3 OUT8 Vcc4 RST1 GND+5 V to +15 VRa 1 kΩRb 68 kΩC 10 nFOutput: square wave≈ 1 kHz, 50 % dutyAstable 555 oscillatorf ≈ 1.44 ÷ ((Ra + 2Rb) × C)
A 555 astable oscillator. The capacitor charges through Ra and Rb and discharges through Rb, so the output switches continuously.

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

GateOutput is HIGH when…A B → Output (0 and 1)
NOT (inverter)the input is LOW0 → 1, 1 → 0
ANDboth inputs are HIGH00→0, 01→0, 10→0, 11→1
OReither or both inputs are HIGH00→0, 01→1, 10→1, 11→1
NANDnot both inputs are HIGH00→1, 01→1, 10→1, 11→0
NORneither input is HIGH00→1, 01→0, 10→0, 11→0
XORthe inputs differ00→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

ResolutionLevelsLSB at 3.3 V reference
8-bit25612.9 mV
10-bit (Arduino Uno)1 0243.22 mV
12-bit (ESP32, STM32)4 0960.81 mV
16-bit (external ADC)65 53650.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

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.