Mixed-Signal Tutorial Lesson 4: Designing Sample-And-Hold Mixed-Mode Circuits

Tutorial Project: Using Switches to Build Sample-And-Hold Mixed-Mode Circuits
TUT15-15.png

Objective: In this project, the basic concepts of RF.Spice A/D are demonstrated, and a simple voltage divider is modeled and examined.

Concepts/Features:

Minimum Version Required: All versions

'Download2x.png Download Link: [1]

Using Switches to Build Sample-And-Hold Mixed-Mode Circuits

Objective

In the first part of this tutorial lesson, you will use SPICE's standard voltage-controlled switch to sample a signal and then build a basic sample-and-hold (S/H) circuit. In the second part, you will build a more complicated S/H circuit using an Op-Amp and a digital clock. In the third part, you will add a three-input data multiplexer with digital control to you S/H circuit.


A simple sampling circuit using a voltage-controlled switch.
The property dialog of the voltage-controlled switch.

The Voltage-Controlled Switch and Sampling Circuit

The voltage-controlled switch with the keyboard shortcut "S" is a two-pin device, whose ON and OFF states are controlled by an external voltage defined in the switch' property dialog. Place a voltage-controlled switch S1 between a "Sinusoidal" voltage source VS with a 1k source resistor and a 1k load resistor as shown in the opposite figure. Set the frequency of the sinusoidal source to 1kHz with a peak amplitude of 1V. Place two Voltage Probe Markers (keyboard shortcut: Alt+L) on the voltage source and the load and call them "VIN" and "VOUT", respectively. Also, place a "Pulse" voltage source VC separately with a period of 3ms, a pulse width of 1ms, and s zero rise time and a zero fall time. Set the low and high voltage values of the pulse source to 0 and 5V, respectively. Ground the latter source and place a voltage probe marker called "VCTRL" on its positive pin. The pulse voltage source is the control voltage and will not be connected to any other part.


Now open the property dialog of the switch and set its On Voltage and Off Voltage to 3.3V and 0.3V, respectively. These are the threshold values for the control voltage. Set the On Resistance and Off Resistance values of the switch to 1u and 1G, respectively. Finally, set the control voltage nodes to VCTRL and 0 (for ground).


Attention icon.png Always set a nonzero value for the On Resistance of the switch. Otherwise, a zero resistance may lead to simulation failure.


Run a Transient Test of this circuit with start and stop times set to 0 and 10ms, respectively, with a Step Ceiling of 1u. The results are shown at the top of the figures below. As you can see from the figure, every 3ms the switch closes for a duration of 1ms, and the source voltage is transferred to the resistive load through the voltage divider. Your sinusoidal input signal is clearly under-sampled. Now change the period and pulse width of the control source to 100μs and 25μs, respectively. Run another transient test with these values. You can see from the figure below at the bottom that each period of your is sinusoidal input signal is sampled 10 times.


The input, control and output voltages of the sampling circuit with a sampling period of 3ms.
The input, control and output voltages of the sampling circuit with a sampling period of 10μs.
A basic sample-and-hold circuit using a voltage-controlled switch.

Building a Basic Sample-And-Hold Circuit

Adding a shunt capacitor C1 to the load of your sampling circuit above will make a basic sample-and-hold circuit as shown in the opposite figure. During the ON state of the switch (Sample Time), the capacitor C will charge to the sampled voltage value. During the OFF state of the switch (Hold Time), the capacitor will keep its held sample voltage until the next charging period. Set the capacitance initially to C1 = 20nF. Change the value of the load resistor to 5k to increase the output voltage level. Run a Transient Test of this circuit with the same settings as in the previous case. The results are shown at the top of the figures below. As you can see from this figure, the capacitor discharges too quickly during the hold time and certainly is not able to hold the sampled voltage for the entire time.

Note that the time constant of this circuit is τ = 1/(R||C1) = 16.7μs. Of the 100μs period of the pulse waveform, the first 20μs is the sample time, and the rest of 80μs is the hold time. Clearly, the discharge time is too short. Next, increase the value of C1 to 100nF. In this case, the time constant will increase to τ = 80μs. Run a new transient test of the circuit and you will get the results shown at the bottom of the figures below. You can see a major improvement of the performance of your S/H circuit.


The input, control and output voltages of the basic S/H circuit with C1 = 20nF.
The input, control and output voltages of the basic S/H circuit with C1 = 100nF.
A sample-and-hold circuit with an Op-Amp and a MOSFET Switch.

Building an Op-Amp Sample-And-Hold Circuit

The following is a list of parts needed for this part of the tutorial lesson:


Voltage Source VCC: 15V

Voltage Source VEE: -15V

Two LM741 Op-Amps: X1 and X2 accessible form "Parts > Integrated Circuits" menu

Four-Terminal Voltage-Controlled Switch: X3 (keyboard shortcut: Alt+S)

1nF Capacitor: C1

Digital Clock: CLK (keyboard shortcut: Alt+C)


Configure the two Op-Amps as voltage followers as shown in the opposite figure. The four-terminal voltage-controlled switch is a convenient B2.Spice A/D device based on the standard SPICE "S" model, which also provides two additional pins for the controlling voltage. The shunt charge capacitor is connected between the output of the switch and the input of the second voltage follower. Open the property dialog of the switch and set its On Voltage and Off Voltage to 3.3V and 0.3V, respectively, and set the On Resistance and Off Resistance values of the switch to 1u and 1G, respectively.

The controlling voltage of the switch in this case will be the output of the digital clock. Set the period and pulse width of the digital clock to 100μs and 25μs, respectively. Note that in a mixed-mode simulation, the "High" and "Low" states of a digital device represent +5V and 0V, respectively. Connect the output of the digital clock to the positive control pin of the dour-pin switch and ground its negative control pin.

Run a Transient Test with start and stop times set to 0 and 10ms, respectively, with a Step Ceiling of 1u. The simulation results are shown in the figure below. Note that the output of the digital clock is displayed in a digital graph with binary 0 and 1 values, while the analog voltages VIN and VOUT have been plotted on regular Cartesian graphs. As you can see from the graph, the Op-Amp S/H circuit perform much better than the basic S/H circuit of the previous part and does not introduce any delay to the output signal.

The input, control and output voltages of the Op-Amp S/H circuit with C1 = 1nF.
A sample-and-hold circuit with three analog inputs and digital control.

Building a Multi-Input S/H Circuit with Digital Control

The following is a list of parts needed for this part of the tutorial lesson plus all the parts of the previous circuit:


Three Four-Terminal Voltage-Controlled Switch: X4, X5 and X6 (keyboard shortcut: Alt+S)

Two Digital Inputs: B0 and B1 (keyboard shortcut: N)

Three AND Gates: (keyboard shortcut: A)

Two Digital Inverters: (keyboard shortcut: Alt+O)

Resistor R

Two Sinusoidal Sources: V2 and V3


The two digital input together form a 2-bit binary ID for the three-input source selector. Set the frequency of the three sinusoidal voltages sources V1, V2 and V3 to 0.6kHz, 1kHz and 1.7kHz, respectively. The three 4-pin switches X4, X5 and X6 together form the multiplexer, with their control voltage driven by the output of the logic gates as shown in the opposite figure. The outputs of the three switches are connected together and, through the resistor R1, are fed into the first voltage follower of the S/H circuit from the previous part of this tutorial lesson. The following table summarizes the analog and digital inputs of the circuit:

Input Digital ID B1 B0 Frequency
V1 01 0 1 600Hz
V2 10 1 0 1kHz
V3 11 1 1 1.7kHz
The SPICE Simulation Options dialog of B2.Spice A/D.

Modify your S/H circuit from the previous section and add the three sinusoidal voltage sources and their corresponding switches. Also, build the logic gate circuit as shown in the figure and connect its outputs to the control voltage pins of the three selector switches. Place three voltage probe markers VIN1, VIN2 and VIN3 at the three input voltage sources. Run a Transient Test with start and stop times set to 0 and 10ms, respectively, with a Step Ceiling of 1u. Try all three cases B1B0 = 01, B1B0 = 10, and B1B0 = 11. Note that in the case B1B0 = 00, the outputs of all three AND gates will be low (0V) and the output voltage will be zero, too.

When you run the transient test, it may suddenly stop after a certain number of time steps due to failure of convergence. This problem may happen occasionally during transient simulations. It is important to note that the SPICE engine usually solves a large matrix problem using an iterative numerical method. The numerical solution of linear systems involves a number of numerical parameters. B2.Spice assumes default values for such parameters so you don't have to worry about them. However, occasionally you may have to adjust some of these parameters especially in cases of convergence trouble. You can do this from the SPICE Simulation Options dialog. You can access this dialog from the Simulate Menu. Under the "Convergence" tab of this dialog, find the "itl4" parameter and increase its value from the default 10 to 40. This parameter sets the upper limit for the transient analysis iterations. Note that you have to click on the parameter value in the rightmost column of the table to highlight it and then type in a new value. After running three successful transient simulations, you should get voltage plots like the ones shown in the figures below.

The two digital inputs, clock, and the three analog input voltages and output voltage of the S/H circuit with B0 = 1 and B1 = 0 (corresponding to the 600Hz sinusoidal analog input).
The two digital inputs, clock, and the three analog input voltages and output voltage of the S/H circuit with B0 = 0 and B1 = 1 (corresponding to the 1kHz sinusoidal analog input).
The two digital inputs, clock, and the three analog input voltages and output voltage of the S/H circuit with B0 = 1 and B1 = 1 (corresponding to the 1.7kHz sinusoidal analog input).

 

Back icon.png Back to RF.Spice A/D Wiki Gateway

Last modified on 4 September 2015, at 03:09