# Detecting low frequency:high power clipping in realtime

#### Rezo

##### Well-known member
I have a project in mind that I want to see if is accomplishable with a T4.0

I would like to be able to detect in realtime clipping in a frequency range of 0-200Hz where is source signal would be an amplifier output that is capable of up to 20Kw
For clipping detections can the Teensy do this or is it an overkill?

I want to keep the component count as low as possible, so preferably the Teensy and some form of step down circuit to lower the 200+ AC volts from the amp down to a 3.3v signal for the teensy with some form of input protection etc

Thanks,
David

The peak voltage of 240V AC is 340V.
If your input is from this source you need your step down circuit to handle this peak (and a a bit more) voltage.

Given a meaningful 10bit ADC input, gives an efective resolution of 0.33V of tartget input signal. Is that sufficeient?

I’m not sure if it is sufficient - is it? My knowledge in this area is fairly low.
I assume that the 10 bit resolution means that measuring amplitude wont be precise and I could miss clipping events?

Is the PA system class D?

Its car audio, but yes class D

Then you can't detect clipping from the speaker outputs without a good low pass filter as well as voltage divider - you need to remove the switching frequency. Most class D outputs are bridged too, so the signal is likely differential.

Yes some of the more high power amps are full bridge class D's so perhaps I can use two analog inputs to capture the positive output and the negative output and sum their measurements together?

A voltage divider and LPF is given, but that's hardware dependancy. Questions is will the onboard ADC be good enough to detect clipping?
How about detecting harmonic distortion? There is a device called the SMD DD-1 which detects harmonic distortion at preset frequencies - 40Hz and 1Khz
Ideally I would like to create something that can detect clipping or distortion at any frequency between 0 to 200Hz from an amplifier output of between 1 to 20Kw.

Bumping this up for visibility.

I'd like to build an basic test circuit for this. What kind of input circuitry would I need to handle the high voltage as well as the full-bridge class D's with differential outputs? Would the same circuit be able to handle half bridge as well? Eg one input is grounded.
Can anyone point me into the right direction?

All I want to do right now is be able to turn on an LED once clipping is detected, nothing fancy.

Voltage divider and RCRC low-pass filter? Have you tried searching for "class d measurement filter"?

@MarkT Thanks for the reference!
I found this doc by Texas Instruments which uses a simple RC filter for Class D power/thd measurements
So that makes sense to use after the voltage divider.
Now, regarding the voltage divider, do I use a simple single ended resistor divider, or a differential divider? Can a differential divider properly lower the voltage of a single ended amplifier?

And then here is something interesting I found out a few days ago..
A friend of mine bought this little power meter device that seems to be able to calculate true RMS volts/amps/watts as well as load impedance.
It's a very simple device that runs off an Atmega 328p, but here is the input stage (which makes no sense to me, as things seem revered on the voltage divider) which it has to measure volts, as well as a current transformer on the positive speaker wire to measure current:

Does this circuit make any sense?
I can understand the frequency voltage divider at the top to create a stable 2.5v reference voltage, but the voltage divider on the speaker/amp points don't add up:
-In it's current config, barely pulls the voltage down, but flip around R2/R3 with R4 and it's down to a 2v range for a 300v input)
-The 24 ohm resistor and 100pf cap between the speaker and the ac transformer don't either

Bumping this up and I have a new approach.
I no longer need to measure the frequency, I just need to be able to kind of reconstruct the sine wave so that I can do some comparisons on the data points.
Now, to increase the range and eliminate the need to offset the inputs to account for a true sine wave, I've decided to use a Full wave precision rectifier using the following circuit (Fig 6):

I can then measure both the positive and negative half cycles for clipping and not have to worry about negative voltage on the Teensy analog input pin.

My next questions are - what is the best way to:
1. Sample the data at a 250Khz or above sample rate using the ADC library on two different pins
2. Apply a low pass filter in software to reduce noise (unless a hardwar RC filter is more effective)
3. Detect the start/end of each half cycle (I don't mind using a min value to detect near zero point, so a low threshold of lets say 10-15mv as my lowest measuring point)
Thnaks,
David