Daqarta
Data AcQuisition And Real-Time Analysis
Scope - Spectrum - Spectrogram - Signal Generator
Software for Windows
Science with your Sound Card!
The following is from the Daqarta Help system:

Features:

Oscilloscope

Spectrum Analyzer

8-Channel
Signal Generator

(Absolutely FREE!)

Spectrogram

Pitch Tracker

Pitch-to-MIDI

DaqMusiq Generator
(Free Music... Forever!)

Engine Simulator

LCR Meter

Remote Operation

DC Measurements

True RMS Voltmeter

Sound Level Meter

Frequency Counter
    Period
    Event
    Spectral Event

    Temperature
    Pressure
    MHz Frequencies

Data Logger

Waveform Averager

Histogram

Post-Stimulus Time
Histogram (PSTH)

THD Meter

IMD Meter

Precision Phase Meter

Pulse Meter

Macro System

Multi-Trace Arrays

Trigger Controls

Auto-Calibration

Spectral Peak Track

Spectrum Limit Testing

Direct-to-Disk Recording

Accessibility

Applications:

Frequency response

Distortion measurement

Speech and music

Microphone calibration

Loudspeaker test

Auditory phenomena

Musical instrument tuning

Animal sound

Evoked potentials

Rotating machinery

Automotive

Product test

Contact us about
your application!

Full-Scale Range - Input Voltage Method

Controls: Calibration Menu >> Full-Scale Range

Introduction:

Note: You must have previously run Auto-Calibrate for the output and input lines whose range you want to set; otherwise, their controls will be disabled in the Full-Scale Range dialog.

In addition, you should also perform input and output impedance measurements on your card, since these values will be used to correct the calibration.

The Output Voltage Method requires you to have access to a voltmeter with a sensitive AC range, one that can read 3 decimal places (1.999), or at least 2 places (19.99) AC volts full-scale. Alas, inexpensive meters typically only read 199.9 volts on the most-sensitive AC range. They do, however, have sensitive DC voltage ranges. Unfortunately, sound cards are AC-coupled so you can't output a DC voltage that can be measured on one of these ranges.

However, there is a way to trick your AC-coupled card into measuring a DC voltage, even if it can't generate one. This is a simplified version of the principle discussed in the Decimate Demodulate topic. You just need to provide a DC voltage that can be switched on and off. Ideally this would be a square wave from an Arduino or Numato, or a simple CMOS circuit that you can rig up on a protoboard. But in a pinch it's possible to get decent results using a manual switch with a battery or other DC power source. You'll also need an adjustable voltage divider to get a voltage in the right range... more on this later.


Arduino or Numato Square Wave Source:

If you have a Numato 8, 16, 32, or 64 USB device you can use Daqarta's included Numato_Oscillator macro directly. This is by far the easiest way to create a calibrated square wave. The wave will be 0-5 V for the Numato 8, or 0-3.3 V for the others.

An Arduino Uno is also easy to use, once you get it set up. If you haven't already done so, upload the DaqPort "sketch" to it so you can run the Arduino_Oscillators macro mini-app. Open the Macro Dialog via CTRL+F8 and scroll down to find Arduino_Oscillators. Before you start it, use the macro Edit button to show the code. Change run time (the first code line) from R=5 to R=0 to specify continuous operation.

Now click the "Save Macro" button to return to the main Macro dialog, and click Run. There will be 5 V square waves at 2, 3, 4, and 5 Hz on pins 10, 11, 12, and 13. (Pin 13 also drives the onboard LED, so you'll see it flashing.)

Have an Arduino that is not an Uno or compatible, and thus can't run DaqPort? No problem, just upload the standard Blink demo that comes with the Arduino installation; it turns the LED (and hence pin 13) on for one second and off for one second.

Similar Blink-type programs can be found or created for just about any microprocessor board. Note that it doesn't have to actually blink an LED, just repeatedly toggle an output pin. If the board runs on some other voltage (like 3.3 V) it will still work just fine.


Simple CMOS Square Wave Source:

Here is a simple oscillator that can be built on a small protoboard just for this calibration, using only a standard CMOS CD4001 quad NOR chip:

The parts shown give a square wave at approximately 6 Hz. You can reduce the 1 uF capacitor to 0.10 uF and increase the 100K resistor to 1 Meg to keep the same frequency, or use any similar combination with a similar ohms * farads product, such as 0.33 uF with 330K. If you double the product, the frequency is halved. Don't raise the frequency much above 6 Hz for this application.

You can power this with 5 V from a USB port, if you have an old .USB cable to sacrifice. Leave the end that plugs into the computer, and cut off the other end. Carefully strip the outer insulation to reveal the 4 colored wires inside. Strip the insulation from the red and black wires, which should be +5 and ground, respectively. Don't trust the color code! Plug the cable into a running computer and verify the voltages before connecting to your circuit.

Alternatively, you can use a 9 V battery, or any DC supply of 15 V or less, to get square waves that switch between 0 and the supply voltage.


Manual Switch Source:

The manual switch method is finicky to use, but requires a minimum of parts. You don't even need to construct anything; you can jury-rig the system with mini-gator clip leads.

Besides the switch and a power source, you'll also need a voltage divider (see subtopic below). The basic circuit will look like this:

You can use just about any battery on hand, even one that is nominally "dead", as along as it can put out about 1 volt. Or instead of a battery you can use any low-voltage DC power supply in the 1 to 15 V range.

The "switch" can simply be a wire that you momentarily touch to the positive battery terminal. The tricky part is that you will need to get a clean "make" contact, with no or minimal contact bounce, to get a decent pulse for measurement. This can take many tries. Don't assume that a "real" switch will be better than a wire contact; most switches have bounce, on both make and break, and repeatedly operating the switch won't change its basic nature. At least with a wire every try will be different, and eventually you'll get a lucky strike.

The author has had best results with the positive voltage (battery or USB) connected to a resistor or wire loop plugged firmly into a protoboard. The free end of a wire connected to the top of the voltage divider (also on the protoboard) was then moved perpendicular to the stationary lead wire of the resistor or loop, so it crossed and connected with a momentary flicking action like striking a match. This worked much better than trying to touch and release.


Voltage Divider:

Typical sound card inputs can handle about 1 Vrms without distortion, which is +/-1.414 volts peak-to-peak. You'll thus need a simple voltage divider to get your battery or Arduino or CMOS square wave down to about +1 Vdc.

The resistances Ro and Ri should total somewhere between 5K and 50K. (Not critical.)

If you are using discrete resistors as shown, select Ri to be in the 1K to 10K range, then compute Ro:

Ro = Ri * (Vo - Vi) / Vi

You can use a potentiometer (volume control) in the 5K to 50K range to replace both Ro and Ri, with the wiper (center terminal) conected to Vi. Adjust Vi to be about 1 V with the Vo temporarily connected to the power supply instead of an oscillator.


Sound Card Connections:

Next you need to connect the voltage divider Vi point to the sound card Left input. If you have a standard sound card cable with plugs on both ends, you can plug one end into the sound card Line In jack and carefully connect to the free end with mini-alligator clip leads. The plug tip is the Left input, the little ring next to that is Right, and the rest of the plug sleeve is ground. Clip one lead from the tip to Vi, and one from the sleeve to the common ground Gnd.

Alternatively, if you plan to later build a connector panel for your card, or anything that will involve installing a different connector to the cable, just cut off the free end to expose the wires inside. Since most cables are stereo, you will find two separate shielded cables in one sheath. You only need one of these. Use the Left channel, which is usually white. (Red is for Right.)

Carefully strip the shield back; this may be a mass of twisted wires that you can simply untwist, or it may be foil that needs to be peeled back, plus a separate bare wire. Strip back the shield to expose several inches of the insulated central conductor, and strip the insulation from the tip of that. Connect that to the Vi point on your voltage divider, and connect the shield to the common ground Gnd.


Input Range Measurements:

Now set the oscillator to several hertz, or repeatedly flick your manual switch, and monitor the sound card input waveform with Daqarta. To do this, open the Input control dialog (thin unlabeled button below Input on the toolbar) and make sure you have the correct Line Select, which should usually be "Line". Start out with the Line In sensitivity at 0 (most sensitve); you will probably need to reduce this to negative values later. Make sure both Left and Right channels are on, and toggle the Input on.

The sound card can't read the DC battery voltage as such, because there is a blocking capacitor on the input that will only pass AC. Here's where the trick comes in: When the oscillator or switch suddenly applies a positive voltage step to the sound card, the uncharged capacitor acts briefly like a short circuit. For a moment, the capacitor passes the full DC voltage to the rest of the input circuit, where it is converted by the ADC. This peak voltage quickly decays toward zero as the capacitor charges up, usually in tens of milliseconds or less.

But the peak voltage is exactly the value you want. All you need is to capture that peak. This is something that Daqarta can do easily with the proper Trigger settings. Set the trigger mode to Normal, which means Daqarta will wait indefinitely until the signal crosses the trigger level before updating the display. Set the trigger Level to around 10 to 20% of full-scale, Slope to Positive, and Delay to -100 samples. Make sure Source is set to Left In, and that Trigger is on.

When the oscillator goes high, or the switch connection is made, you should see a sharp vertical edge followed by a decay that may run all the way across the trace. If nothing happens, try setting the trigger Level lower. You can set the trigger mode to Auto temporarily until you see a response. Note that if your sound card inverts polarity (like the Behringer UCA202), and you are using the manual switch method, the positive-going pulse will appear to be negative. Change the Trigger Slope to Negative and set the Level to -10 to -20% and proceed.

If the peak has a flat top or is heavily rounded, you are overdriving the input. The first thing to try is reducing the Line In sensitivity to more-negative values. If you get to the minimum (-191) and there is still a flat top, you'll have to reduce the input voltage via the voltage divider. This is easy if you are using a potentiometer instead of discrete resistors. Aim for the highest peak that has no flat spot.

Important: When the square wave goes low, or the manual switch goes off (on a normal-polarity sound card), it causes a mirror-image negative peak that is normally off-screen. It decays upward toward the 0 baseline, and must be back at or near 0 by the time of the next positive peak. (The reason for the negative trigger delay setting is to move the positive peak to the right so you can verify this.) If the positive peak isn't starting from close to 0, reduce the switching or oscillator rate as needed.

You only need to capture one good peak to make the measurement. To be a "good" peak the top must look sharp; you might want to use eXpand to resolve individual data points. With the manual switch method, don't use traces that show contact bounce before the peak; later bounces are OK.

Now you need to measure the height of the peak to find out what Daqarta thinks the battery voltage is, based on its default calibration of 1.000 volt full-scale. Set the solid trace cursor to the baseline just before the peak, and the dashed cursor exactly on the peak. Use SHIFT plus the left and right arrow keys while watching the Delta cursor readout to make sure you are reading the highest peak value. Here is an example from a CM6206 5.1 channel USB card:

This peak was measured using the above method at 8.95 volts, but remember that this is what Daqarta thought with the default calibration. (The Input Line sensitvity was set to step -102 to avoid clipping.) X-axis eXpand has been used with Min at -2 msec and Max at 5 msec.

Next you need to find the true voltage. For the manual switch method, just connect the top of the voltage divider directly to the positive battery or supply voltage and use your external meter to measure the voltage at the Vi junction that goes to the sound card.

If you are using an oscillator, you can set the frequency very low, to 0.2 Hz or so, to allow your meter to settle during the high phases of the square wave. Or you can just disconnect the high side of the voltage divider from the oscillator, and connect it directly to the power supply instead. That will be quite accurate, since the Arduino or CMOS outputs have very low internal resistance compared to the voltage divider.

Measure the DC voltage at the Vi junction while the sound card input is still connected. This is the true sound card input voltage, the size of the positive step or square wave phase. To find the true full-scale range, divide this true voltage by the Daqarta peak voltage reading. Enter that result into the Range box for the proper line, and the Daqarta reading should then agree with the meter.

The above assumes you haven't previously set a Range value for this line, and it is starting at the default of 1.000. If you are just updating a previous calibration value, then multiply the result of the above division by the current Range setting to get the new setting.

If you discover that your card inverts, be sure to enter the Range as a negative value so Daqarta will know to invert all input signals. After that, you won't have to consider the inversion issue again on that line. See Polarity Determination to determine output polarity.


Calibrating Output Range:

Once the input range is calibrated, remove the oscillator or switch and the voltage divider, and connect the sound card output directly to the input with a male-male cable. Set the Generator to produce a 1 kHz (or so) sine wave at 100% Level.

With both Generator and Input active, adjust Input sensitivity and Generator volume (F9 key) to get a high but undistorted signal spectrum. (Leave the Generator Level at 100%.) There will a sudden onset or sharp rise of spectral peaks at harmonic frequencies if the signal is distorting. This is much more sensitive than judging sine-wave distortion by viewing the waveform.

Make sure that RMS and Y-log are toggled off in the Spectrum control dialog. Obtain the spectral peak value with the cursor readout. You can use the Spectrum Cursor Track option to automatically position the solid cursor at the peak, and use the Spectrum Cursor Peak option to correct for spectral leakage. Read the (now calibrated) Input level, then read the reported output level.

The true Wave Out range is the current range times the input voltage divided by the reported output voltage:

Test_RangeOut * TrueInput / ReportedOutput

However, the above calculation does not consider the sound card output and input impedances. The situation is a voltage divider that reduces the true input voltage Vi at the sound card's ADC, relative to the true no-load sound card output Vo:

The value calculated above assumed output impedance Ro was zero, and/or the input impedance Ri was infinite. The true value has thus been reduced by the divider according to:

Ri / (Ro + Ri)

To find the correct value, which would have been measured if the assumptions were true, multiply the computed value by the reciprocal of the above:

True_RangeOut = Test_RangeOut * (Ro + Ri) / Ri

Enter that as the new Wave Out value in the Full-Scale Range dialog.


See also Full-Scale Range Dialog, Output Voltage Method, DaquinOscope Method, Polarity Determination, Calibration Menu

GO:

Questions? Comments? Contact us!

We respond to ALL inquiries, typically within 24 hrs.
INTERSTELLAR RESEARCH:
Over 35 Years of Innovative Instrumentation
© Copyright 2007 - 2023 by Interstellar Research
All rights reserved