Op-Amps
Operational amplifiers are high-gain analog building blocks: they amplify the voltage difference between two inputs. de:volt ships three DIP-8 op-amp parts — the LM358 (dual, single-supply general-purpose), the MCP6002 (dual, rail-to-rail), and the LM386 (audio power amplifier).
What an op-amp does
An op-amp drives its output so that, in a closed feedback loop, the two inputs are held at (almost) the same voltage. The gain is enormous on its own (open-loop ~100 dB on the LM358), so you almost always wrap it in feedback to set a useful, predictable gain — a non-inverting amplifier, an inverting amplifier, a voltage follower, or a comparator.
The two inputs follow a fixed convention:
- IN+ (non-inverting): the output moves with this input.
- IN− (inverting): the output moves against this input. Feedback is normally taken back to this pin.
Supply rails and headroom
Every op-amp here is single-supply: wire VCC to your positive rail and GND to 0 V. The output can only swing between those rails — it can never exceed VCC or go below GND. How close it gets to each rail (the headroom) is where these three parts differ:
| Part | Output swing to V+ | Output swing to GND |
|---|---|---|
| LM358 | only to ~VCC − 1.5 V | to within ~20 mV of GND |
| MCP6002 | within ~20 mV of V+ | within ~20 mV of GND |
| LM386 | self-biases to VS/2 (audio output) | — |
This is the practical reason to reach for the MCP6002 in a 3.3 V circuit: the LM358 loses ~1.5 V at the top, so on a 3.3 V rail its output tops out around 1.8 V. The MCP6002 is rail-to-rail at both input and output, so almost the full rail is usable. The trade-off is supply range — the LM358 runs up to 32 V, the MCP6002 only to 6 V.
Simulator behaviour
The sim commits a single output regime per step: each simulation step the engine decides whether the output is in its linear (active) region or clamped (saturated) against one of the rails, and solves that step accordingly. A comparator therefore reads as a hard rail-to-rail swing, and an amplifier driven past its headroom flattens at the rail rather than continuing linearly.
The LM386 is modelled as a DC amplifier only — accurate audio (AC waveform) playback needs a transient model that the part does not yet provide.
LM358 — dual general-purpose
Two independent op-amps in one DIP-8, sharing one supply. Single-supply 3–32 V (or ±1.5 to ±16 V dual). Output is not rail-to-rail. Good for comparators, active filters, and amplifiers where the top ~1.5 V of headroom doesn’t matter.
| Pin | Label | Function |
|---|---|---|
| 1 | OUT1 | Op-amp 1 output |
| 2 | IN1− | Op-amp 1 inverting input |
| 3 | IN1+ | Op-amp 1 non-inverting input |
| 4 | GND | Ground |
| 5 | IN2+ | Op-amp 2 non-inverting input |
| 6 | IN2− | Op-amp 2 inverting input |
| 7 | OUT2 | Op-amp 2 output |
| 8 | VCC | Positive supply (3–32 V) |
Open-loop gain ~100 dB, unity-gain bandwidth ~1 MHz. Add 100 nF decoupling at VCC.
MCP6002 — dual rail-to-rail
Same DIP-8 pinout as the LM358, but rail-to-rail on both input and output and tuned for low voltage: 1.8–6 V single-supply. Output swings within ~20 mV of each rail, quiescent current ~100 µA per amplifier, unity-gain bandwidth ~1 MHz. The default choice for 3.3 V / 5 V microcontroller and sensor-conditioning circuits.
| Pin | Label | Function |
|---|---|---|
| 1 | OUT1 | Op-amp 1 output |
| 2 | IN1− | Op-amp 1 inverting input |
| 3 | IN1+ | Op-amp 1 non-inverting input |
| 4 | GND | Ground |
| 5 | IN2+ | Op-amp 2 non-inverting input |
| 6 | IN2− | Op-amp 2 inverting input |
| 7 | OUT2 | Op-amp 2 output |
| 8 | VCC | Positive supply (1.8–6 V) |
Add 100 nF decoupling at VCC.
LM386 — audio power amplifier
A fixed-gain power amp for small speakers, self-biased to VS/2 so an AC-coupled input rides the mid-supply bias. Supply 4–12 V; delivers up to ~0.7 W into an 8 Ω speaker at 9 V. Gain is set by the GAIN pins (1 and 8):
| GAIN pins (1, 8) | Gain |
|---|---|
| Open | ×20 |
| 1.2 kΩ to ground | ×50 |
| 10 µF to ground | ×200 |
| Pin | Label | Function |
|---|---|---|
| 1 | GAIN | Gain-set (with pin 8) |
| 2 | −IN | Inverting input |
| 3 | +IN | Non-inverting input |
| 4 | GND | Ground |
| 5 | VOUT | Output to speaker |
| 6 | VS | Positive supply (4–12 V) |
| 7 | BYPASS | Bias bypass cap |
| 8 | GAIN | Gain-set (with pin 1) |
Decouple VS (pin 6) with 10 µF + 100 nF. The gain property (20 / 50 / 200) is selectable in the Inspector. Remember the part is a DC model — audio accuracy needs a transient model.
Orientation
All three are DIP-8 through-hole parts. Pin 1 is at the notch/dot end: place the package with the notch facing left, pin 1 at the bottom-left, and count counter-clockwise. Straddle the breadboard centre gap. A DIP socket is recommended.
Example circuit
A non-inverting amplifier with gain ≈ 1 + R_f/R_g, built on one half of an LM358:
VCC (5 V) ── pin 8
│
Vin ──────────────── IN1+ (pin 3)
│
┌─────────── IN1− (pin 2) ───── R_g ───── GND
│
└──── R_f ── OUT1 (pin 1) ──── Vout
GND (pin 4) ── GNDWith R_f = 10 kΩ and R_g = 10 kΩ the gain is ×2. Add a 100 nF cap from pin 8 to GND for decoupling.