Build it step by step
0 of 6 doneBuild the clock
Wire the 555 astable and check pin 3 pulses with an LED and resistor.
Wire the switch
Connect the CD4066 with its unused control pins to ground.
Add the hold capacitor and buffer
Fit the 100 nF capacitor and the LM358 follower.
Turn the pot slowly
Watch the output on the meter follow the pot in steps.
Look at it on a scope
If you have one, feed a slow sine and see the staircase.
Change the hold
Swap the 100 nF for 10 nF and see more droop.
How do you build a sample and hold circuit?
An analog switch and capacitor freeze a changing voltage on a clock, the first stage of an ADC. This is a track-and-hold with a 555 clock. You need CD4066 quad bilateral switch, LM358 Op-Amp, Ceramic Capacitor 100 nF, NE555 Timer IC, Resistor 10 kΩ × 3, Potentiometer 10 kΩ, Electrolytic capacitor 10 µF, Ceramic Capacitor 100 nF, Digital multimeter, Breadboard 830 Tie Points, 9 V battery and 9 V battery snap with DC jack. It takes 6 steps and about 90 minutes.
- Level
- Intermediate
- Time
- About 90 min
- Parts
- 12
Parts list
- Integrated CircuitsBuy
- Integrated CircuitsBuyLM358 Op-Amp × 1
- PassivesBuy
- Integrated CircuitsBuyNE555 Timer IC × 1
- PassivesBuyResistor 10 kΩ × 3
- PassivesBuy
- PassivesBuy
- PassivesBuy
- Tools & InstrumentsBuy
- PrototypingBuy
- BatteriesBuy9 V battery × 1
- PowerBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| 9 V battery + | + rail | Supply |
| 9 V battery - | - rail | Ground |
| 555 pin 8 and pin 4 | + rail | Power and reset high |
| 555 pin 1 | - rail | Ground |
| 10 kΩ resistor (R1) | + rail and 555 pin 7 | Clock timing |
| 10 kΩ resistor (R2) | 555 pin 7 and pin 6 | Clock timing |
| 555 pins 2 and 6 | Joined | Astable connection |
| 10 µF capacitor | 555 pin 6 and - rail, + on pin 6 | Timing capacitor, about 5 Hz |
| 100 nF capacitor | 555 pin 5 and - rail | Control decoupling |
| 555 pin 3 | CD4066 pin 13 (control A) | Clock closes the switch |
| CD4066 pin 14 | + rail | Power |
| CD4066 pin 7 | - rail | Ground |
| CD4066 unused control pins 5, 6, 12 | - rail | Unused switches off |
| 10 kΩ resistor | + rail and 10 kΩ potentiometer top | Limits the input to about 4.5 V |
| Potentiometer bottom | - rail | Input voltage source |
| Potentiometer wiper | CD4066 pin 1 | Signal in |
| CD4066 pin 2 | 100 nF capacitor to - rail and LM358 pin 3 (IN+) | Hold capacitor and buffer input |
| LM358 pin 8 and pin 4 | + rail, - rail | Power |
| LM358 pin 1 (OUT) | LM358 pin 2 (IN-) | Unity-gain follower |
| LM358 pin 1 | Multimeter | Held output |
No code needed
No code. CD4066 pins: 1 and 2 are switch A's two ends, 13 is its control, 14 is the supply and 7 is ground. The 555 gives a square-ish clock around 5 Hz that is high for slightly longer than low, so the circuit follows the input while the clock is high and holds it while it is low. This is therefore a track-and-hold, which is how most real sample-and-hold chips behave when not sampling. The LM358 input bias current causes a small droop of tens of millivolts over a 100 ms hold. Keep the input under about 7 V on a 9 V supply because the LM358 output can only swing to about 1.5 V below the rail.
Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Clock high | Output follows the pot |
| Clock low | Output stays at the last value |
| Turning the pot while held | Output does not change until the next clock high |
| Slow sine in | Staircase on the output |
If it does not work
Output never changes
Check the clock on pin 13 and the switch pins.
Output follows the input all the time
The control pin is stuck high or the clock is too fast.
Output droops fast
The hold capacitor is too small or leaky.
Output stuck near 0
Check the follower wiring on the LM358.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the sample and hold circuit?
CD4066 quad bilateral switch, LM358 Op-Amp, Ceramic Capacitor 100 nF, NE555 Timer IC, Resistor 10 kΩ × 3, Potentiometer 10 kΩ, Electrolytic capacitor 10 µF, Ceramic Capacitor 100 nF, Digital multimeter, Breadboard 830 Tie Points, 9 V battery and 9 V battery snap with DC jack.
How long does the sample and hold circuit take to build?
About 90 minutes for a intermediate maker, in 6 steps.
How do I know the sample and hold circuit works?
Clock high: Output follows the pot. Clock low: Output stays at the last value. Turning the pot while held: Output does not change until the next clock high.
Output never changes: what should I check?
Check the clock on pin 13 and the switch pins.
Output follows the input all the time: what should I check?
The control pin is stuck high or the clock is too fast.
Output droops fast: what should I check?
The hold capacitor is too small or leaky.
Output stuck near 0: what should I check?
Check the follower wiring on the LM358.
