Simple way to build a programmable oscillator using digital potentiometers
Digital potentiometers (digiPOT) are versatile and have a wide range of applications, such as filtering or generating AC signals. But sometimes the frequency must be able to be varied and adapted to the needs of the application. In such designs, a programmable solution that supports frequency adjustment through an appropriate interface is extremely useful and in some cases can be very helpful for development. This article describes a simple and easy way to build a programmable oscillator, where the oscillation frequency and amplitude can be adjusted independently of each other through the use of digiPOTs.
Figure 1 shows a typical diode-stabilized Wien bridge oscillator that can be used to generate an accurate sine wave signal at the output (V OUTPUT ) of approximately 10 kHz to 200 kHz. The Wien bridge oscillator has two bridges, one composed of a band-pass filter and the other composed of a voltage divider. In addition to the ADA4610-1 rail-to-rail precision amplifier, this example uses the AD5142 digiPOT, which contains two independently controllable potentiometers, each with 256-step resolution. The resistance value is set through SPI programming, as shown in Figure 2. Alternatively, the AD5142A controlled by I2C can be used. Both are available as 10 kΩ or 100 kΩ potentiometers.
Figure 1. Amplitude-stabilized programmable Wien bridge oscillator with resistors replaced by digiPOTs.
Figure 2. Functional block diagram of the AD5142.
In the classic oscillator circuit shown in Figure 1, the paths of R1A, R1B, C1 and C2 form positive feedback, while R2A, R2B and the two parallel diodes D1 and D2 or their resistor R DIODE form negative feedback. In this case, formula 1 can be used:
To achieve sustained stable oscillation, the phase shift in the loop gain needs to be eliminated. Expressed by the formula, oscillation frequency:
Where, R represents the programmable resistor value on the AD5142:
D represents the decimal equivalent of the programmable digital code in the AD5142, and R AB represents the total resistance of the potentiometer.
In order to maintain oscillation, the Wien bridge oscillator should be relatively balanced, that is, the positive and negative feedback gains must be in harmony. If the positive feedback (gain) is too large, the oscillation amplitude, or V OUTPUT , will increase until the amplifier saturates. If negative feedback dominates, the oscillation amplitude will decay accordingly.
In the circuit shown here, the gain R2/R1 should be set to about 2 or more. This ensures that the signal starts to oscillate.
However, alternately turning on the diodes in the negative feedback loop will also cause the gain to be temporarily less than 2, allowing the oscillation to stabilize.
Once the desired oscillation frequency is determined, the oscillation amplitude can be tuned independent of frequency via R2. It can be calculated by the following formula:
Therefore, the variables ID and VD represent the diode forward current and diode forward voltage through D1 and D2 respectively. If R2B is short-circuited, an oscillation amplitude of approximately ±0.6 V will occur. When the amplitude of R2B is of the correct magnitude, balance is achieved, allowing V OUTPUT to converge. In the circuit shown in Figure 1, a single 100 kΩ digiPOT is used for R2B.
By using the circuit described and a 10 kΩ dual digiPOT, 8.8 kHz, 17.6 kHz and 102 kHz oscillation frequencies can be tuned with resistance values of 8 kΩ, 4 kΩ and 670 Ω respectively, with frequency errors as low as ±3%. Increasing the output frequency may affect frequency error. For example, at 200 kHz, the frequency error increases to 6%.
When using such circuits in frequency-dependent applications, care must be taken not to exceed the bandwidth limit of the digiPOT, as this value is a function of the programmable resistor. Additionally, the frequency tuning shown in Figure 1 requires that R1A and R1B have the same resistor value. However, both channels can only be set sequentially and lead to transient critical intermediate states. For some applications, this situation is unacceptable. In these cases, a digiPOT (such as the AD5204) that supports daisy-chain mode can be used to be able to change the resistor values simultaneously.