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

# Decimate Demodulate

Controls: X-Axis Dialog >> Slow >> Demod
Macro: X_Demod

## Introduction:

When the Demod button is active in Decimate mode, the waveform display shows half of the signed difference between the maximum positive and negative raw data points that are included in each decimated display point. In other words, if the Decimate Factor is 20, then 20 input values are used to create each display point; if those raw values range between (say) +80 and -80, the displayed data point will be shown as (80 - (-80)) / 2 = 160/2 = 80, which is the amplitude of the input waveform. If the input waveform is a high frequency whose amplitude is slowly changing (modulated), this will show only the change... demodulation.

Note that the displayed waveform will always be positive.

This mode is included to support simple schemes for using a standard AC-coupled sound card to record DC or very slow signals, like temperature or atmospheric pressure.

If your measurement system (such as a strain-gage force or pressure transducer) uses an "AC bridge", you apply an AC "excitation" signal to the bridge. The output of the transducer is an AC signal whose amplitude encodes the measured value.

Similarly, you can apply an AC signal across a linear potentiometer, and the amplitude of the signal at the wiper indicates the wiper position.

An AC signal can drive an LED light source, and a photodiode can provide an AC signal whose amplitude is proportional to the amount of light from the LED that hits it. This can be used to measure light transmission, or the position of an interruptor vane that partially blocks the light.

## Measuring DC Signals:

An intrinsic DC signal (like thermocouple output or battery voltage) can be applied to a "chopper" circuit that simply switches the raw input on and off at (say) a few hundred or a few thousand cycles per second, producing a unipolar rectangular wave at a frequency the sound card can easily deal with. The exact switching frequency is unimportant, since the DC signal is encoded into the amplitude of the waveform.

(It's also possible to use a voltage-to-frequency converter to read DC voltages with the Frequency Counter using the Fcal option. Alternatively, you can use an inexpensive Arduino board running the DaquinOscope macro mini-app plus the Daqarta Voltmeter to measure DC voltages in the 0 - 5 V range on up to 4 channels.)

Note, however, that since the reported amplitude is half of the peak-to-peak difference, the resultant trace will be only half the size of the raw input. This can easily be corrected via the External Gain controls.

Alternatively, the chopper can switch between the normal input signal and an inverted version, turning it into a bipolar rectangular wave. This chopper is only slightly more involved than the unipolar version, but gives the correct amplitude with no gain changes. The External DC-to-AC Modulator circuit (actually designed to support Decimate Signed mode) supports this as an option.

To use Demodulate with a chopper, you set Decimate on with a Decimate Rate that is less than twice the chopper switching rate. For example, if the chopper switches at 250 Hz, you should set Decimate Rate to less than 500 Hz. Since the external switch rate is typically subject to component tolerances, it's best to have a safety factor, such as setting Decimate Rate lower than the switch rate.

Whether you use a unipolar or bipolar chopper, Demodulate will work properly only with unipolar (positive or negative only) raw input signals, since only the peak-to-peak amplitude of the wave is recovered. (Negative-only signals will appear to be positive-only.) See the more-complex Signed option for bipolar raw input signals.

## Measuring Slow AC Signals:

Decimate Demodulate can be used to demodulate a conventional amplitude-modulated waveform (such as a bridge, potentiometer, or LED as mentioned earlier), with some qualifications. First, assuming that the carrier (the excitation frequency being modulated) is a sine wave (instead of the rectangular wave used by a chopper), the Decimate Rate should be set lower than the carrier frequency (not twice the carrier).

Second, the resulting demodulated waveform will be the effective amplitude of the carrier at any moment in time. In other words, if it is multiplied by the carrier waveform using a true signed multiply, the result will be the original modulated signal.

This would typically be used for "envelope extraction", such as to obtain the envelope of speech or music for later application to a completely different "carrier" waveform or random noise. (You'd save the demodulated waveform as a file, then load it as a Play Wave in one stream, and use that stream to modulate another stream containing the other waveform or noise.)

(You might imagine that Envelope mode would do this, but although it shows the envelope nicely it is not recommended here. It has separate positive and negative values that make it inappropriate as a modulator.)

However, if you apply Demodulate to a conventional AM waveform, such as a carrier sine wave modulated by a lower-frequency sine wave, the demodulated waveform will not swing about zero like the original modulating sine.

## Emulating a Modulated System:

You can use the Daqarta Generator get a feel for how this works. Load the Default.GEN setup, which creates a simple 440 Hz sine on Left Stream 0. Change Tone Freq to 4000 Hz, then click AM under Modulation. Set AM Mod Freq to 10 Hz, then click AM On on at the top and AM Sync below that. Toggle the Generator on if you haven't already. The waveform will have a fluttery look; since this emulation uses internal signals only, you can can mute the annoying output from the F9 Volume Slider dialog.

Now open the X-Axis dialog and set the Decimate Factor (Decimate X) to 20. Click the Demod button, then toggle Decimate on, and the fluttery display will change to a smooth sine wave at the 10 Hz modulation frequency. (You may need to re-set AM Sync if the trace is not stable.)

With AM Depth set to 100%, the 10 Hz waveform will swing between the mid-screen 0 baseline and the full-scale top of the screen. (Hit SHIFT-Home to make sure the display trace magnification is showing the full-scale range.)

Set Depth Mode to Peak or 50% Base according to the type of system you want to emulate. Suppose you are using a potentiometer whose shaft is the axle of a pendulum to measure tilt. If you set it such that the potentiometer is mid-scale when there is no tilt, and you want a rising signal when tilt is to the left and falling when it is to the right, then 50% Base probably makes the most sense: With Depth set to 0 (no tilt) there will be a flat line at 50% of full scale. If you start the pendulum swinging, you'd expect to see a sine wave that is centered on that point. The Depth setting will then emulate various amounts of swing, above and below the no-tilt baseline. At 100% Depth the swing will run between the top of the screen and the 0 midline.

On the other hand, if the potentiometer is connected to a float to measure liquid level in a tank, you might set it so that the output is highest when the tank is full. If you use Peak mode with Depth set to 0, then there will be a flat line at the top of the full-scale axis. Increasing modulation depth will mean the float is moving from the top to lower tank depths, perhaps due to a drain-and-refill cycle. The peaks of the waveform will always be at the top of the screen, and greater modulation depth will mean deeper excursions below that. At 100% Depth they go all the way down to zero.

Note that if the modulation depth exceeds 100% (in Peak mode), the demodulated waveform will "bounce back" from the zero line where the original modulating waveform goes negative and changes the sign of the carrier.

Important: When you are done with these simulations, be sure to toggle Decimate off before you exit Daqarta, unless you want it active in the next session. It can be very mysterious to find everything moving in slow motion if you forget!

## Trigger Considerations:

As with all Decimate modes, you will probably want to run with Trigger off whenever the effective sample rate is below about 500 Hz. This will give a scrolling waveform like a chart recorder or data logger, so the trace remains "live" without long waits for trigger events.

But if you do use Trigger with Demodulate (presumably at higher effective sample rates), note that the triggering operation is applied to the decimated data, not to the raw data. The Trigger Source label becomes a button marked 'Source Decimate', which (unlike in Envelope mode or plain Decimate mode) can't be toggled to 'Source Raw'

GO: