October 10, 2018

CWTD Blog #91:  The Audio Test Gadget ... Creating a usable Audio Test instrument for the workbench

Our topic this time addresses the design and construction of an Audio Test Gadget based on our evolving Test Gadget Design Series.  This new "Audio TG" can serve as a mainstay on your ham workbench for audio testing, evaluation and ongoing experimentation on either your Nano TG motherboard, or the ESP32 TG motherboard. 

 

 

 

Part 1 ...  Why?

 

Joe N2CX

Goal is to incorporate a number of audio test functions into a single “gadget” configuration, each functioning in concert with each other.

 

Advantages of having these functions in a single integrated gadget

                - Small size to fit on a small bench instead of a shelf full of test equipment

                - Integration into a single unit reduces clutter of multiple interconnecting cables, power supplies

And simplified operating controls

 

Potential uses:

           Measure characteristics of the speech processing portion of a voice transmitter.

o   Audio gain (Vout/Vin)

o   Audio response over frequency

o   Gain flatness

o   Characterizing of audio equalization to tailor response for noise elimination, speech quality, communications speech quality, preemphasis/deemphasis.

o   Audio distortion, noise or hum

           Same characteristics for a receiver audio chain.

           Audio filter characteristics

                                Low-pass, bandpass or high pass filters

Limitations

           Limited to audio frequencies below approximately 4 kHz

           Certain graphical displays may be qualitative, not quantitative.

o   Ex oscilloscope and spectral displays limited in size and dynamic range with some granularity

           Voltage and other amplitude displays limited by small micro limitations

           Measurements will be “good enough” quality, not lab grade calibration traceable to NIST

 

Advantages of approach:

           Very usable due to integration and good documentation with minimal detailed knowledge needed

           Ham grade measurements to get reasonable performance from homebrew or commercial ham gear ... Good Enough Resuts!

           Low cost due to use of inexpensive micros (Arduino, Raspberry PI, ESP386)

           Easy to assemble test station due to high degree of modularity.

           Growth possibilities – voltage ranges, frequencies, FFT filters

           Organization of the software (easy-to-read, modify, add)

 

Packaging (including the pcb options soon to be available)

 

 

Part 2:  The Processor

Consistent with our planning, we have now evolved things to be working on both the "smaller" (less powerful) Arduino Nano processor, shown below on the right ...

 

As well as on the vastly more capable ESP32 processor, shown below on the left.

 

   

   ESP32 Processor                                                                         Arduino Nano Processor

 

Part 3:  The Input Interfaces

 

Variety ... It's the spice of life!

George & Joe:

 

 

DuWayne, KV4QB

 

   DuWayne has been following the approach suggested in an Instructables project called "Oscilloscope in a Matchbox". 

Oscilloscope in a Matchbox ... https://www.instructables.com/id/Oscilloscope-in-a-Matchbox-Arduino/

 

            

Why would I want a tiny oscilloscope? I've got a room full of electronic Stuff including four oscillscopes. But it's a fuss using them. It would be nice to have something that fits in my pocket, that sits next to the circuit I'm working on and that's as easy to use as a multimeter.

This oscilloscope costs the price of an Arduino Nano (2 and a display (3) plus a few pence for resistors, etc. It's specification is:

  • max 1M samples/second, min 1000sps

  • 8-bits per sample

  • DC 0-5V; AC +/- 550mV, AC +/- 117mV, AC +/- 25mV

  • USB "PC scope" or built-in display

  • could be battery-powered

  • optional logic display

  • optional frequency meter

  • optional voltmeter

Mostly what I want from an oscilloscope is to know: is the signal present? Roughly how big is it? And roughly what's its frequency? It's not often I really need all the bells and whistles of a proper bench oscilloscope.

How well does it work? At lower sample rates it's quite reasonable. But at 1M samples/second it's pretty poor. You can see that there's a signal and see its frequency but the y-axis is quite crude. After all, it's just an Arduino Nano so it "is like a dog's walking on his hind legs. It is not done well; but you are surprised to find it done at all".

 

 

           

 

 

ArdOsc can also act as a frequency counter by using uses Timer1 and Timer2. There are two ways a frequency counter can work: count the number of rising edges in exactly one second or measure the time from one rising edge to the next rising edge.

Once again, is it worth it? Maybe. I can't remember a time I've needed a frequency counter. It's easy to do so why not?

 

Part 3:  The Output Interfaces

Midnight Audio Signal Generator -- Dave AD7JT

There are several ways to generate audio spectrum output signals from from our processors.  Notably, for sinewaves, a "lookup table" approach can be used to construct the output waveform at most frequencies, with surprisingly good results.  Using an "R-2R Resistive Ladder" approach, or even a "1-bit DAC" approach requires some software overhead and fancy interrupt circuitry to keep the resulatant waveforms smooth and usable.  (Both these approaches are covered in the References section at the bottom of this page.)

Yet another approach deals with generating a Pulse-Width Modulated (PWM) square wave representing the desired frequency, and using hardware integration and low pass filtering techniques to achieve the desired results. This is the path we've chosen *thus far) to follow for inexpensively generating output signals (notable sinewaves) from the Audio TG.  We happen to have already addressed this engineering design challenge in something called the Midnight Audio Signal Generator:  a small board intended as an accessory with some another instrument already in production: the Midnight SNA (MSNA) ... and we can use it nicely here with our Audio Test Gadget.

The Midnight Audio Signal Generator (MASG)  receives a Pulse Width Modulated (PWM) signal and converts it to an analog signal.  It is intended to extend the MSNA operating range down into audio frequencies for testing and analyzing audio networks such as audio filters and preamps.  In addition to the analog signal output channel it includes an input channel to receive the audio network output and condition it for input to the MSNA.

                 

MASG Circuit Operation

The pulse width modulated (PWM) input signal comes from the tip contact on the 3.5 mm stereo audio input jack.  It is AC coupled by C1 to a biasing network (R1 and R2) and biased to VDD/2.  The coupling capacitor is 10 uF which looks like a dead short at the audio frequencies we are interested in.  The MCP601 op amp (U2) is a low pass, Sallen Key active filter with a cutoff point of about 8KHz.  The output of the op amp is fed to a low-voltage audio amp (U3, LM386) through a potentiometer (RV1 or RV2)1.  The potentiometer is used to set the gain of the amplifier stage for calibration. 

The input to the op amp is a simple R (R3, R4) C (C5, C6) integrator circuit.  The capacitor (C) charges through the resistance (R) while the biased input signal level is greater than the charge on C and discharges when the biased input signal is less than the charge on C.  Active part of the filter (U2) provides a high impedance load so C only discharges through R and the feedback through C3, C4 improve the integrator performance and filtering.  The PWM signal is a square wave modulated by varying the duty cycle.  When the is a perfect square wave, the result is a (approximately) triangular wave centered on the bias level.

 

By varying the duty cycle, most any wave form can be generated such as the sine wave we are interested in.

With each cycle of the input signal the longer the input is high the more charge flows into C and the higher the output rises.  Conversely, the longer the input signal is low, the lower the output falls.  The quality of the output signal improves with the sampling rate.  The sampling rate should be many times (32 or more) the highest frequency of interest.  The above plot illustrates the effect of a low sampling rate.

 

The sine wave output of the audio amplifier is AC coupled to the tip contact on the 3.5mm output connector and from there to the input of the device under test (DUT).  The output of the DUT is returned through the ring contact of the output connector and AC coupled to a biasing network (R6 and R6) which biases signal to about 1/3 of VDD.  Since VDD is 5 Volts, the bias level is about 1.65 volts or about midway for a 3.3V signal (ADC input limit on the MSNA).  The biased return signal is then routhed to the ring contact on the input connector.

The output connector switch contacts are wired so that when there is no jack in the connector, the output of the audio amplifier is routed back to the input contact.  This feature is used for calibration.  Measuring the response across the frequency span of interest establishes a base line for compensating for any non-linearity in the test system.

Audio Filter Analysis

Probably the most common use of the MASG is to verify and tune audio filters.  A very common type of audio filter is a narrow band pass filter for CW reception.  By restricting the width of the pass band, weak CW signals can be isolated from interference from nearby signals (QRM) and/or background noise (QRN).  Such a filter is an option for the Midnight Ultimate Keyer (MUK) and MSNA Tutorial 10 describes a procedure for using an MSNA with a MASG to analyze the frequency response of the MUK audio filter. Here's an example of the results of that analysis:

1  Note that only one of RV1 and RV2 is installed.  Two are shown on the schematic because the PCB is laid out to take two different footprints, one for a vertical adjustment and one for a horizontal adjustment.

 

 

Part 5:  The Displays

 

 

 

 

 

 

References

 

  1. RC Low Pass Filter Design Tool ... http://sim.okawa-denshi.jp/en/CRlowkeisan.htm

  2. Advanced Arduino Sound Synthesis [Maker] ... 1-bit DAC ... https://makezine.com/projects/make-35/advanced-arduino-sound-synthesis/

  3. Arduino Audio Output [Instructables] ... R-2R Ladder ... https://www.instructables.com/id/Arduino-Audio-Output/

  4. Oscilloscope in a Matchbox [Instructable] ... https://www.instructables.com/id/Oscilloscope-in-a-Matchbox-Arduino/

  5. DuWayne's blog  ... http://kv4qb.blogspot.com/

 

Copyright 2018, Midnight Design Solutions, LLC.  All rights Reserved.