Sound-Card Signal Generator Interface Adds Variable Offset Control

Ajoy Raman

Electronic Design

A common PC sound card can be used as a sine/square/triangle function generator, but the output suffers from limited rail-to-rail swing, plus its zero-centered has no DC offset. This circuit overcomes these constraints by using the second channel of the sound card to develop a PWM waveform that is filtered and then added to provide offset.

A personal computer (PC) sound card can be the basis for a readily available signal generator for testing electronic circuits. The usefulness of these signal generators is limited, however, because their outputs are AC coupled and restricted to ±2 V.

This circuit takes advantage of the two channels provided by the sound card by using one channel to output the sine/square/triangle waveform with a fixed gain while setting up a 441-Hz pulse-width modulated (PWM) square wave on the second channel. This PWM waveform is converted to ±8 V, then averaged and summed with the first channel, to provide an adjustable DC offset that is controllable by the duty-cycle setting.

The circuit provides a variable offset of typically ±5 V at the signal generator output (Fig. 1). It is powered from the PC’s USB +5-V supply, which is converted by the capacitive voltage generator within dual driver/receiver IC U1 to ±8 V (typical) to power the low-power dual op-amp U2.

Sound-Card Signal Generator Interface Adds Variable Offset Control
Figure 1. By using the second channel of a standard PC sound card to provide a DC offset via a filtered PWM waveform, this circuit overcomes the limitations of using these cards as low-cost function generators.

Passive pairs L1/C3 and L2/C8 filter out the ripple on the V+ and V– outputs of U1. The 441-Hz PWM waveform output on the sound-card left-channel is clamped by the C10/D1 combination and fed through R8 to the base of transistor Q1. This produces a TTL-compatible (transistor-transistor logic) square wave at the collector of Q1, which is fed to T2IN of U1.

T2OUT provides a ±8-V PWM waveform that is averaged by filter R5/C11 and buffered by U2B to generate a DC voltage depending on the PWM duty cycle. This voltage is summed along with the sine/square/triangle waveform output on the sound-card right channel by U2A, forming the signal-generator output.

The C9/R4 pair forms a low-pass filter to smooth the quantized signal generated by the sound card. With the values of the components shown, the right channel is amplified by a fixed gain of +5.5 and the DC offset variation is typically ±5 V.

Sound-Card Signal Generator Interface Adds Variable Offset Control
Figure 2. Key waveforms in the circuit are the output from one channel of the sound card (here, a 1-kHz bipolar sine wave); the PWM output, also from the sound card; the amplified PWM signal; the filtered and averaged PWM output; and the sine-wave output, now with negative DC offset.

The 75% duty-cycle PWM input signal is converted to typically ±8 V at T2OUT and, when averaged, produces approximately 4-V DC at pin 7 of U2B (Fig. 2). The 0.5-V sine wave is amplified and offset by the inverting summing amplifier U2A to form the signal-generator’s output.

Sound-Card Signal Generator Interface Adds Variable Offset Control
Figure 3. The associated VB. Net code provides an easy-to-use PC graphical interface for setting the function generator’s critical parameters.

electronicdesign.com

You may have to register before you can post comments and get full access to forum.
EMS supplier