Author Topic: OSH Audio THD instrument and live BOM  (Read 4308 times)

0 Members and 1 Guest are viewing this topic.

Offline asgardTopic starter

  • Regular Contributor
  • *
  • Posts: 124
  • Country: us
OSH Audio THD instrument and live BOM
« on: February 02, 2019, 01:30:10 am »
I am working on a project that was inspired from an article in NutsVolts this month.  It is a respin of an Audio-Range THD instrument that uses modular construction and is a more-or-less complete THD measuring device.  I am including here the PDF's of all three of the main assemblies and the "live" BOM spreadsheet.  The main point here is not precisely the project as such, but I wanted to contribute how I express a complex bill of materials statement for a multiple-assembly project that people here might use and get ideas about how to set up their own projects.  This one has seven worksheets in the Excel document, one for each of the three oscillators, three notch filters, and the main board.  I think the likely coolest thing here is the automatic selection of the price-break costing for each part based on the number of units to be produced.

J.R. Stoner
Klaatu Barada Nikto!

J.R. Stoner Bifrost Development Group asgard@jeffnet.org
 

Offline Aztlanpz

  • Regular Contributor
  • *
  • Posts: 100
  • Country: us
Re: OSH Audio THD instrument and live BOM
« Reply #1 on: February 03, 2019, 05:17:55 pm »
I am working on the same thing, but I am using Altium.
 

Offline asgardTopic starter

  • Regular Contributor
  • *
  • Posts: 124
  • Country: us
Re: OSH Audio THD instrument and live BOM
« Reply #2 on: February 06, 2019, 11:35:05 pm »
Not sure of the point of that.  The drawings, while prepared with a particular CAD tool, was only incidental to the main purpose, which was to give out a way to do BOM's.
Klaatu Barada Nikto!

J.R. Stoner Bifrost Development Group asgard@jeffnet.org
 

Offline moffy

  • Super Contributor
  • ***
  • Posts: 2216
  • Country: au
Re: OSH Audio THD instrument and live BOM
« Reply #3 on: February 07, 2019, 12:25:06 am »
What is your expected performance? i.e. 0.01% or 0.001% etc
 

Offline cat87

  • Regular Contributor
  • *
  • Posts: 230
  • Country: nl
Re: OSH Audio THD instrument and live BOM
« Reply #4 on: February 07, 2019, 08:08:44 am »
The yhing to warch out for would be the oscillator's own THD. You need it to have at least -80 or -90dB THD to be9f any real use. Because that will ultimately dictate the performance of the whole set-up.

Have you built that oscillator yet ?

Offline asgardTopic starter

  • Regular Contributor
  • *
  • Posts: 124
  • Country: us
Re: OSH Audio THD instrument and live BOM
« Reply #5 on: February 07, 2019, 04:47:05 pm »
My goal here to to get to 0.005% accuracy.  The largest limitation is that I do not presently possess a proper metrology lab so there will have to be some allowance  The Oscillator modules have been designed and parts purchased acquired.  What really helps is to use better class passive components.  I have set minimum stability to 100ppm or better.  The modules are simple 2-layer construction, but if I want to respin it later I might go 4-layer to get a bit more ground plane shielding.  I do not have very good metal-bending capability here so I will have to "hand-cook" some sort of metal shielding around the PSU and AC inlet, even though the enclosure is plastic.  If for whatever reason this goes to any amount of productisation I will contract that out.  Those measures would necessarily increase costs.
Klaatu Barada Nikto!

J.R. Stoner Bifrost Development Group asgard@jeffnet.org
 

Offline asgardTopic starter

  • Regular Contributor
  • *
  • Posts: 124
  • Country: us
Re: OSH Audio THD instrument and live BOM
« Reply #6 on: February 07, 2019, 04:49:38 pm »
There are three filter and three oscillator assemblies, each tuned with the values indicated in the schematics.
Klaatu Barada Nikto!

J.R. Stoner Bifrost Development Group asgard@jeffnet.org
 

Offline rhb

  • Super Contributor
  • ***
  • Posts: 3516
  • Country: us
Re: OSH Audio THD instrument and live BOM
« Reply #7 on: February 07, 2019, 05:43:05 pm »
I'm curious why use an analog design rather than a sound card?

With a good card and a custom set of WAV files you can solve for and correct the errors in the input and output sections of both channels.

I posted the algebra of the correction to another thread a few weeks ago.  If you play a monotone at each frequency in the FFT at multiple amplitudes you should be able to correct all the errors to numerical precision.

Give "Max Wein, Mr. Hewlett and a Rainy Sunday Afternoon"  by Jim Williams a read.
 

Offline asgardTopic starter

  • Regular Contributor
  • *
  • Posts: 124
  • Country: us
Re: OSH Audio THD instrument and live BOM
« Reply #8 on: February 07, 2019, 07:26:58 pm »
For much the same reason as for any bench instrument, I want to minimize any multi-MHz signals flapping around.  To get 0.005% accuracy even the noise level in the 4-layer example Dave recently demonstrated is too much.
Klaatu Barada Nikto!

J.R. Stoner Bifrost Development Group asgard@jeffnet.org
 

Offline cat87

  • Regular Contributor
  • *
  • Posts: 230
  • Country: nl
Re: OSH Audio THD instrument and live BOM
« Reply #9 on: February 07, 2019, 09:00:57 pm »
In case you have't come across this already, here's a  link to Cordell's THD analyzer. All analog, just like yours. Maybe this will help somehow. Also, for THS measurements, usually you want the filter and oscillator to be in sync when doing the frequency sweep

http://www.cordellaudio.com/papers/thd_analyzer.pdf

Offline asgardTopic starter

  • Regular Contributor
  • *
  • Posts: 124
  • Country: us
Re: OSH Audio THD instrument and live BOM
« Reply #10 on: February 08, 2019, 12:15:47 am »
Here is an updated BOM worksheet.  Two things are different.  First the main board is now a 100x100mm 4 layer design, with much better notated clearances for the modules.  Second is a classic "trap for young players"  You will now not be required to pay yourself sales tax for inhouse constructed sub-assemblies.  There is a little bit more transparency as to the cost outlay for the board fab.  The consumer margin calculation now reaches my desireable price point of $200 per unit, which sets the marginal profit per unit at 0.4.  Your mileage may vary on what marginal profit a product requires.  As long as that number is greater than one you will not have to make up losses in volume sales L)
Klaatu Barada Nikto!

J.R. Stoner Bifrost Development Group asgard@jeffnet.org
 

Offline rhb

  • Super Contributor
  • ***
  • Posts: 3516
  • Country: us
Re: OSH Audio THD instrument and live BOM
« Reply #11 on: February 09, 2019, 01:11:07 am »
For much the same reason as for any bench instrument, I want to minimize any multi-MHz signals flapping around.  To get 0.005% accuracy even the noise level in the 4-layer example Dave recently demonstrated is too much.

The Cirrus Logic WM8860 32 bit digital audio codec datasheet specifies THD at 18 ppm which is slightly better than your 50 ppm.  Most of the codecs I looked at were around 25-30 ppm THD+N.

It's important to understand that the noise that Dave showed is *radiated* noise.   It is not noise on the signal traces.

You can correct for THD in the ADC and DAC.  If you generate a WAV file with a pure sine wave, play it back through each  DAC and record it with both ADCs, you can correct the codec THD.  Random noise can be suppressed by averaging many FFTs from a long recording.  It's also the easiest way to solve the calibration problem in the bargain.

All modern music production is digital unless someone is making direct to disk vinyl again.  I can assure you that all that equipment would show similar levels of radiated EMI to what Dave demonstrated.  The sole exception would be the direct to disk gear.

In the 70's everyone competed for the lowest THD rating amplifiers.  The fundamental problem is that the speakers and microphones are several percent THD.  So even if the  amplifier THD were zero, the result would not change noticeably.

Aging and temperature will cause an analog THD meter to vary in a manner which is difficult to correct.  A DSP approach can be recalibrated every time it is used.  And at ~$150 for a 2x2 24 bit 192 KSa/S  USB interface, it's certainly cheap enough.

As your computer almost certainly already has a sound card, I suggest you start by writing the calibration code for that and then see if you can beat it with an analog design.  As it is not studio recording gear, you probably can by a small margin.  I doubt that you can beat the studio gear, but I could be wrong.

I'm a retired reflection seismic research scientist/programmer.  DSP does not get more complex than reflection seismology.  With wells that run $200+ million to drill, no one bats an eyelash about spending a few million on DSP, *if* they are convinced it will improve the results.  We have to deal with waves, tides, changing water temperatures and currents, changing sediment velocities, noise no one is quite sure where it comes from though marine life are a prominent source and all manner of other strange things which have to be analyzed, characterized and removed.

BTW My Tek 485 is entirely analog.  I'd bet that probing it would show similar levels of EMI to Dave's example.  The horizontal sweep has to go from max to zero as fast as possible to get ready for the next sweep.  That falling edge generates lots of high frequency harmonics.

At a bare minimum, implementing a sound card based THD meter will help you build the Wein bridge oscillators you need and teach you a lot about measuring THD.

I won't write the code for you, but I will give you a detailed description and answer questions.  This is the sort of thing I did for 30+ years at PhD level for major and super-major oil companies. For extraneous reasons I did not get my PhD.  But most of my clients did, many of them from Stanford.  If any of us had a problem, the first step was to go across the hall, which either got an answer or a "go talk to Joe, he mentioned something about that over lunch a few weeks ago."

I do *not* like being retired.  It is not even close to the level of fun I had going to work.  But along with many friends, I'm too old to get a job again.  I ran an "orphan home for lost problems", so lots of strange and interesting things would walk in my office or appear in my Inbox.
 
The following users thanked this post: diyaudio, Richard Crowley, Jacon

Offline asgardTopic starter

  • Regular Contributor
  • *
  • Posts: 124
  • Country: us
Re: OSH Audio THD instrument and live BOM
« Reply #12 on: February 09, 2019, 02:51:59 am »
Actually I appreciate that.  I don't need any code written for me, as in my previous life I developed microcore logic and code to implement beamforming hearing aid devices.  In order to accurately compensate for head-related transfer functions (look that one up if you want to be sleepy) I had to use some hefty DSP in 40-core multiprocessors.  One can appreciate the code density when you have to have a 42-bit accumulator for IIR functions in a 15-bit processor, with a budget of 192 words of memory for code and data.  Anyway, after all that noise I wanted to see how "simple" I can make an accurate bench instrument, and I think a quad op-amp is quite robust for an accurate oscillator or filter.  I am compromising enough to require a good (Rigol-class) oscilloscope to collect and integrate the THD measurements outside of this unit.
Klaatu Barada Nikto!

J.R. Stoner Bifrost Development Group asgard@jeffnet.org
 

Offline rhb

  • Super Contributor
  • ***
  • Posts: 3516
  • Country: us
Re: OSH Audio THD instrument and live BOM
« Reply #13 on: February 09, 2019, 11:32:29 pm »
Actually, I've  been thinking about writing the code, though obviously you don't need it.

After reading the datasheets I got to wondering how much improvement in THD one could achieve by running a calibration routine.  I've always admired the Jim Williams essay I cited earlier.    Building a super low distortion Wein bridge oscillator  seems like a fun project and naturally I'd need some way to characterize it.

If you've not read it, it's pp 7-19 of:    web.mit.edu/6.101/www/s2017/handouts/williams.pdf 

Jim's final version had a THD of 3 ppm!

Current notion is sweeping across both frequency and amplitude :

Frequency
   Start
   Stop
   Step (linear or log)

Amplitude
    Start
    Stop
    Step (weighting??)

 FFT
     Length
     Repetitions to average
 

Offline asgardTopic starter

  • Regular Contributor
  • *
  • Posts: 124
  • Country: us
Re: OSH Audio THD instrument and live BOM
« Reply #14 on: February 10, 2019, 06:48:30 am »
It seems to me two more corrections would have to be done - first to characterize the inevitable non-linearity of the converters, and second to account for drift in the sample clock because after all, Nyquist uber alles.
Klaatu Barada Nikto!

J.R. Stoner Bifrost Development Group asgard@jeffnet.org
 

Offline rhb

  • Super Contributor
  • ***
  • Posts: 3516
  • Country: us
Re: OSH Audio THD instrument and live BOM
« Reply #15 on: February 10, 2019, 04:50:14 pm »
Actually, Nyquist does not rule, Shannon does.  Compressive sensing evades Nyquist, but not Shannon.  Nyquist addressed the case of regular sampling which results in a convolution in the frequency domain with a spike series.  The Nyquist limit is where the adjacent images of the spectrum overlap.

The attached figure is from "A Mathematical Introduction to Compressive Sensing" by Foucart and Rauhut.  There are 5 sinusoids (top left) that make up the 64 point series (lower left) and those 5 sinusoids are *exactly* recovered (lower right)  with only 16 randomly selected samples.  One more than the Shannon minimum of 15.

The point of sampling all the amplitudes at all the frequencies is to deal with non-linearities.  The variation of the sampling clock will require more thought.  That is a *very* extensively studied problem in reflection seismology as the sources and receivers are never exactly uniformly spaced.  But I think a sparse L1 pursuit would solve it to within 1/f noise.

If you feel any random pains that will be me sticking pins in a voodoo doll of a Norse deity for bringing up the clock variance ;)
 

Offline ciccio

  • Frequent Contributor
  • **
  • Posts: 659
  • Country: it
  • Designing analog audio since 1977
    • Oberon Electrophysics
Re: OSH Audio THD instrument and live BOM
« Reply #16 on: February 10, 2019, 08:35:23 pm »
Give "Max Wein, Mr. Hewlett and a Rainy Sunday Afternoon"  by Jim Williams a read.
Thank you for the citation.
I googled fo it and found some really interesting pages to be read this evening.
« Last Edit: February 10, 2019, 09:19:52 pm by ciccio »
Strenua Nos Exercet Inertia
I'm old enough, I don't repeat mistakes.
I always invent new ones
 

Offline rhb

  • Super Contributor
  • ***
  • Posts: 3516
  • Country: us
Re: OSH Audio THD instrument and live BOM
« Reply #17 on: February 10, 2019, 09:29:03 pm »
The attitude towards learning that Jim displays just makes you feel good.  Anything by Jim Williams is a pure delight to read.
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 15149
  • Country: de
Re: OSH Audio THD instrument and live BOM
« Reply #18 on: February 11, 2019, 11:01:11 am »
An analog THD meter can be relatively easy for a single frequency, as the oscillator and notch can be well tuned. It gets way more difficult if the frequency is variable.  Like with the purely digital approach one could correct for some of the source errors - so the limit is at something like 1/10 the source quality, maybe a little better, if the system and DUT is broad band and very stable.

Today I would also prefer the more digital way - it takes quite some effort to make a Wien bridge oscillator as good as a good sound card. 
 

Offline asgardTopic starter

  • Regular Contributor
  • *
  • Posts: 124
  • Country: us
Re: OSH Audio THD instrument and live BOM
« Reply #19 on: February 11, 2019, 05:14:54 pm »
My approach here is to have three representative oscillator/filter pairs switched in, 100Hz, 1KHz, and 10KHz.  All  six modules are tuned to as great an accuracy as I can achieve.  One thing I have been considering lately is how to represent the analysis, either as a result of an FFT executed on the scope, or another simple analog method, which is a peak-detect and hold circuit after the notch filter.  That would only require a multimeter to directly measure the power density of the distorted spectrum.  Again the goal here is not to achieve perfection, which we all know is the enemy of good-enough.  What I wanted to do is to show how an adequately good benchtop instrument can be constructed with a BOM budget of $200 or less.  Also, the point was to show how the project can be managed adequately well using some schmarts in an Excel spreadsheet in a way that scales
Klaatu Barada Nikto!

J.R. Stoner Bifrost Development Group asgard@jeffnet.org
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 15149
  • Country: de
Re: OSH Audio THD instrument and live BOM
« Reply #20 on: February 11, 2019, 05:27:19 pm »
I think it makes absolute sense to use some kind of FFT to look at the signal after the notch. This has a few benefits: one can use it to check the tuning (too much base frequency coming through) and one can differentiate between the harmonics.  So a certain level one could even subtract the levels from the source, if the DUT is broad band and does not alter the harmonics very much.  Looking at it an a FFT way also allows for more tolerance to noise. 

The FFT could also provide another digital notch function, so suppressing residual base frequency. The analog notch would be still needed or at least very useful to keep the demand on the ADC low.

At least for the relatively low frequencies a simple µC base solution might be sufficient.
 

Offline rhb

  • Super Contributor
  • ***
  • Posts: 3516
  • Country: us
Re: OSH Audio THD instrument and live BOM
« Reply #21 on: February 11, 2019, 07:13:27 pm »
 i do not know of a single DSO with a decent FFT.  I've had experience with MSOX3104T, RTM3104, Instek MSO-2204EA, Rigol DS1102E and LeCroy LC684DLX.  The Instek and the LeCroy are the best of the lot. The Keysight, R&S and Rigol are completely useless.

FWIW the Instek GDS-2000E series has a very nice FFT based SA function.  Instek only supports it on the MDO line, but you can hack the key and run it on a GDS-2072E.  However,  the programmer did not calculate the modulus of a complex number correctly.  So if you sweep a crystal you see a parallel resonance peak, but instead of a notch for the series resonance it's a peak.  Duh!

I strongly recommend just using the DSO to collect the data and then using Octave to do the analysis.
 

Offline asgardTopic starter

  • Regular Contributor
  • *
  • Posts: 124
  • Country: us
Re: OSH Audio THD instrument and live BOM
« Reply #22 on: February 11, 2019, 08:08:11 pm »
Here is a slightly modified version of the track-hold circuit.  Is is configured for a precision peak detector with compensation for the diode reverse leakage.  The MOSFET sets the sample collection period to 8us with an 8us dead time to allow the storage capacitor to completely discharge.  The timing is set with a precision 50% duty cycle pulse train from the 555.  I know it is not a "true" power density measurement, just a peak finder.  But for my purpose it will show in a very simple way how much distorted signal is passing through a DUT, especially if as you say we can accurately calibrate the THD of the oscillators to -90 dB or better.
Klaatu Barada Nikto!

J.R. Stoner Bifrost Development Group asgard@jeffnet.org
 

Offline rhb

  • Super Contributor
  • ***
  • Posts: 3516
  • Country: us
Re: OSH Audio THD instrument and live BOM
« Reply #23 on: February 11, 2019, 09:59:40 pm »
Have you read the Jim Williams paper?  It's starts on page 7

web.mit.edu/6.101/www/s2017/handouts/williams.pdf

His final oscillator design was less than 3 ppm THD.  But the details of how he analyzed the errors should prove helpful.
 

Offline asgardTopic starter

  • Regular Contributor
  • *
  • Posts: 124
  • Country: us
Re: OSH Audio THD instrument and live BOM
« Reply #24 on: February 11, 2019, 10:38:31 pm »
Yes, I read it.  Kinda makes me super smart to make the whole project super modular so if I were to adopt such a type oscillator it would only require a respin of a rather small board assembly.  The only problem is to see about sourcing some of the parts for the specific example oscillator as some are quite probably obsolete.  But other than that it is intriguing.
Klaatu Barada Nikto!

J.R. Stoner Bifrost Development Group asgard@jeffnet.org
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf