Introduction: PC Sound-Card Signal-Generator-Interface

About: I am a retired Electronic Systems Engineer now pursuing my hobbies full time. I share what I do especially with the world wide student community.

PC sound cards form a readily available Signal Generator for testing electronic circuits. The utility of these signal generators is limited because the outputs are AC coupled and limited to ±2V.

Taking advantage of the two channels provided by the sound card this Instructable shows a scheme which uses one channel to output the Sin/Square/Triangle waveform with a fixed gain, while setting up a 441 Hz PWM square wave on the second channel. This PWM waveform is converted to ±8V averaged and summed with the first channel to provide a DC offset controllable by the duty-cycle setting.

This PC sound-card interface implements a Signal-Generator with Sin/Square/Triangle output frequency variable from 50Hz to 10kHz, an amplitude variable from 0 to 5V and a variable DC offset of +/- 4V.

As a bonus the MAX232 , SMD/DIP, provides a 40kHz / 100kHz signal which can be used for step-response testing of analog circuits.

How I went about it:

1. Scribbled the Idea on to a piece of paper.
2. Selected the devices required and drew the prototype circuit.
3. Bread-Boarded the circuit and developed the PC GUI software.
4. Decided to do a professional job.
5. Obtained free samples from Texas Instruments. ( This is a great facility provided by TI)
6. Drew the Schematic and Designed the PCB using Eagle 5.10.0
7. Fabricated the double-sided SMD PCB using the toner-transfer method. ( It is possible to handle these fine pitch devices)
8. Populated the PCB and checked out the functioning.
9. Made minor changes in the GUI software to handle Channel-Interchange and Offset-Invert.
10. Put the circuit into a small-matchbox enclosure.
11. Wrote up the documentation for this system.
12. Archived all technical data in a .rar file

Step 1: The Idea

The idea has three parts:

1. A MAX232 TTL-RS232 interface chip can be used to generate +/- 10V DC from +5V
2. One channel of the PC sound card can be programmed to output a fixed frequency PWM waveform which when converted to +/-10V using the MAX232 and averaged would provide a variable DC voltage depending on the PWM setting.
3. This can be suitably summed with the second PC sound-card output which is programmed to generate SIN/SQ/TRI outputs to form the final output.

A GUI program on the PC can control the generation of the SIN/SQ/TRI amplitude and frequency and also the PWM to create a variable offset.

---------------------------------------------------------------------------------------
The prototype was bread-boarded using the Max 232 and LF353 DIP components.

This scheme can be implemented in case one does not want to work with the SMD components presented further on.

The Oscilloscope display shows a 4V Triangular wave offset by +2V.

---------------------------------------------------------------------------------------

The PC sound-card interface implements a Signal-Generator with Sin/Square/Triangle output frequency variable from 50Hz to 10kHz, an amplitude variable from  0 to 5V and a DC offset of  +/- 4V.

As a bonus the DIP MAX232 provides a 100kHz 5V/1V signal which can be used for step-response testing of analog circuits.

Step 2: Block Schematic

Referring to the simplified block schematic of the system. The USB +5V is fed to the MAX232 dual driver/receiver which carries out several functions:

• Generation of generates +8V and -8V supply for the op-amp circuitry
• Conversion of TTL level PWM to ± 8V level
• Generation of 40 kHz aux outputs

The Left-Channel outputs a 441 Hz PWM signal which when converted to TTL and fed to the Max 232 provides a ± 8V level PWM which is averaged to provide a DC offset signal.

The Right Channel provides the Sin/Square/Triangle signal from the PC which is amplified by 5.5 and summed with the DC offset signal to form the Aj_SoundGen_SigGen output.

Step 3: Software on the PC Host:

A Microsoft Windows based GUI software has been developed  in VB.Net 2.0 which interfaces with the internal sound-card of the PC and provides the audio-outputs to the Aj_SoundGen_SigGen  via the speaker port.

The simple GUI is used to control the PC sound-card outputs and indirectly the Aj_SoundCard_SigGen.

Once the Aj_SoundCard_SigGen USB and Audio connector are connected and the PC sound card enabled with maximum volume:

• Three Radio-Buttons select the type of waveform
• The first slider sets the signal generator frequency
• The second slider sets the amplitude of the chosen waveform
• The third slider controls the duty-cycle of the 441 Hz PWM which controls the DC offset.
• The RUN ,STOP and EXIT buttons are self explanatory

To ensure compatibility with different sound-cards:

• The swap-output check-box swaps the L/R channels if required
• And the Invert-Offset check-box inverts the polarity of the 441 Hz PWM.

Step 4: Schematic and Functional Description

PC sound cards form a readily available Signal Generator for testing electronic circuits. The utility of these signal generators is limited because the outputs are AC coupled and limited to ±2V.

Taking advantage of the two channels provided by the sound card the circuit uses one channel to output the Sin/Square/Triangle waveform with a fixed gain, while setting up a 441 Hz PWM square wave on the second channel. This PWM waveform is converted to ±8V averaged and summed with the first channel to provide a DC offset controllable by the duty-cycle setting.

The circuit in the schematic provides a variable offset of typically ±4V at the signal generator output.

The circuit is powered from the PC USB +5V supply which is converted by the capacitive voltage generator within the MAX232 dual driver/receiver IC, U1 to typically ±8V to power the TL082 low power op-amp, U2. L1/C8 and L2/C7 filter out the ripple on the V+ and V- outputs of U1. The 441Hz PWM waveform output on the sound-card left-channel is clamped by C1/D1 and fed through R1 to the base of  T1. This produces a TTL compatible square wave at the collector of T1 which is fed to theT2IN of U1. T2OUT is a ±8V PWM waveform which is averaged by R3/C6 and buffered by U2B to generate a DC voltage depending on the PWM duty-cycle. This voltage is summed along with the Sin/Square/Triangle waveform output on the sound-card right-channel by U2A and forms the signal generator output. C16/R5 forms a low-pass filter to smoothen 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 ±5V.

The waveforms captured on an oscilloscope illustrate the circuit operation. The 75% duty-cycle PWM input signal is converted to typically ±8V at T2OUT and when averaged produces ~ 4V DC at Pin7 of U2B. The 0.5V sin-wave is amplified and offset by the inverting summing amplifier U2A to form the signal generator output.

Step 5: Fabrication

The PCB is fabricated using the toner-transfer method and etched in a solution of Ferric Chloride.

After drilling the PCB physical connections for the plated-through holes are made.

SMD components and connectors are carefully soldered using a low-wattage soldering iron.

The images show the component layout and populated PCB.

The finished PCB is cleaned and the circuit operation tested.

After a spray of conformal coating on both sides of the PCB it is enclosed in an empty matchbox container.

The unit is now ready for use.


Step 6: Documentation and Software

The technical documentation is provided as a pdf file: Aj_SoundCard_Tech-Manual.pdf

-----------------------------------------------------------------------------------------
The Windows GUI software is provided as a .rar archive: SoundCard_VB.rar

*Note 1: after copying these files to the PC the folder any read-only permissions need to be removed. The executive creates an Ajoy.wav file which is played through the sound card. As this file is created and modified by the GUI software it will not work if the folder is read-only.

*Note 2: The sound-output should be routed to the ext-speaker/ headphone socket and the volume control set to maximum.

-------------------------------------------------------------------------------------------
PCB Gerber files are provided as a .rar archive: SoundCard_Gerber.rar

-------------------------------------------------------------------------------------------

A complete .rar file can be downloaded from:
http://sites.google.com/site/ramanajoy/home/my-zi...

Please address any feedback / queries to: ajoyraman@gmail.com



My website is: www.ajoyraman.in



123D Circuits Contest

Participated in the
123D Circuits Contest