cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Craige_Hales
Super User
New Project Data Points

The clock project finished up a year ago. This is the start of a new project, which might turn into some sort of power monitor.

 

Here's a picture of two waveforms on an old-school scope from ~1990.

Sine wave is volts, pulse is ampsSine wave is volts, pulse is amps

 

If the units and scales are right, the integration of volts * amps is the real power being used by the load. I did that, eye-balling it, and got 47 watts. That was a little disappointing because this is the device under test.

 

30W CFL bulb30W CFL bulb

 

If that was an incandescent bulb, the volts and amps would be very similar waveforms, neatly aligned. But most of today's electronics demand power during a fraction of a voltage cycle.

View more...
My notes

current: peak is 85 mv on 30 ohms. e/r=i, .085/30 = .0028 amp
x500 -> 1.4Amp
That max current is when Volts = 4, current ramps to zero as volts ramps to 6.
The volts are actually (xformer ratio 230/8.6 no load) x26.75, so 4*26.75 = 107V to 6*26.75 = 160.5V 
the ramp is about 1/4 of the cycle.
treat the sine wave as a linear ramp too.
begin of ramp is .0028A * 107V
end of ramp is 0.0A * 160V
average is 1.4A * 133.5V = 186.9 volt-amps (watts)
but only 25% duty cycle
187/4 = 47W​
All of those numbers are estimates, off the screen, or off of data sheets. Some will change, below.

Here's the JSL I used to digitize some points. The data arrays were not filled in initially; those are my answers. This is single-use code; I took a short cut and made the first and last point have special meanings, further below.

View more...
img = New Image( "z:/scope.jpg" );
img << rotate( 1 );
{nx, ny} = img << size;
New Window( "", gb = Graph Box( framesize( 900, 600 ) ) );
volts=[ 24.6814218645205 25, 39.4366197183099 58.0851063829787, 42.186452045607
        65.531914893617, 44.1985244802146 69.3617021276596, 46.2776659959759
        72.6595744680851, 48.692152917505 73.2978723404255, 51.5090543259557
        72.6595744680851, 56.8075117370892 61.3829787234043, 74.6478873239437
        25.8510638297872];
amps=[  42.713423397528 50.5777501131734, 43.1254191817572 62.5531914893617,
        43.7865286959854 59.4881167949298, 45.0384848775191 58.3055681303757,
        45.8433138513621 55.4454504300589, 46.8908690236658 53.6853779990946,
        48.4238765928907 51.1827750113173, 50.1229599821149 50.7702580353101,
        51.7102615694165 50];
gb[framebox(1)]<<addgraphicsscript(
    handle(volts[1,1],volts[1,2],volts[1,1]=x;volts[1,2]=y);
    handle(volts[2,1],volts[2,2],volts[2,1]=x;volts[2,2]=y);
    handle(volts[3,1],volts[3,2],volts[3,1]=x;volts[3,2]=y);
    handle(volts[4,1],volts[4,2],volts[4,1]=x;volts[4,2]=y);
    handle(volts[5,1],volts[5,2],volts[5,1]=x;volts[5,2]=y);
    handle(volts[6,1],volts[6,2],volts[6,1]=x;volts[6,2]=y);
    handle(volts[7,1],volts[7,2],volts[7,1]=x;volts[7,2]=y);
    handle(volts[8,1],volts[8,2],volts[8,1]=x;volts[8,2]=y);
    handle(volts[9,1],volts[9,2],volts[9,1]=x;volts[9,2]=y);

    handle(amps[1,1],amps[1,2],amps[1,1]=x;amps[1,2]=y);
    handle(amps[2,1],amps[2,2],amps[2,1]=x;amps[2,2]=y);
    handle(amps[3,1],amps[3,2],amps[3,1]=x;amps[3,2]=y);
    handle(amps[4,1],amps[4,2],amps[4,1]=x;amps[4,2]=y);
    handle(amps[5,1],amps[5,2],amps[5,1]=x;amps[5,2]=y);
    handle(amps[6,1],amps[6,2],amps[6,1]=x;amps[6,2]=y);
    handle(amps[7,1],amps[7,2],amps[7,1]=x;amps[7,2]=y);
    handle(amps[8,1],amps[8,2],amps[8,1]=x;amps[8,2]=y);
    handle(amps[9,1],amps[9,2],amps[9,1]=x;amps[9,2]=y);
);

gb[framebox( 1 )] << addimage( image( img ), bounds( top( 90 ), Left( 10 ), bottom( 10 ), Right( 90 ) ) );
imgSeg = gb[framebox( 1 )] << FindSeg( PictSeg( 1 ) );
imgSeg << lock( 1 );

That one degree rotation makes the image x-y line up with the screen.

Scope traces as image in a JMP graph. The tiny black square boxes on the traces are the handles.Scope traces as image in a JMP graph. The tiny black square boxes on the traces are the handles.

After dragging the points into place, with the first and last voltage points defining a full cycle and the first and last current points defining the length of the pulse, I used this.

View more...

vmax = Max( volts[0, 2] ); // sine top
vmin = Min( volts[0, 2] ); // sine bottom
vrange = vmax - vmin; // sine range
amax = Max( amps[0, 2] ); // similar for pulse
amin = Min( amps[0, 2] );
arange = amax - amin;
minx = Min( volts[0, 1] ); // length of sine cycle
maxx = Max( volts[0, 1] ); // because point 1 and 9 at begin and end
pulselength = amps[9, 1] - amps[1, 1]; // length of 1 of 2 pulses
pulseduty = 2 * pulselength / (maxx - minx); // 2 pulses per cycle
dt = pulselength / 16384; // small dt improves answer
n = 0; // count the dt intervals
sum = 0;
For( t = amps[1, 1], t < amps[9, 1], t += dt, // step thru the pulse
    y = Interpolate( t, volts[0, 1], volts[0, 2] ); // get the volts
    v = 125 * 1.414 * (2 * (y - vmin) / vrange - 1); // map the volts
    y = Interpolate( t, amps[0, 1], amps[0, 2] ); // get the amps
    a = 1.4 * ((y - amin) / arange); // map the amps
    sum += a * v; // watts for this dt
    n += 1;
);
sum = sum / n;
sum = sum * pulseduty;
Show( sum );

to get

sum = 25.8513297218601;

 

It took a bit of rethinking; rather than use the transformer's poorly defined turns ratio and the scope's ancient calibration, I assumed my house voltage is 125V rms and used the 1.414 factor to get the peak-to-peak voltage the sine wave should match. That seems close enough. Now to make the ESP32 digitize the points directly...

 

Last Modified: Oct 31, 2022 7:49 PM
Comments