Rail-to-rail op-amps on 3.3 V
An LM358, an MCP6002, an LMV358 and an MCP6004 follow one knob on 3.3 V: at the top the LM358 stops at 1.8 V and the rail-to-rail parts reach 3.27 V and more. There is no microcontroller in it: the simulator solves the 9 parts as a circuit, so it runs the moment you press Run, and nothing needs compiling.
Teaching? Assign it to your class in one click.
Beginner About 15 minutes to build and run. Runs in your browser. Free, and no account needed.
The parts retail for about $7. On Mokxi they're free.
What you'll learn
- What a voltage follower does
- What rail-to-rail means for an op-amp output
- Why 3.3 V boards need rail-to-rail parts
- Reading supply limits from a part's datasheet
- Difficulty: Beginner
- Time: About 15 minutes
- Parts: 7
How it works
Four different op-amp chips each get the same 3.3 V supply and the same knob. Each one is wired as a follower: its output goes straight back to its minus input. That makes the output copy the knob voltage, so the meters should all match the knob.
They do not all match. Turn the knob to the top, 3.3 V, and the LM358 stops at 1.80 V, because its output cannot get within about 1.5 V of its supply. The MCP6002, LMV358 and MCP6004 are rail-to-rail parts, so they climb to within a few hundredths of a volt of 3.3 V.
At the bottom, near 0 V, all four get within a few tens of millivolts of ground. Only amplifier 1 of each chip is used.
Parts list
7 parts, plus the jumper wires and 4 bench instruments. The parts retail for about $7; on Mokxi they're free, and so are the instruments.
- 1 × Full-size breadboard
- 1 × Power, 3.3 V
- 1 × PotentiometerIn Halloween Prop Kit, Starter Projects Kit.
- 1 × LM358 dual op-amp
- 4 × Multimeter
- 1 × MCP6002 dual rail-to-rail op-amp
- 1 × LMV358 dual rail-to-rail op-amp
- 1 × MCP6004 quad rail-to-rail op-amp
Wiring table
Every connection, pin by pin, read from the circuit itself. Each row joins the pin on the left to the pin on the right, by a jumper wire or a breadboard strip.
| Part and pin | Connects to |
|---|---|
| Potentiometer pin 1 | 3.3 V |
| LM358 dual op-amp pin VCC | 3.3 V |
| MCP6002 dual rail-to-rail op-amp pin VDD | 3.3 V |
| LMV358 dual rail-to-rail op-amp pin VCC | 3.3 V |
| MCP6004 quad rail-to-rail op-amp pin VDD | 3.3 V |
| Potentiometer pin 3 | Ground |
| LM358 dual op-amp pin GND | Ground |
| Multimeter (1) pin COM | Ground |
| MCP6002 dual rail-to-rail op-amp pin VSS | Ground |
| Multimeter (2) pin COM | Ground |
| LMV358 dual rail-to-rail op-amp pin GND | Ground |
| Multimeter (3) pin COM | Ground |
| MCP6004 quad rail-to-rail op-amp pin VSS | Ground |
| Multimeter (4) pin COM | Ground |
| LM358 dual op-amp pin 1IN+ | Potentiometer pin 2 |
| MCP6002 dual rail-to-rail op-amp pin VINA+ | Potentiometer pin 2 |
| LMV358 dual rail-to-rail op-amp pin 1IN+ | Potentiometer pin 2 |
| MCP6004 quad rail-to-rail op-amp pin VINA+ | Potentiometer pin 2 |
| LM358 dual op-amp pin 1IN- | LM358 dual op-amp pin 1OUT |
| Multimeter (1) pin V | LM358 dual op-amp pin 1OUT |
| MCP6002 dual rail-to-rail op-amp pin VINA- | MCP6002 dual rail-to-rail op-amp pin VOUTA |
| Multimeter (2) pin V | MCP6002 dual rail-to-rail op-amp pin VOUTA |
| LMV358 dual rail-to-rail op-amp pin 1IN- | LMV358 dual rail-to-rail op-amp pin 1OUT |
| Multimeter (3) pin V | LMV358 dual rail-to-rail op-amp pin 1OUT |
| MCP6004 quad rail-to-rail op-amp pin VINA- | MCP6004 quad rail-to-rail op-amp pin VOUTA |
| Multimeter (4) pin V | MCP6004 quad rail-to-rail op-amp pin VOUTA |
The notes that come with it
There is no microcontroller in this one, so nothing is compiled: the simulator solves the circuit itself. The file in the editor is the notes that come with it.
// Four op-amps on a 3.3 V supply, each a follower of one knob.
//
// A follower has its output wired straight back to its - input, so it should
// copy the knob exactly. The meters read, left to right, an LM358, an
// MCP6002, an LMV358 and an MCP6004 (only amplifier 1 of each is used).
//
// Turn the knob all the way up, to 3.3 V:
//
// LM358 1.80 V it stops 1.5 V under its supply
// MCP6002 3.27 V rail to rail, within 25 mV
// LMV358 3.29 V within 10 mV
// MCP6004 3.27 V four MCP6002 amplifiers in one chip
//
// and all the way down, to 0 V: all four reach within a few tens of millivolts
// of ground (the LMV358 stops at 65 mV, the MCP parts at 25 mV).
//
// That is why a 3.3 V board (an ESP32, a Pico) wants a rail-to-rail op-amp:
// an LM358 on 3.3 V throws away almost half of the ADC's range. The MCP6002
// runs on anything from 1.8 V to 6 V; the LMV358 from 2.7 V to 5.5 V.
//
// The MCP6004 has the LM324's pinout: VDD on pin 4 and VSS on pin 11.
Troubleshooting
The usual mistakes with this circuit, and the fix for each.
- The LM358 meter stops at 1.80 V with the knob at the top This project
This is not a wiring fault. The LM358 cannot swing close to its supply, which is the point of the comparison. Swap in a rail-to-rail part. - A chip does nothing or reads zero This project
Check power and ground pins on each chip. The MCP6004 uses the LM324 pinout, with VDD on pin 4 and VSS on pin 11. - The reading jumps around or only covers part of the range. Potentiometer
Wire the two outer legs to 5 V and ground and the middle leg (the wiper) to an analog pin. Using the wrong two legs gives a dead or partial range. - Turning the knob does nothing, or the value is stuck at 0 or 1023. Potentiometer
Check that the wiper goes to an analog input (A0 to A5 on an Uno), not a digital pin. Make sure both ends are connected, since a floating end gives noise. - The output never reaches the positive supply rail. LM358 dual op-amp
The LM358 output swings to about 1.5 V under VCC, while it can go close to ground on a single supply. Pick a supply with enough headroom, or use a rail to rail part. - The circuit with a single supply gives clipped or odd results. LM358 dual op-amp
Inputs can go down to ground but not above about VCC minus 2 V. Bias signals sit at half supply for AC work. Always check that unused op-amp inputs are tied off, not left floating. - The reading is zero, negative or nonsense when measuring voltage. Multimeter
Set the dial to volts first, then touch the probes across the part, in parallel. Red goes to the more positive point. A negative number just means the probes are swapped. - Measuring current gives zero or blows the meter's fuse. Multimeter
Current must flow through the meter, so break the circuit and put the meter in series. Never put an amps setting straight across a supply. Start with the highest current range.
Change it and keep it
Open it in the editor, change the circuit or the code, and keep your version in a free account.