Level Detectors, Absolute Value, Peak and RMS

Where we discuss new analog design ideas for Pro Audio and modern spins on vintage ones.
User avatar
JR.
Posts: 2952
Joined: Sat May 24, 2008 7:21 pm
Contact:

Re: Level Detectors, Absolute Value, Peak and RMS

Post by JR. » Sat Mar 30, 2013 1:44 pm

mediatechnology wrote:OK, I get the part about how conveniently the micro can scan and scale the display, provide ballistics etc.
It's a nice functional meter with a fairly low BOM and in it's application killer. Need to find the link to the vid you posted.
I suspect the LEDs are the greatest cost.
PICs eventually seem to enter most threads here.
Microchip PIC families are just the platform I am familiar with, there are several brands with similar capability, and it looks like the bigger (32 bit, etc) platforms these days are being licensed from Arm Holdings, I tend to write about what I have used.

But with a theoretical DR of 72 dB (for a 12 bit conversion) and with sub 40 kHz sampling I don't see how you can claim greater accuracy than a continuous time (analog) absolute value circuit costing pennies (5532 + 2X inexpensive dual transistors) that has at least 60 dB of usable range at 20 kHz. I may be wrong but I think that's what I heard.
I don't know that I said that exactly but comparing analog to digital is not apples to apples. There is a difference between accuracy and resolution for A/D conversion. You need X bit linearity (accuracy) so the conversion SAR will converge, but you can accumulate and average samples over time and gain more bits of display resolution. The example I cited where I collected 4 samples in row, gives me 2 more bits just by adding them. Note: in the interest of full disclosure, full wave rectification costs one bit of dynamic range, so 12b a/d rectified is only 11b, but it still doesn't make economic sense to perform even that outside the digital domain. Easier and more effective to do it in code.

The digital equivalent of a low pass filter to average this meter output over time, first computes the instantaneous difference between the last sample, and the accumulated average. Then a factor to simulate the R part of a RxC, adds a fraction of that difference per unit time, to the accumulated result. The accumulated result I used was 16 bits, but it could have been longer if there was some utility in doing that. While the accuracy will never exceed the raw linearity of the conversion, the resolution over multiple samples certainly can. (of course this has practical limits and other error sources are present)
Sampling 20 kHz only 1-1/2 times per waveform period the odds of actually hitting the peak value seem rather slim to me.
Engineering is always about using the right tool for the task. If you need to absolutely, positively, capture the peak voltage of a one time transient, a sampling A/D is not the right approach, as we notice digital scopes use silly high sample rates to provide that capture visobility.

However to bering this back into perspective to read the peak value of a sine wave even at 20kHz, under sampling with a dithered sample rate ( like I mentioned I did) such that it doesn't hit the sine wave at the same place every cycle will work... trust me if it didn't work I wouldn't have used it in a relatively high end console. The APB boys were pretty picky about performance, And I hit the meter with up to 30 kHz sine waves (from an old TS-1) .

In practice even the peak meter result is LPF at something like a 4 mSec RxC (for at least the common PPM standard) so single transient events do not over-report.
I get the averaging across samples part and understand how an 18 bit higher-speed converter would make it better.
But I'm not buying how a 10-12 bit aliased sampled input that's "blind" to the waveform more often that it isn't can be more accurate than a dual op amp and handful of diode-connected transistors. (Or for that matter just diodes.)
It all depends on how you frame the question. How are you using that analog data? In my TS-1 I performed an analog log conversion and then did my own A/D voltage to period or frequency conversion to count up or down x dBu. The analog processing and log conversion had errors at both end, and probably some in the middle too. :lol:
It seems that the HF accuracy limitations of the sampled approach exist at any level whereas the analog approach suffers it's greatest errors only at low levels.
What it looks like to me is that using a PIC allows you to do all this housekeeping and add a lot of functionality at low cost with reduced accuracy due to low sample rate.
I never made any claim that the almost free A/D that come inside cheap PICs are bench test equipment replacements. But I suspect a cheap PIC and DPOT to double the 12 bit dynamic range (by compressing the input 2:1) could give the old TS-1 a run for it's money. Not to mention I could probably make a more accurate and lower distortion sine wave using the PIC. With one of the cheap audio codecs and a pic it would absolutely kick the ass of my best effort for analog technology 30+ years ago. Today I could do better than I did 30 years ago using modern analog technology, but would be foolish to ignore modern digital technology.

One point not really explored in the console digital vs analog meters comparison, the price was not even close to similar but the digital was way way cheaper. Both analog and digital LED meters need the same LEDs so that cost is a wash... all the analog crunching and glue circuitry just to do a simple average only (VU) meter used a ton of PC board real estate, lots of insertions and lots of separate parts. I did the digital meter in a smaller package, added more features and functions, and even performed some of the related analog circuitry (like steering meter input for solo, alarm notification, etc) all for less cost.

We hear nothing but raves from customer, while customers these days willing to invest in analog consoles seem to be a declining market segment.
Kinda like an iPad or iPhone-based drum tuner...
Well you can buy one It's only something like $2. I even provide a link to it on my website because it isn't really competition. Like i said, I have an aversion to making products that can be covered by a cheap smart phone app. I spent months trying to make my tuning invention work with only one loud speaker to make it cheaper and smaller and it does not work right with less than two speakers. The lug matching "clear" measurement I make (from a standing wave I excite in the drumhead) does not converge with only one sound source. The lugs interact with each other. I need to use two speakers to bracket and isolate one lug at a time to make useful clear quality (different than note pitch) measurements that converge. Tuning drums is not just about the notes. In fact drums are technically not even considered "pitched" instruments with the exception of the tympani and kettle drum. The hard part is to get the lugs in agreement with each other independent of the note the drum is making.

If you have any interest in learning about drums, or buying that Iphone app here is an article I wrote about drums, called "about drums" (go figure). http://www.resotune.com/About_drums.htm The link to the IPHONE app is in my discussion about note sniffers.

Sorry for the veer... There will always be analog... in fact some of the issues I talked about with the cheap A/D are related to analog or hybrid analog circuits like sample and holds.

I tried to drag APB kicking and screaming into the digital age. I fear they may end up like the dinosaurs, which saddens me because they are friends.

JR
Don't only half-ass tune your drums. Visit https://circularscience.com to hear what properly "cleared" drums sound like.

User avatar
mediatechnology
Posts: 3916
Joined: Sat Aug 11, 2007 2:34 pm
Location: Oak Cliff, Texas
Contact:

Re: Level Detectors, Absolute Value, Peak and RMS

Post by mediatechnology » Mon Feb 06, 2017 4:21 pm

I wanted to post this very clever circuit for a dB meter using the RSSI output of an NXP SA604A FM IF stage.

Image
The NXP SA604 FM IF used as an audio dB meter.

Image
NXP SA604A Block Diagram

Image
The NXP SA604 audio dB meter linearity.

The linearity is quoted as being within 1.5 dB over an 80 dB dynamic range.
For 0.5 dB accuracy they recommend using a segment of about 40-50 dB.

NXP AN1991 "Audio decibel level detector with meter driver" http://www.proaudiodesignforum.com/imag ... AN1991.pdf

NXP SA604A Datasheet http://www.proaudiodesignforum.com/imag ... SA604A.pdf
https://ka-electronics.com

"Antifa puppetmasters to engineer 'patriot' slaughter of Leftists to spark violent uprising against conservatives" https://www.naturalnews.com/2019-10-20- ... tists.html
"There's A War On For Your Mind" Banned.Video https://banned.video/

User avatar
mediatechnology
Posts: 3916
Joined: Sat Aug 11, 2007 2:34 pm
Location: Oak Cliff, Texas
Contact:

Re: Level Detectors, Absolute Value, Peak and RMS

Post by mediatechnology » Wed May 10, 2017 2:22 pm

From the Microcontrollers PIC Forum:
More than averagely fun & disparate collection of Level, Absolute Value, Peak and RMS Detectors
http://microcontrollers.2385.n7.nabble. ... 01073.html

I found this reference to our forum very amusing.
https://ka-electronics.com

"Antifa puppetmasters to engineer 'patriot' slaughter of Leftists to spark violent uprising against conservatives" https://www.naturalnews.com/2019-10-20- ... tists.html
"There's A War On For Your Mind" Banned.Video https://banned.video/

User avatar
JR.
Posts: 2952
Joined: Sat May 24, 2008 7:21 pm
Contact:

Re: Level Detectors, Absolute Value, Peak and RMS

Post by JR. » Wed May 10, 2017 3:44 pm

mediatechnology wrote:From the Microcontrollers PIC Forum:
More than averagely fun & disparate collection of Level, Absolute Value, Peak and RMS Detectors
http://microcontrollers.2385.n7.nabble. ... 01073.html

I found this reference to our forum very amusing.
So if you link to a forum that is linking to you, does that crash the WWW or create a singularity? :lol:

JR
Don't only half-ass tune your drums. Visit https://circularscience.com to hear what properly "cleared" drums sound like.

User avatar
mediatechnology
Posts: 3916
Joined: Sat Aug 11, 2007 2:34 pm
Location: Oak Cliff, Texas
Contact:

Re: Level Detectors, Absolute Value, Peak and RMS

Post by mediatechnology » Wed May 10, 2017 4:00 pm

So if you link to a forum that is linking to you, does that crash the WWW or create a singularity? :lol:
It's positive feedback. :lol:
I'm building up for an oscillator series.

BTW I really thought Cordell's level detector for oscillator stabilization was pretty slick due to its simplicity so I put it up in the first post along with a few other additions.
It's low-level performance doesn't need to be good.
What I like about it is that no op amps run open loop during zero cross so its likely to be very quiet in an oscillator.

Image
Cordell Rectifier From "A High Performance THD Analyzer."

See: "Bob Cordell: Build A High Performance THD Analyzer" https://www.proaudiodesignforum.com/for ... f=12&t=805
https://ka-electronics.com

"Antifa puppetmasters to engineer 'patriot' slaughter of Leftists to spark violent uprising against conservatives" https://www.naturalnews.com/2019-10-20- ... tists.html
"There's A War On For Your Mind" Banned.Video https://banned.video/

User avatar
mediatechnology
Posts: 3916
Joined: Sat Aug 11, 2007 2:34 pm
Location: Oak Cliff, Texas
Contact:

Re: Level Detectors, Absolute Value, Peak and RMS

Post by mediatechnology » Fri Aug 02, 2019 3:27 pm

Found these comparator-based positive and negative peak detectors in the LM311 datasheet.
I didn't recall this particular example...


Image
Positive and Negative Comparator-based Peak Detectors Using the LM311.

The LM311 symbol is the odd logic format.
The inverting input has the ball.
Note the attempt to prevent TL081 voltage follower latch-up and capacitor discharge current into the input.
Also be aware that the capacitor polarity shown in the negative example is incorrect.

The negative peak detector version is easily implemented with the open collector LM339 and LM393.
https://ka-electronics.com

"Antifa puppetmasters to engineer 'patriot' slaughter of Leftists to spark violent uprising against conservatives" https://www.naturalnews.com/2019-10-20- ... tists.html
"There's A War On For Your Mind" Banned.Video https://banned.video/

Post Reply