Measuring the power of sine and square waves.

Gramps

Senior Member
Gentleman, please give me some input on how to measure RMS watts in the audio range.
I've looked at VU meters, RMS meters and a bunch of circuits on line.
The basic measurment according to Google is:
Use a resistor load equal to the rated speaker impedance and measure the maximum voltage across the resistance that does not exceed the rated distortion.
Do this over the rated frequency range of the amp. The power is, equal to Vsquared/R where V is the RMS voltage.
Question, how to convert this result into a digital readout that will track the power output through the audio range?
Thanks, Gramps
 

Solar Mike

New Member
You could use a hall effect current sensor like the ACS712 series, Sensor Link
Place it in series with your speaker to measure the current at various audio frequencies at the corresponding speaker non-linear impedance. Take a voltage measurement at the same time and multiply the two together.
Digital readout ?? Text, bar display, you need to specify the requirement...

Picaxe may be too slow if you want real time measurements.

Cheers
Mike
 

tmfkam

Senior Member
In theory... You could set an oscillator to (say) 20Hz sine wave, measure the voltage across a resistor connected to the output terminals, use that to calculate the power. Change the frequency, repeat. Average the calculated power to give an overall output?

Using Mike's suggestion, you would only need to measure the current, power being current squared, multiplied by the resistance (assuming you do know the resistance, and it remains constant).

Generally I'd consider square waves to be distorted and any power rating using square waves as not accurate. How could you know the amp wasn't clipping?
 

hippy

Technical Support
Staff member
It should be fairly easy to do in principle - Build a bridge rectifier amplifier which has a capacitor to slug the voltage as per VU meters and similar, then read the voltage, do the maths, and display the results.

Determining accurate Vrms directly from the amp's output terminals might prove rather tricky but I expect it could be done.

The big question would be ; how accurate do you want your reported results to be ?
 

hippy

Technical Support
Staff member
In this context, what does "slug" mean?
Basically some kind of RC circuit where the output voltage varies a lot less (more sluggishly) that the input voltage., gives some kind of average like an RC gives a voltage proportional to PWM duty -- I have no idea what the technical term would be; integrator ?

Apart from once calculating the value of a capacitor to act as a 'resistor' (reactance ?) for a LED directly across mains, I have steered well clear of AC and its maths.

I was thinking some sort of pre-amp which gives some sort of average value would simplify things, avoid having to take multiple samples within the waveform and calculate that average, mean-square and whatever.

Otherwise it's really pushing a PICAXE which only does 16-bit maths and has limited memory. It probably can be done but I doubt it would be easy.
 

rq3

Senior Member
Gentleman, please give me some input on how to measure RMS watts in the audio range.
I've looked at VU meters, RMS meters and a bunch of circuits on line.
The basic measurment according to Google is:
Use a resistor load equal to the rated speaker impedance and measure the maximum voltage across the resistance that does not exceed the rated distortion.
Do this over the rated frequency range of the amp. The power is, equal to Vsquared/R where V is the RMS voltage.
Question, how to convert this result into a digital readout that will track the power output through the audio range?
Thanks, Gramps
Any voltage and current injected into any pure resistance will yield an RMS power disappation in the resistor. Most RF (radio frequency) bolometers work by measuring the temperature of a load resistor. How fast and accurate does your measurement have to be?
 

lbenson

Senior Member
bolometer
A word I'd never seen before: "By 1880, Langley's bolometer was refined enough to detect thermal radiation from a cow a quarter of a mile away. "

Never know what you'll learn reading the PICAXE forum. Thanks for that.
 

rq3

Senior Member
Now, I wanna make a bolometer and interface it to a picaxe. How hard can it be.
Pretty easy, I think. A Wheatstone bridge, with a thermistor, driving an ADC input on the Picaxe. Use the Picaxe supply as the bridge supply, so the whole thing is ratiometric. With the right thermistor and a cheap parabolic reflector to focus the incoming infrared on to the thermistor, I'd bet you could detect a cat at 1/4 mile, let alone a cow.
 

Gramps

Senior Member
The big question would be ; how accurate do you want your reported results to be ?
Thanks for your thoughts on this.
We are not measuring music but steady audio frequencies, so + or -- 5% of the actual power output sould be fine.
The load is a 4 ohm coil.
The amplifier will supply about 40 volts at 5 amps (per channel) with a 60 hurtz square or sine wave input (Without clipping. The amp has a fail-safe cutout when it begins to clip).
The problem is my amp meters stop reading accurately when we start raising the frequency.
I realize that the higher frequency is effecting the coil's ability to conduct power, both in the main coil (and in the analog meter!)
We plan to deal with that later.
Right now we are hoping to solve the raw energy draw of the coil across the audio spectrum by sampling the signal perhaps as Solar Mike suggested.
Then convert that to a reasonably linear output using a three digit LED readout calibrated from 0 to 100%.
 

rq3

Senior Member
Probably the cheapest and easiest method is to connect an RMS AC voltmeter across the 4 ohm coil. Square the result and then divide by 4. The result is watts RMS. P=E^2/R.

To make a Picaxe project out of it, I'd glue a thermistor to a non-inductive 4 ohm resistor capable of handling your 200 watts. Then I'd ADC the thermistor drop and go from there. If you don't HAVE to have a 3 digit LED readout, the Picaxe OLED unit has not only a neat display, but an 18M2 that will do everything you need except for the load resistor and the temperature sensor.

Heck, you may not even need the resistor or temperature sensor, but that really depends upon your definition of "audio frequency". If your amplifier is linear enough, testing at 10, 100, 1000, or even 10000 Hertz may be good enough, without having to reach all the way to 20kHz. At 200 watts, this sounds (pardon the pun) like some kind of public address system, which certainly won't reach crystalline highs. Or maybe you're doing 40kHz sonar research? Who knows. There's no such thing as too much information. The more you can tell us, the more we can help.

At a low enough frequency, the 18M2 should be able to ADC the voltage across the coil in "real time". Since the waveform is either square or sinusoidal, the math is identical and trivial, since for both a square wave and a sinusoid the RMS value is equal to 0.707 times the peak.

And I don't want to be anywhere near when you crank that amplifier to 200 watts! Infrasonic, ultrasonic, or anywhere in between! Assuming, of course, that the output is acoustic ;-)
 
Last edited:

tmfkam

Senior Member
For the accuracy you need, why not measure the current and voltage at the D.C. supply feed to the amplifier supply input? If you compared that to the readings given at the output with a 60 Hertz signal you would have some idea of the voltage difference between input and output and then use that offset across the other frequencies to give meaningful results.

If the output is being fed into a coil, even a voice coil of a loudspeaker, the current drawn from the amplifier will be significantly lower at frequencies higher than 60Hz. If it is being fed into a complex arrangement of multiple coils, capacitors and voice coils (loudspeaker with multiple drivers and crossover setup) the variation in impedance is dramatic, see any reviews of a loudspeaker where the impedance chart is displayed for examples. It could be that your ammeter is more accurate than you imagine. That is the reason that to measure the capability of the amplifier you would be much better advised to use a static resistance (i.e. resistors) not a variable impedance. Measuring power into an impedance tells you little about the amplifier, in fact it tells you little about anything, and a lot about a little!
 

julianE

Senior Member
Pretty easy, I think. A Wheatstone bridge, with a thermistor, driving an ADC input on the Picaxe. Use the Picaxe supply as the bridge supply, so the whole thing is ratiometric. With the right thermistor and a cheap parabolic reflector to focus the incoming infrared on to the thermistor, I'd bet you could detect a cat at 1/4 mile, let alone a cow.
I have everything but the parabolic reflector, i guess i can make one out of aluminum foil. I just realized i haven't a cat, wonder if i can substitute it with a rat, plenty of them running around the city :)
 

julianE

Senior Member
Started working on bolometer. Using a 10K NTC thermistor. Measured the resistance of the thermistor in my room, somewhere between 12K and 14K so I'm using 12K for the 3 resistors in the wheatstone bridge. I attached a 5v supply to the circuit and am reading 2.794 volts on the fluke. Not sure what the wheatstone is bringing to the party as opposed to just using a single resistor as a divider. I barely see much of a voltage difference by placing my hand near.
 

rq3

Senior Member
Started working on bolometer. Using a 10K NTC thermistor. Measured the resistance of the thermistor in my room, somewhere between 12K and 14K so I'm using 12K for the 3 resistors in the wheatstone bridge. I attached a 5v supply to the circuit and am reading 2.794 volts on the fluke. Not sure what the wheatstone is bringing to the party as opposed to just using a single resistor as a divider. I barely see much of a voltage difference by placing my hand near.
I think you'll need something like a 100K NTC thermistor. Much steeper response slope. And I agree that the bridge is likely superfluous. A series resistor of about 180K should maximize the response.
 

julianE

Senior Member
I think you'll need something like a 100K NTC thermistor. Much steeper response slope. And I agree that the bridge is likely superfluous. A series resistor of about 180K should maximize the response.
Thanks rq3, I went and ordered 100K NTC from amazon.
 

hippy

Technical Support
Staff member
If the output is being fed into a coil, even a voice coil of a loudspeaker, the current drawn from the amplifier will be significantly lower at frequencies higher than 60Hz. ... That is the reason that to measure the capability of the amplifier you would be much better advised to use a static resistance (i.e. resistors) not a variable impedance.
If it's a good amplifier its power output should be pretty much constant across the range of frequencies. A speaker's impedance invariably isn't.

If the intention is to create 'a consistent volume level' or SPL then it would seem that what you would need to be doing is determining the impedance of the speaker at various frequencies. You would need some voltage into the speaker to determine its impedance so some sort of amp would be needed. Measuring power output is presumably proportional to that so what you are doing should work, and I think I can better understand what you are wanting doing.

Unless I have misunderstood ?
 

Gramps

Senior Member
the accuracy you need, why not measure the current and voltage at the D.C. supply feed to the amplifier supply input? If you compared that to the readings given at the output with a 60 Hertz signal you would have some idea of the voltage difference between input and output and then use that offset across the other frequencies to give meaningful results.
Thanks, for all the good input from everyone! I thought about this idea but we want to read both channels not just a sum of them.
the intention is to create 'a consistent volume level' or SPL then it would seem that what you would need to be doing is determining the impedance of the speaker at various frequencies.
Agreed. We were hoping to do this without impedance measuring, but there doesn't seem to be a way around it!
 

tmfkam

Senior Member
Thanks, for all the good input from everyone! I thought about this idea but we want to read both channels not just a sum of them.
Measure the supply voltage and current at the point it supplies each of the channels you intend to take a reading from?
 

julianE

Senior Member
Looks like you use the rca Jacks, the amp has provisions for single ended (SE) or Diff, my guess is that Diff is what's normally called balanced used to keep noise to a minimum mostly for high end audio and really meant for recording studios. there is a jumper selection for Single Ended and Diff. You would more than likely use the Single Ended since most consumer equipment is single ended. It's the RCA jacks on the left side of the board. There is a left and right. There are also jst pins if you don't want to use the rca jack.
 

tmfkam

Senior Member
PVDD_AB and PVDD_CD are the inputs for the power for the (presumably) bridged outputs. They are shown as separated on the circuit diagram so could possibly be isolated.
 

hippy

Technical Support
Staff member
PVDD_AB and PVDD_CD are the inputs for the power for the (presumably) bridged outputs. They are shown as separated on the circuit diagram so could possibly be isolated.
Probably not so easy to isolate on the board but, as they all go to the PVDD input, one could intercept the externally supplied PVDD.

J29 appears to separate the lower voltage supplies from PVDD power which would allow those to be powered separately. I wouldn't have thought it would make much difference whether one did or didn't.
 

AllyCat

Senior Member
Hi,

Note that this is a "Switching Mode", PWM or "Class D" power amplifier (running probably at 3 MHz) which has the "advantage" that its efficiency is so high that the Output Power (into the load) should be quite similar to the Input Power. BUT you should ABSOLUTELY NOT intercept the power rails between the Integrated Circuit and its decoupling capacitors (C32, C33, etc.) which carry high current "square waves" at probably 3 MHz. Similarly, intercepting the current between C31 and C32 (etc.), is highly risky and probably won't give a "useful" measurement anyway. This is because the high efficiency is achieved by "recovering" energy back into the decoupling capacitors (from the output load/inductors), so the current will flow (and would need to be measured) in both directions. Therefore, IMHO the only "safe" (or useful) place to monitor the input current is between the "PVDD" supply and capacitors C31 and C46. You might also need to monitor the voltage change across those capacitors to calculate the transient input or output power (i.e. energy/time).

PWMamp.png

PWMamp.png

The amplifier uses an "H Bridge" output configuration (i.e. 4 amplifier stages) for at least three reasons: Firstly it doubles the supply voltage across the load; important because the peak-peak voltage needs to be about three times the "average" (rms) voltage (e.g. 300 Watts = V2 / 4 ohms , thus V = square root 1200 = 35 volts rms, or ~105 volts peak-peak) . Secondly, it avoids the need for (very) large output coupling capacitors (or for separate + and - Power Supply rails). Also the "complementary" output format may help to reduce (i.e. partially cancel out) the Radio Frequency Interference which such amplifiers can produce. Beware that such amplifiers MUST be used in the full balanced H-Bridge configuration, DON'T attempt to connect the load to earth.

You haven't given us any indication of what you mean by "Power of Sine or Square waves" or how you intend to use the amplifier. Do you mean (real) Power (i.e the heat into the load), or the VI (Volts x Amps) Product (i.e. the "stress" on the amplifier) or just the "Loudness" of a sound? Is the load even a loudspeaker (or more probably a crossover network) or something else? In most cases a loudspeaker is very probably NOT equivalent to a "resistance" (of 4 ohms or anything else).

The "traditional" method of measuring (electronically) the load power (e.g. of 50/60 Hz mains power) is to "sample" the transient Voltage and Current every millisecond (or faster), multiply each pair of (signed) samples together, then sum the squares of the results for at least one (repeating) "cycle" and finally calcuate the square root (i.e. the Root Mean Square, or rms value). That generally needs a microcontroller running "machine code" (or Assembler) even for 50/60 Hz mains, and probably something more complex for higher (audio) frequencies; therefore absolutely no chance of using a PICaxe.

If you're going to assume that the load is (say) a resistive 4 ohms, then you may as well just estimate the peak-peak voltage output from the Pre-Amplifier, but if you want to measure the actual (transient) output current, then perhaps a Hall effect sensor strapped onto each of the Class D Output filters (L2, L3, etc.) might be practical. For more information see the manufacturers specification and application notes, for example:
https://www.ti.com/lit/ds/symlink/tpa3255.pdf?ts=1648736774695&ref_url=https%3A%2F%2Fwww.google.com%2F
and
https://www.ti.com/product/TPA3255.

However, I've not looked at any of that documentation, so don't know what is the significance of the "Red Cross / DNP"s in the circuit diagram, or why the "GVDD" (Ground ?) is connected to +12 volts. :(

Cheers, Alan.
 

Gramps

Senior Member
or the VI (Volts x Amps) Product
Alan thankyou for this incredibly detailed analysis!!!!
Each channel powers four .9 ohm coils in series. They are each composed of about 125 feet of #18 enamel wire.
Yes, the VI was what we wanted to use as a base line.
The amp is driven by this oscillator:
We are splitting the output with a simple Y connector.
The system operates very satisfactorily, but my beautiful Simpson analog ac amp meters in series with the coils read a power loss as the frequency varies above or below 60 hurtz. I understand that this is caused by the change in the impedance of the coils.
Perhaps we could sample the actual magnetic output of the coils?
The next step in development will be to tune the coil sets to various frequencies.
 

tmfkam

Senior Member
As I alluded to in post 14, your power (current?) meters are probably accurate in showing a lower current at higher frequencies. Using another method, whether PicAxe or something else will likely show similar results.
 

AllyCat

Senior Member
Hi,
Each channel powers four .9 ohm coils in series. They are each composed of about 125 feet of #18 enamel wire.
You haven't indicated the purpose of the "coils" nor even if they are optimised to maximise or minismise their inductance (and/or the magnetic field that they produce). What are their dimensions and are they wound on a "magnetic" core? Are you perhaps trying to transmit energy? If so, you should probably be using a (Radio) "Transmitter" circuit not an (Audio) Amplifier (but beware that there are many wireless transmision regulations that should not be "illegally broken", for any frequency above 16 kHz ! ).

There are also many "Laws of Physics" that cannot be broken. I don't have time to write a complete electrical engineering training course, but:
.... my beautiful Simpson analog ac amp meters in series with the coils read a power loss as the frequency varies above or below 60 hurtz.
A meter connected in series with a Load can only measure current (Amps), it cannot measure "Power". Similarly, a meter connected across a Load can only measure Voltage, again it cannot measure "Power". However, IF the "Load" is a Pure Resistance, then you can use Ohms Law to convert between Volts and Amps (i.e. R = V / I) and then can calculate the Power in the resistance as P = V2 / R or I2 * R . A fundamental characteristic of an Inductor (e.g. a "Coil") is that its impedance increases with frequency, so for a constant voltage drive, the current must fall as the frequency rises.

Capacitors and Inductors do not dissipate "Power", but they can Receive, Store, Convert (e.g. to mechanical movement) and Transmit it (e.g. via a magnetic field) in specific circumstances. Their characteristics (i.e. behaviour) is highly dependent on the frequency applied (i.e. at "d.c" a capacitor behaves as an "open circuit" and an inductor as a "short circuit"). Resistors are rather a "special case" in that they can only receive power and convert it to heat (at d.c. or at any a.c. frequency).

But no electronic components are absolutely "perfect" (or pure): Resistors can be "very good" (pure) but at (very) high frequencies may exibit some inductance (e.g. a wire-wound resistor). Many Capacitors also can be very good, but ultimately may exhibit some inductance (if only of their connecting leads) and/or "leakage current" (e.g. of Electrolytics). However, Inductors are often quite "poor" because they will always have some resistance, so (IMHO) should be specified in terms of their units of "(micro/milli-) Henrys" and their Equivalent Series Resistance (in Ohms). Therefore, Inductors should always be considered (if not actually drawn in a circuit diagram) as being connected in series with a resistor.

The next step in development will be to tune the coil sets to various frequencies.
Fourier discovered that any electrical or audio waveform can be considered as a combination (or "series") of Pure Sine Waves, typically the "Fundamental" frequency and some/all Integer "Harmonics", for example a square wave contains all Odd Harmonics ( i.e. F , 3*F , 5*F , etc.) and Sawtooth/Triangle waves contain Odd and Even (i.e. F , 2*F , 3*F, 4*F , etc.) in reducing amplitude at higher frequencies. Basically, a "Tuned Circuit" will tend to select out the nearest "Harmonic Frequency", with the/a Capacitor becoming dominant at Higher Frequencies (i.e. approaching a short circuit) and the/a Inductor dominant at Lower Frequencies (i.e. a short circuit, in series with its resistance).

Note that a "Parallel Tuned Circuit" driven by a constant voltage at increasing frequency, does NOT increase the (coil) current, it simply reduces the load on the drive circuit. To "maintain" the current magnitude, the voltage across the coil must be increased, which can be achieved by using a "Series Tuned Circuit": This can generate an enormous voltage (at the junction of the C and L), so you must ensure that the capacitor is adequately rated (e.g. 1 kV at the desired frequency). But beware that at "Low frequencies" the capacitor dominates, so it becomes simply an "Open Circuit Load".

Cheers, Alan.
 

hippy

Technical Support
Staff member
As I alluded to in post 14, your power (current?) meters are probably accurate in showing a lower current at higher frequencies. Using another method, whether PicAxe or something else will likely show similar results.
That would also be my gut feeling. If resistance-or-reactance increases at frequency extremes then less current will be drawn through the load and this will be reflected everywhere else.
 

Gramps

Senior Member
You haven't indicated the purpose of the "coils" nor even if they are optimised to maximise or minismise their inductance (and/or the magnetic field that they produce
It's time to fess up. No we are not transmitting energy but we are developing a PEMF therapy bed.
An internet search shows:
Many studies suggest that PEMF therapy does work, although further medical research will help establish the long-term effects and how it may benefit an individual's quality of life. A person may not experience results until they have used the device for some time.
The only contraindications are for those individuals with
pacemakers, insulin pumps, or other elect of turical implants, and pregnancy.
(Note:The same precautions taken with MRI machines )
Documented usages include anxiety control pain management, and knitting bones.
The air coils are 12 inches in diameter and consists of 38 turns of # 18 wire.
The frequency range that we're working with right now and trying to display is between 40 and 1200 Hertz.
 

AllyCat

Senior Member
Hi,

This is a good example of where a few calculations can indicate what is "possible" and what isn't. IMHO there is no point in attempting to use anything except sine waves (at least at the higher frequencies). There are numerous internet "air-cored inductor" (coils) calculators, such as THIS which all appear to indicate that the inductance of one of those coils is around 0.9 mH (assume that the "length" is the number of turns * the wire diameter).

At F = 1kHz, the impedance should be = 2 * PI * F * L = 6k3 * 0.0009 = 5.6 ohms. Thus, if the d.c. resistance is 0.9 ohms (which will dominate at around 50 Hz), then for the same voltage amplitude at 1kHz, the current will be reduced to 0.9 / 5.6 , or about 16%. Therefore, if you want a "constant current" (and corresponding magnetic field) over that frequency range, then you must start at 50Hz with no more than about 15% of the available peak-peak voltage (or current) amplitude, and then increase the volatge amplitude as the frequency rises up to around 1 kHz.

Next, the way that you configure the coils could make enormous differences. If they were stacked together to form a coil with 4 times more turns, then the inductance increases by the square of 4, i.e. to 16 times, so the impedance increases enormously and the current must fall correspondingly. Conversely, if two of those coils were wound/connected in the opposite direction then the inductance will be greatly reduced, but the magnetic fields (which you're presumably attempting to maximise) will "cancel out". :(

Similarly, the behaviour of the coils that you've shown in the photo will depend on how they are connected in series. If they are all wound/connected in the same direction, then their inductance probably won't rise enormously, but their magnetic field won't be very strong either. If two are wound/connected in an opposite direction to the other two, then the magnetic field lines will pass through both coils, increasing their magnetic strength (nearby), but also their inductance. For a maximum field strength, the coils should probably be wound in the same direction, but mounted with the "body" between them.

If you want to maximise the current at one specific (sinusoidal) frequency, then perhaps a (series) tuned circuit can be used. The ratio of impedance (5.6 ohms) to d.c. resistance (0.9 ohms) suggests that a reasonable "Q" (quality) Factor might be achieved. For resonance, the impedance of the Inductor (i.e. X = 2*Pi*F*L) should equal that of the capacitor i.e. 1 / (2*Pi*F*C) , or C = 1 / (2*Pi*F*X). At 1 kHz, I calculate that to be 1 / (6.3k*5.6) = ~30 uF, but bear in mind that the capacitor needs to be Bi-Polar (i.e. reversible) and rated to hundreds of volts (and ideally with low resistive losses). For initial trials, you might try two high voltage 47uF electrolytics in (reverse) series, each shunted by a diode to protect against reverse voltage. That might resonate with one of your coils at about 1 kHz.

Cheers, Alan.
 

Gramps

Senior Member
there is no point in attempting to use anything except sine waves (at least at the higher frequencies).
Alan, not sure what you mean, we just cannot measure square waves this way?
And by high frequency do you mean more then 1200 hurtz?
 

AllyCat

Senior Member
Hi,

Personally, I don't believe the higher harmonics of a square wave (see my "Fourier" description above) will get through the system at a worthwhile amplitude, so you may as well Keep It Simple by using Sine waves (probably at anything above a few hundred Hertz).

No, I meant the "L" dimension of the solenoid coils shown in the calculators, perhaps better considered as the coil "width" or "thickness" of your particular coil geometry.

Cheers, Alan.
 

Gramps

Senior Member
The coils are wound on a plastic hoop cut from the top of a bucket. Approximately 1 inch wide, 19 turns, x 2 layers.
 

rq3

Senior Member
The coils are wound on a plastic hoop cut from the top of a bucket. Approximately 1 inch wide, 19 turns, x 2 layers.
Ahh. Helmholtz coils. No wonder you're having issues. Seriously, you shouldn't have any problem measuring current and voltage into and across these very low inductance coils. At 1200 Hertz you can basically just consider them to be pure resistors, unless you really want to start splitting hairs. Personally I'd use the largest gauge wire possible, rather than 18 gauge, as that won't have any appreciable affect on the field strength, and takes the wire resistance pretty much out of the equation.

You're basically asking the Picaxe to measure the voltage across the coil terminals, and the current being drawn, for a 1200 Hertz sinusoidal or square waveform. Mathmatically they are essentially identical at 1200 Hertz. Unless the frequency is changing rapidly, a simple RC filter, droppng resistor, and two ADC readings should get what you want from any Picaxe.
 
Last edited:
Top