Author Topic: What you do with math channels on oscilloscope?  (Read 13925 times)

0 Members and 1 Guest are viewing this topic.

Offline MrWolf

  • Regular Contributor
  • *
  • !
  • Posts: 209
  • Country: ee
What you do with math channels on oscilloscope?
« on: January 04, 2017, 04:34:54 pm »
Many modern scopes have math features and people seem to like when it's in the datasheet. But how you use them besides most obvious AxB and integral(AxB) fo power calculations? Could you post these please? I'm learning RF currently and math channels get more and more used, mostly have to "invent" the stuff because "out of the box" info on the net is pretty scarce on the subject...
Recently played a bit with differential function and finally understood what it's useful for   :o Why the hell they dont teach it interactively in the school  |O
 

Online daqq

  • Super Contributor
  • ***
  • Posts: 1880
  • Country: sk
    • My site
Re: What you do with math channels on oscilloscope?
« Reply #1 on: January 04, 2017, 05:31:44 pm »
Well, there's the FFT, I've also used the subtraction, when I needed to know the voltage on the part when I could not ground the probes against one end of the part and connect it to the other end - basically I used it as a poor mans' differential probe. I did this for both a power signal and a differential high-ish speed signal.

Then there's the divide function, when you need to check for instance the ratio of an amplified signal... There's a lot of functions that can be checked like this.
« Last Edit: January 04, 2017, 05:33:49 pm by daqq »
Believe it or not, pointy haired people do exist!
+++Divide By Cucumber Error. Please Reinstall Universe And Reboot +++
 

Offline Amazing

  • Regular Contributor
  • *
  • Posts: 59
  • Country: us
Re: What you do with math channels on oscilloscope?
« Reply #2 on: January 04, 2017, 05:42:52 pm »
You can use A-B to view a differential signal if you lack a differential probe.

You can use differentiation followed by FFT to show the scope's frequency response curve.  I took a crack at that here:

https://www.eevblog.com/forum/testgear/what-is-a-good-and-cheap-way-to-do-frequency-response-testing-on-a-scope/

You can use averaging on a waveform to get a cleaner picture of it, or use averaging on an FFT to try to pull signals out of the noise.

 

Offline MrWolf

  • Regular Contributor
  • *
  • !
  • Posts: 209
  • Country: ee
Re: What you do with math channels on oscilloscope?
« Reply #3 on: January 04, 2017, 08:52:35 pm »
Here's neat trick that I use lately... It's quite painful to watch all those unused (and paid for!) MSO digital wires dangling around. I do not ever remember using more than 8 at the time for debugging. But I often miss at least one more analog channel. So it struck me I can do software DAC. Up to 16bit! Also it happends that my scope is only 25MHz analog but 100MHz & 200MSa/s digital!  >:D

So here it is - PicoScope 2205 MSO doing software analog to digital to analog using math channel


12bit ADAC using Arduino Due as 7MSa/s pattern generator producing 12x12bit sine wave.
Math formula: LowPass((2048*D11+1024*D10+512*D9+256*D8+128*D7+64*D6+32*D5 +16*D4+8*D3+4*D2+2*D1+ 1*D0)/4096, 100000)-0.5




8bit ADAC using Arduino Uno R3 as voltmeter listening to PSU voltage with analog pin & resistive voltage divider:
Math formula: LowPass((128*D7+64*D6+32*D5 +16*D4+8*D3+4*D2+2*D1+ 1*D0)/256, 100000)*14.7
Last number is tweaked according to voltage divider (Do not exceed Arduino 5V input!)




Here is test setup connected to Arduino Uno and Agilent UT1272A as control:



Most cool thing that there is no noise which is often present on just analog channel. And I can rig it up to form even 2 additional 8bit analog channels. Sadly I have no pattern generator or ADC fast enough to see if it will really push to 100MHz & 16bit analog.

Currently I use 100kHz LowPass to remove random peak glitches. When pushing for speed records this should be removed or reset to higher frequency.

If there is time skew due to Arduino processing time you can create time-skewed copies of real analog channels using formula X[T], for example A[-0.000001] should delay analog by 1 microsecond. Least possible step is 1ns AFAIK.

Arduino sketches attached for both scenarios.
New faster 59kSa/s sketch for Arduino Uno

Just wondering - do you know is this done before? DAC formula is no headline news but using with MSO?
« Last Edit: January 05, 2017, 08:04:09 pm by MrWolf »
 
The following users thanked this post: saturation, Relaxe

Offline HighVoltage

  • Super Contributor
  • ***
  • Posts: 4524
  • Country: de
Re: What you do with math channels on oscilloscope?
« Reply #4 on: January 04, 2017, 08:57:34 pm »
Here is a simple example that I am using all the time.

Channel 1: Voltage
Channel 2: Current
Math 1: Channel 1 * Channel 2 = POWER (Watt)
Math 2: INTEGRATING POWER = ENERGY (Joules)


There are 3 kinds of people in this world, those who can count and those who can not.
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 7686
  • Country: us
Re: What you do with math channels on oscilloscope?
« Reply #5 on: January 04, 2017, 09:27:33 pm »
Here is a simple example that I am using all the time.

Channel 1: Voltage
Channel 2: Current
Math 1: Channel 1 * Channel 2 = POWER (Watt)
Math 2: INTEGRATING POWER = ENERGY (Joules)

I have never tried measuring power or energy.  I am curious about the integral.  Is it increasing only?  As in Watt-Hours accumulated?  Or is it a true integral that rolls back when P(t) < P(t-1)?
« Last Edit: January 04, 2017, 09:34:40 pm by rstofer »
 

Offline Amazing

  • Regular Contributor
  • *
  • Posts: 59
  • Country: us
Re: What you do with math channels on oscilloscope?
« Reply #6 on: January 04, 2017, 10:09:55 pm »
Or is it a true integral that rolls back when P(t) < P(t-1)?

I also have never used the integral function and was curious about it as well, so I tried it on my scope.

When P(t) < P(t-1) the integral keeps increasing, which is what I would expect because the area under the curve is still accumulating.

When P(t) goes negative, then the integral begins to decrease.

So the integral of sin wave is another sin wave, shifted 90 degrees.  Or put another way, the integral of sin(t) dt = -cos(t), just like in calculus class.
« Last Edit: January 04, 2017, 10:15:46 pm by Amazing »
 

Offline Amazing

  • Regular Contributor
  • *
  • Posts: 59
  • Country: us
Re: What you do with math channels on oscilloscope?
« Reply #7 on: January 04, 2017, 10:13:01 pm »
MrWolf,

that is a very neat trick for getting the most out of your scope.  I had no idea that the pico scopes supported such complex math.  I guess it makes sense since they have all the processing of a PC available to them.

Some standalone scopes let you do this too, by defining a parallel bus on the digital channels, and then plotting the value of the bus.
« Last Edit: January 04, 2017, 10:16:30 pm by Amazing »
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 20134
  • Country: nl
    • NCT Developments
Re: What you do with math channels on oscilloscope?
« Reply #8 on: January 04, 2017, 10:21:18 pm »
Here is a simple example that I am using all the time.

Channel 1: Voltage
Channel 2: Current
Math 1: Channel 1 * Channel 2 = POWER (Watt)
Math 2: INTEGRATING POWER = ENERGY (Joules)

I have never tried measuring power or energy.  I am curious about the integral.  Is it increasing only?  As in Watt-Hours accumulated?  Or is it a true integral that rolls back when P(t) < P(t-1)?
Measuring power can be handy to see if a transistor or MOSFETs stays within safe limits during switching or a pulsed event. The V*I math trace will show where and how long peak power occurs. The duration, current and voltage of the peak power event can then be checked with the SOA graph.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline MrWolf

  • Regular Contributor
  • *
  • !
  • Posts: 209
  • Country: ee
Re: What you do with math channels on oscilloscope?
« Reply #9 on: January 04, 2017, 10:27:25 pm »
that is a very neat trick for getting the most out of your scope.  I had no idea that the pico scopes supported such complex math.

Thanks :) This is just scratching the surface... It's actually quite addictive to mess around with it. I'm working on something a bit more complex but this is too raw to publish yet.

One more useful example (found from PicoTech forum):

acos(integral(A*B)/(sqrt(integral(A*A))*sqrt(integral(B*B))))/pi*180

This is phase between channels A and B using integration. Have not yet used it on unequal shape and form waves. So apply at your own risk.
 

Offline NorthGuy

  • Super Contributor
  • ***
  • Posts: 2150
  • Country: ca
Re: What you do with math channels on oscilloscope?
« Reply #10 on: January 04, 2017, 10:54:11 pm »
acos(integral(A*B)/(sqrt(integral(A*A))*sqrt(integral(B*B))))/pi*180

It's correlation formula. Will only show phase if the shape is exactly the same (except phase shift). For in-phase signals, it'll measure the similarity between waveforms (if you remove "acos" and scaling). It'll be "1" if the signals are completely the same (ignoring scale) and "0" if they're completely dissimilar. "-1" will mean the same sinal, but inverted. You can use the formula to measure how similar is your waveform to the sine wave (or any other signal you may want to use as an etalon).
 
The following users thanked this post: MrWolf

Offline mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 12255
  • Country: gb
    • Mike's Electric Stuff
Re: What you do with math channels on oscilloscope?
« Reply #11 on: January 05, 2017, 12:21:54 am »
Integral can be useful for estimating total battery draw from a device that draws a complex current waveform due to frequently changing modes etc.
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 
The following users thanked this post: bitseeker

Offline JPortici

  • Super Contributor
  • ***
  • Posts: 2690
  • Country: it
Re: What you do with math channels on oscilloscope?
« Reply #12 on: January 05, 2017, 05:20:19 am »
what i wish i could do in every scope was math with measurements. sometimes i'm too lazy to get out the pocket calculator and i can't always come up with a math channel then measurement on it
(for example, things like freq A - freq B)
some i've used can, some i've used can't. don't know about mid-high tier
 

Offline vealmike

  • Regular Contributor
  • *
  • Posts: 192
  • Country: gb
Re: What you do with math channels on oscilloscope?
« Reply #13 on: January 05, 2017, 10:45:16 am »
'scope math is really powerful if you know what you're doing. A complicated example of what can be achieved...

Take eye diagram, 'scope will emulate a PLL and extract a golden clock.)
Then, from the eye diagram, plot Time interval error (time difference between each received transition and the golden clock.)
Then take an FFT of the TIE, to show the frequency content of the jitter.
Then take an average of the FFT (recapture, recalculate, average) to eliminate random jitter and pull out the deterministic jitter.

Then from the average FFT (plot of Dj frequency content) go find the peaks, correlate with noise sources on your PCB and apply remedies as necessary.
 

Offline MrWolf

  • Regular Contributor
  • *
  • !
  • Posts: 209
  • Country: ee
Re: What you do with math channels on oscilloscope?
« Reply #14 on: January 05, 2017, 10:58:35 am »
Here's another one. So far used it just for learning but suspect might be useful tool:

Generating harmonics on-the-fly on math channel using time as X input, then combining with some actual wave, replaying on AWG if needed.

Example:
10kHz sine on CH A
Harmonics generation: sin(T*PI*40000)*0.501 + sin(T*PI*60000)*0.355 + sin(T*PI*80000)*0.251
Combined with A: A + (sin(T*PI*40000)*0.501 + sin(T*PI*60000)*0.355 + sin(T*PI*80000)*0.251)
Constants scale horizontal and vertical to match with signal to be combined with.
 

Offline MrWolf

  • Regular Contributor
  • *
  • !
  • Posts: 209
  • Country: ee
Re: What you do with math channels on oscilloscope?
« Reply #15 on: January 05, 2017, 08:17:19 pm »
Got Arduino Uno ADAC sketch little faster, was 9kSa/s => 59kSa/s. Almost good setting for filter is 25kHz*. Full horizontal resolution <=230Hz. Good sine max 5900Hz. Processing delay 21us. Tested direct input w/o voltage divider for frequency response. Note this is all limited by Arduino Uno, not scope.
*Filter could be better I guess, maybe even multi-stage.

« Last Edit: January 05, 2017, 09:50:21 pm by MrWolf »
 

Offline Iceberg86300

  • Contributor
  • Posts: 27
Re: What you do with math channels on oscilloscope?
« Reply #16 on: January 05, 2017, 10:33:29 pm »
There is also a use in the mechanical world. Non contact transducers perpendicular to each other and placed at a rotating shaft.

One channel per transducer, and plot them against each other. This will show deflection of the shaft as it rotates. You end up with an ellipse/circle, and then using math functions you can determine where the where the heavy spot is (displacement is not in phase with the heavy spot and max displacement lags 90° behind the driving force of the heavy spot).

Based on some knowns of the system and the waveform observed on the scope, you can calculate how much weight needs to be added, as well as where it needs to be added.

This was one of the labs included in the lab portion of an intermediate vibrations class at Cal Poly as part of my mech engineering coursework.


While this is rather rudimentary, the labs are designed to ensure that you grasp the material as well as give you some real world experience ("Learn by Doing" is Cal Poly's motto).

This particular lab exposed students to something they might do to during the process of product development.

A perfect example of how this theory translates into a final product is a wheel balancing machine. In case you've never seen one here is a description: mount the wheel on the machines spindle, the machine spins it up to a very low rpm (relative to the RPM a wheel would see at highway speeds), Then the machine tells the operator to turn the wheel to a certain position and then add a specific amount of weight at that position. (And most likely different weights at other positions.

Pretty cool tech that started life with a very simple setup and o scope.

Sorry if this is a bit off topic, but wanted to show that oscilloscopes play a rather large role outside of pure electronics.

Sent from my SM-G900V using Tapatalk

 

Offline Circlotron

  • Super Contributor
  • ***
  • Posts: 2125
  • Country: au
Re: What you do with math channels on oscilloscope?
« Reply #17 on: January 06, 2017, 12:36:21 am »
My area is car engine ignition systems.
Connect an ignition coil output to 1500v worth of Zeners and 2kV reverse blocking diode. Measure int(volts*amps) and read the results in millijoules. One particular aftermarket capacitor discharge ignition manufacturer claims 100mJ spark energy and indeed their box does put out that much. What they don't tell you is that the energy in the coil leakage reactance that is subsequently recycled back into the 12vdc supply, and the huge losses in the recommended ignition coil, of the 100mJ presented to the primary only 38mJ comes out the secondary side. With a non-optimum coil it can be as low as 25mJ. A good modern inductive ignition measures as high as 100mJ. The CDI secondary voltage rise times are typically 10uS, nothing like the 1uS often claimed.
 

Offline saturation

  • Super Contributor
  • ***
  • Posts: 4788
  • Country: us
  • Doveryai, no proveryai
    • NIST
Re: What you do with math channels on oscilloscope?
« Reply #18 on: January 16, 2017, 12:02:59 pm »
Its more a timesaver, which is the only resource you can't get back, time.  Some calculations can be too involved and making an rough estimate is expedient, such as power calculations, but with scope functions, you needn't estimate.  But, IMHO regardless of which function you use, if you buy a DSO with math functions specified in the spec sheet, it should perform these math functions as expected, naturally within the specified accuracy stated on the spec sheet.


what i wish i could do in every scope was math with measurements. sometimes i'm too lazy to get out the pocket calculator and i can't always come up with a math channel then measurement on it
(for example, things like freq A - freq B)
some i've used can, some i've used can't. don't know about mid-high tier
« Last Edit: January 16, 2017, 08:54:32 pm by saturation »
Best Wishes,

 Saturation
 

Online EEVblog

  • Administrator
  • *****
  • Posts: 32175
  • Country: au
    • EEVblog
Re: What you do with math channels on oscilloscope?
« Reply #19 on: January 16, 2017, 01:43:06 pm »
 
The following users thanked this post: saturation, electrolust, Vtile

Offline MrW0lf

  • Frequent Contributor
  • **
  • Posts: 921
  • Country: ee
    • lab!fyi
Re: What you do with math channels on oscilloscope?
« Reply #20 on: February 07, 2017, 10:13:48 am »
Managed to substantially improve Arduino / PicoScope MSO ADAC scripts & pattern generators and ironed out little bugs with formulas. Guess could call it "finished product" now. Cannot modify/fix old posts ;) so have to upload here:

Arduino Uno ADAC listening to signal gen @ 59kSa/s

Arduino_Uno__ADC__59kSa.zip
LowPass((128*D7+64*D6+32*D5+16*D4+8*D3+4*D2+2*D1+1*D0)/256/0.996,15000)*4.8

Arduino Uno 2398Hz 8x8bit sine pattern

Arduino_Uno__ADC__8x8bit_2398Hz_sine_pattern.zip
LowPass((128*D7+64*D6+32*D5+16*D4+8*D3+4*D2+2*D1+1*D0)/256/0.996,15000)-0.5

Arduino Due ADAC listening to signal gen @ 687kSa/s, non-time-skewed CH2 for comparison

Arduino_Due__ADC__687kSa.zip
LowPass((2048*D11+1024*D10+512*D9+256*D8+128*D7+64*D6+32*D5+16*D4+8*D3+4*D2+2*D1+1*D0)/4096/0.9998,175000)*3.33

Arduino Due 1456Hz 12x12bit sine pattern

Arduino_Due__ADC__12x12bit_1465Hz_sine_pattern.zip
LowPass((2048*D11+1024*D10+512*D9+256*D8+128*D7+64*D6+32*D5+16*D4+8*D3+4*D2+2*D1+1*D0)/4096/0.9998,175000)-0.5

Note that formulas are not optimized (...4096/0.9998... etc), this to give clear picture what does what. Voltage divider not used.
« Last Edit: July 16, 2017, 05:20:15 pm by MrW0lf »
 
The following users thanked this post: hammy, Vtile

Offline MrW0lf

  • Frequent Contributor
  • **
  • Posts: 921
  • Country: ee
    • lab!fyi
Re: What you do with math channels on oscilloscope?
« Reply #21 on: September 28, 2018, 09:46:54 am »
I tried to help someone over at Pico forum with some math stuff that ended up with creating excessive test environment :P Thought share it here also maybe useful to someone. Subject is taking apart this formula:

acos(integral(A*B)/(sqrt(integral(A^2))*sqrt(integral(B^2))))/Pi*180

Which does give phase shift between two signals with matching wfm shape. On closer inspection it turned out to be based on calculation of power.

Interesting quote from wiki:
Quote
As described above, the term average power refers to the average value of the instantaneous power waveform over time. As this is typically derived from the root mean square (RMS) of the sine wave voltage,[6] it is often referred to as "RMS power" or "watts RMS", but this is incorrect: it is not the RMS value of the power waveform (which would be a larger, but meaningless, number).[7][8][9][10] (The erroneous term "watts RMS" is actually used in CE regulations.[11])

Screenshot of test setup, saved env attached:



Input signal:
115V AC RMS
180mA AC RMS

Current lagging by 45°

On the left screen screen measurements are taken by built-in measurements except phase which is my own formula:

((((atan(1/tan(pi*(A/10000)))/pi)+(A/10000))*-((atan(1/tan(pi*(B/10000)))/pi)+(B/10000)))+0.25)/0.002777777

...which converts phase to PWM that will give better reading than discussed formula when averaged (incl. on subsampled signals).

On the middle screen:

TRMS(A) = sqrt(integral(A^2)/T)
TRMS(B) = sqrt(integral(B^2)/T)
P(A*B) = integral(A*B)/T
MAX(P(A*B))) = sqrt(integral(A^2))*sqrt(integral(B^2)))/T
oldPhase(A,B) = acos(integral(A*B)/(sqrt(integral(A^2))*sqrt(integral(B^2))))/Pi*180


On the right screen some inner components are visualized and formulas written on screenshot.

Now inner workings of formula are exposed and can see it is based on dividing current instantaneous power with maximum possible instantaneous power (zero phase shift) and converting reading to degrees at each sample point.

For reference, since example is with sines then sanity check:

115*0.18*cos(45*Pi/180)=14.64W
115*0.18=20.7W
acos(14.64/20.7)/Pi*180=45°


Edit, sanity check 2 with WolframAlpha:

integrate (115*sin(x)) * (0.18*sin(x-45pi/180)) * (2/pi); 0 to pi


integrate (115*sin(x)) * (0.18*sin(x)) * (2/pi); 0 to pi


Such hands-on visualizations with physical setups involved have helped myself also a lot to get back on track with math I mostly ignored in school (largely due to math teacher nice (.)(.) of course).
« Last Edit: September 28, 2018, 10:11:08 am by MrW0lf »
 

Offline macboy

  • Super Contributor
  • ***
  • Posts: 2022
  • Country: ca
Re: What you do with math channels on oscilloscope?
« Reply #22 on: September 28, 2018, 07:02:30 pm »
If you have access to a very fast-rise step (square wave) generator then you can almost instantaneously measure the frequency response of the scope from DC to its bandwidth limit. You can do the same for any device under test between the step generator and the scope (a filter, etc).

This requires measuring the step, averaging that to remove noise, taking the derivative of the average, and finally taking the FFT of that derivative.

In the following, trace C is the frequency response of the scope.


Refer to my older post for more details.
 
The following users thanked this post: electrolust

Offline schmitt trigger

  • Super Contributor
  • ***
  • Posts: 1805
  • Country: mx
Re: What you do with math channels on oscilloscope?
« Reply #23 on: September 28, 2018, 07:34:41 pm »
View transformer's hysteresis curves. I actually published this trick back in 2001 in Electronics World.
 

Offline bson

  • Supporter
  • ****
  • Posts: 1766
  • Country: us
Re: What you do with math channels on oscilloscope?
« Reply #24 on: September 29, 2018, 12:21:50 am »
If you have access to a very fast-rise step (square wave) generator then you can almost instantaneously measure the frequency response of the scope from DC to its bandwidth limit. You can do the same for any device under test between the step generator and the scope (a filter, etc).

This requires measuring the step, averaging that to remove noise, taking the derivative of the average, and finally taking the FFT of that derivative.

In the following, trace C is the frequency response of the scope.


Refer to my older post for more details.
That's really nice!

And, of course, not just the scope... you could use that technique to measure eyeball the frequency response of any DUT.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf