### Author Topic: EEVblog #662- How & Why to use Integration on an Oscilloscope  (Read 21185 times)

0 Members and 1 Guest are viewing this topic.

#### EEVblog

• Posts: 27666
• Country:
##### EEVblog #662- How & Why to use Integration on an Oscilloscope
« on: September 14, 2014, 08:44:33 am »
In this tutorial Dave demonstrates the seldom used and often little understood mathematical integration function available on your modern digital oscilloscope. And demonstrates a practical example use for it in accurately measuring the total power consumption of a microcontroller that sleeps and then wakes up and does some processing before shutting down again. By getting the total area under the current curve.

#### rs20

• Super Contributor
• Posts: 2075
• Country:
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #1 on: September 14, 2014, 09:27:48 am »
About the inaccurate measurement of sleep current by the integral function -- Putting on my pedantic hat; it might be more accurate to blame that error on offset, rather than noise. I only say that because noise is not a DC thing, some of those samples will be high, some will be low, it all cancels out -- that's one of the wonderful things about integration, it pulls the interesting low-frequency stuff out of the noise. What's left over, and what survives integration, is offset error. It would be interesting to short the input to the uCurrent to see what a true zero-current reading looks like, and to see if any real signal survived the quantization process (it wouldn't be too bad to use the zero-current integral as an offset null).?

[ Double-posted to the YouTube comments as well because I reflexively commented on YouTube for some daft reason. EEVBlog forum is where it's at! ]

#### miguelvp

• Super Contributor
• Posts: 5549
• Country:
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #2 on: September 14, 2014, 09:43:19 am »
Nice video, I take back that you are only doing mailbag and teardowns

Question, is the Area measurement the same thing?
At least on my Rigol it does seem to match:

Both the integral and the area shows 10.5mVs

And in here they both agree on 4.20mVs (well, close enough)

Edit: updated the images so that it shows VMax of the Math channel, but it doesn't show the scale in mVs just mV.
Also Dave covered this in the video, I guess I wasn't paying attention at that moment.
« Last Edit: September 14, 2014, 10:45:54 am by miguelvp »

#### Legit-Design

• Frequent Contributor
• Posts: 562
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #3 on: September 14, 2014, 09:49:07 am »
Sound is wrong on that video... also video looks yellowish, my guess that is the Sony camera.

#### EEVblog

• Posts: 27666
• Country:
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #4 on: September 14, 2014, 10:01:56 am »
Sound is wrong on that video... also video looks yellowish, my guess that is the Sony camera.

Canon HF G30.
I used the mid range boost function in the camera, designed for speech. Was an experiment.
Sounds good to me.
Re. the yellow, that's an oops, forgot to turn back on manual white balance after the trade show. That always happens.

#### miguelvp

• Super Contributor
• Posts: 5549
• Country:
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #5 on: September 14, 2014, 10:40:16 am »
Nevermind about the area measurement, you did cover it, I guess when I watch it I was distracted when you mentioned it

Edit: plus it's nice to be able to visualize it instead of just looking at a number.
« Last Edit: September 14, 2014, 11:31:46 am by miguelvp »

#### Prime73

• Regular Contributor
• Posts: 174
• Country:
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #6 on: September 14, 2014, 11:00:07 am »
Sound is wrong on that video... also video looks yellowish, my guess that is the Sony camera.
sounds good to me - no issues.

#### cosrologist

• Newbie
• Posts: 3
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #7 on: September 14, 2014, 11:06:52 am »
Dave,

You should be able to configure the CRO probe input to convert the voltage to a current, including using a conversion factor such as 1mV = 100uA, (which is the setting on the uCurrent) so that the display shows Amperes (or mA) and the integral is mA Seconds.   which is easier to read/do calcs with.

Cheers
Kym

#### plesa

• Frequent Contributor
• Posts: 964
• Country:
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #8 on: September 14, 2014, 11:08:39 am »
You can also adjust the units in probe menu from volts to amps and change the sensitivity according to transimpedance of your uCurrent.
But there are some limitations max 10V/A minimum 1mV/A. So it is useless for measurement with uCurrent.
« Last Edit: September 14, 2014, 11:13:07 am by plesa »

#### rs20

• Super Contributor
• Posts: 2075
• Country:
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #9 on: September 14, 2014, 11:28:36 am »
At 9:37, you say the average current is 12.1 uA according to the scope, but you have a 2 second period on your integral -- so 12.1 mVs / 2 s works out to 6.05 mV average --> 6.05 uA, much closer to reality! But since a little bit of offset error could swamp the reading, I agree with your overall conclusion that the number isn't reliable.
« Last Edit: September 14, 2014, 12:23:17 pm by rs20 »

#### dentaku

• Frequent Contributor
• Posts: 830
• Country:
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #10 on: September 14, 2014, 12:28:46 pm »
I've always known how integration is useful for me when modifying audio signals but this is the first time I've had a good explanation of what exactly integration is.
I see that if the yellow curve was to never settle back all the way down the purple one would just keep going up.

I can easily visualize why integrating a square wave gives you a triangle and integrating a triangle gives you a sine.

#### Wim_L

• Regular Contributor
• Posts: 209
• Country:
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #11 on: September 14, 2014, 01:47:34 pm »
About the inaccurate measurement of sleep current by the integral function -- Putting on my pedantic hat; it might be more accurate to blame that error on offset, rather than noise. I only say that because noise is not a DC thing, some of those samples will be high, some will be low, it all cancels out -- that's one of the wonderful things about integration, it pulls the interesting low-frequency stuff out of the noise. What's left over, and what survives integration, is offset error. It would be interesting to short the input to the uCurrent to see what a true zero-current reading looks like, and to see if any real signal survived the quantization process (it wouldn't be too bad to use the zero-current integral as an offset null).?

[ Double-posted to the YouTube comments as well because I reflexively commented on YouTube for some daft reason. EEVBlog forum is where it's at! ]

Indeed, noise doesn't matter, it's the offset between the average value and zero that will determine the deviation of the integral. That's also why integrals give nice curves even on noisy data: they're inherently averaging things together.

The opposite is true for differentiation, which amplifies noise. A typical high sample rate noise oscilloscope signal is likely to need a lot of averaging/low pass filtering, or the differentiated signal will be nothing but noise.

#### Dave

• Super Contributor
• Posts: 1148
• Country:
• I like to measure things.
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #12 on: September 14, 2014, 02:36:47 pm »
I am also going to put on my pedantic hat (implying that I ever take it off) and say that the measurement was incorrect.
You measured the charge of that current pulse to be 700nC over the period of 5ms.
Then you connected the multimeter to measure the sleep current. The numbers were jumping from 4.16µA to about 13µA. You then turned on averaging and ruined your whole measurement. The multimeter was averaging the sleep current as well as the spikes. The actual sleep current was about 4.16-4.17µA (these were the lowest values the multimeter was settling to).

So, your actual current consumption would be closer to:
(4.16µA*(2s-5ms)+700nC)/2s = 4.51µA

On a side note, please watch out for correct terminology. You shouldn't confuse energy and charge.
<fellbuendel> it's arduino, you're not supposed to know anything about what you're doing
<fellbuendel> if you knew, you wouldn't be using it

#### rs20

• Super Contributor
• Posts: 2075
• Country:
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #13 on: September 14, 2014, 02:44:17 pm »
I can easily visualize why integrating a square wave gives you a triangle and integrating a triangle gives you a sine.

OK, I'm just going to declare today rs20-has-pedantic-hat-day: Triangle integrates to something vaguely sine-ish, but not a true sine wave -- only a (co)sine wave integrates to give a sine wave. However, it's true that as you keep on integrating over and over again, you get closer and closer to a sine wave as you attenuate those harmonics more and more: square --> triangle --> vaguely sine-ish string of parabolas --> even more sine-ish string of cubics --> (infinity* steps later) --> sine --> sine --> sine

* Where infinity is defined as anything greater than, oh, I dunno, seven.

Indeed, noise doesn't matter, it's the offset between the average value and zero that will determine the deviation of the integral. That's also why integrals give nice curves even on noisy data: they're inherently averaging things together.

The opposite is true for differentiation, which amplifies noise. A typical high sample rate noise oscilloscope signal is likely to need a lot of averaging/low pass filtering, or the differentiated signal will be nothing but noise.

It does leave me wondering why scopes don't have more versatile low-pass filtering capability. For instance, when I'm using my uCurrent, I want my scope to have a bandwidth limit of 0.4 to 0.5 MHz, because I know anything above that isn't a valid signal from the uCurrent, therefore pure noise. Low-pass filtering also gives you more effective bits. But no, all I have are two options: 20 MHz and 100 MHz.  It can be done in software; loosely speaking it's averaging contiguous samples in each captured waveform (instead of averaging feature, which averages separate waveforms)... a dialable software bandwidth limit feature would be higher up my list than many other impressive but more contrived features offered by modern scopes.

#### zapta

• Super Contributor
• Posts: 6004
• Country:
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #14 on: September 14, 2014, 02:55:31 pm »
What is the nature of the noise near the horizontal line?  If it's random ac with zero DC average and if the integrator is signed then it should contribute zero charge to the integration.

Several months ago I faced a similar need, to measure the charge of single cell mobile devices. The current consumption fluctuates a lot over time, nothing clean as periodic like in this video. I ended up building a small OSH integrator based on LTC2943. It does continuous integration by a linear Coulomb counter (50mv burden voltage max scale, you provide the shunt) that triggers a digital charge counter. It was designed to have very low integration offset works great also with long term integrations (hours and days).  The integrator has a 1.3" OLED display and shows metrics such as average current (charge/time), number of software awakes (current is above a certain threshold), and a real time graph and also allows to log the data on a computer. So far I build 30 of them (3~5 at a time) giving to colleagues that ask.

One commercial charge integrator I am aware of is Monsoon Power Monitor https://www.msoon.com/LabEquipment/PowerMonitor/  it is fully controlled via a USB port and contains both a programable power supply and current integrator.
Drain the swamp.

#### Dongulus

• Regular Contributor
• Posts: 229
• Country:
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #15 on: September 14, 2014, 04:06:15 pm »
I've seen the famous quantization noise SNR equation for an ideal ADC. The equation assumes that the probability of the error in an ADC sample is equally distributed between +/- 1/2 LSB. I know that SAR ADCs the distribution for the quantization noise will be from 0 to -1 LSB because the logic in a SAR ADC will always produce a result that is less than what the analog input actually is. This would produce quantiztion noise with a constant offset of -1/2 LSB.

Does anyone know if the quantization noise distribution veers from the ideal for other types of ADCs?
Also, what kind of ADCs are typically found in oscilloscopes?

#### rs20

• Super Contributor
• Posts: 2075
• Country:
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #16 on: September 14, 2014, 05:22:15 pm »
I've seen the famous quantization noise SNR equation for an ideal ADC. The equation assumes that the probability of the error in an ADC sample is equally distributed between +/- 1/2 LSB. I know that SAR ADCs the distribution for the quantization noise will be from 0 to -1 LSB because the logic in a SAR ADC will always produce a result that is less than what the analog input actually is. This would produce quantiztion noise with a constant offset of -1/2 LSB.

Does anyone know if the quantization noise distribution veers from the ideal for other types of ADCs?
Also, what kind of ADCs are typically found in oscilloscopes?

A constant offset of -1/2 LSB with respect to what? None of this is relevant if the scope has a calibration procedure.

#### T3sl4co1l

• Super Contributor
• Posts: 12294
• Country:
• Expert, Analog Electronics, PCB Layout, EMC
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #17 on: September 14, 2014, 05:39:40 pm »
OK, I'm just going to declare today rs20-has-pedantic-hat-day: Triangle integrates to something vaguely sine-ish, but not a true sine wave -- only a (co)sine wave integrates to give a sine wave. However, it's true that as you keep on integrating over and over again, you get closer and closer to a sine wave as you attenuate those harmonics more and more: square --> triangle --> vaguely sine-ish string of parabolas --> even more sine-ish string of cubics --> (infinity* steps later) --> sine --> sine --> sine

* Where infinity is defined as anything greater than, oh, I dunno, seven.

This resonates with the Fourier transform, and with the Taylor series expansion of sin(x).  (Screw pedantism, he's bringing out the calculus?  Head for the hills!!)

The expansion is all even (cos) or odd (sin) powers of x from 1 or 2 to n, each with a leading coefficient of 1/n!.  This is a true representation of the function, but only as long as n --> infty.  There's no reason it has to work for small n, though as it turns out, sin/cos are suitable functions which approximate reasonably well.  So, the more powers you have, the more accurate the approximation.

Now, one nice thing about a Taylor series is, it's trivial to integrate -- it's just a polynomial, so you increment each exponent by one, and divide the constant.  The power goes up, and the approximation gets better (assuming you bring in new constant terms every time you hit +/- cos) because the series 'grows'.

The Fourier transform of a square wave (and its subsequent integrals) follows a similar pattern: the harmonics goes as 1/n^(p+1), where p is the number of integrations.  A square wave has harmonics that go as 1/n, so the 3rd has an amplitude of 1/3, and so on.  Triangle goes as 1/n^2, so the harmonics drop off more quickly.  Each time you integrate, it goes lower and lower, until after infinite passes, the harmonics completely disappear.

When it comes to circuits, if you're talking single frequency (not the variable output from a function generator), the harmonics can be attenuated with a filter.  An integrator is simply a -20dB/decade everywhere, so it's as good as a lowpass filter if the unity gain frequency is appropriately selected.  Practically speaking, the lowest harmonics are the hardest to treat, and you can get better performance with a filter that incorporates zeroes (like an elliptical) at strategic frequencies.

Indeed, noise doesn't matter, it's the offset between the average value and zero that will determine the deviation of the integral. That's also why integrals give nice curves even on noisy data: they're inherently averaging things together.

Arguably not: low frequency noise tends to go as 1/f, which looks like Brownian noise in the integral, and depending on your point of view and scale, manifests as low frequency rumble, uncertain offset, etc.

There's also the matter of quantization: on average, it's just noise -- but for a given situation, it may not be incoherent.  That is, if your 8 bit ADC is always reading the same numbers for each point on the waveform, averaging won't get you anything, because the noise is correlated with, and now inseparable from, the signal.  It actually pays to have a slightly noisy measurement (1-2 LSBs, say) when you're doing averaging (or oversampling).  BTW, note that averaging is the same as equivalent time sampling (with averaging), because it doesn't matter whether the acquisition was obtained in real time (bursts of a screen at a time) or here-and-there (delayed or random trigger per point).

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life? We can help.

#### miguelvp

• Super Contributor
• Posts: 5549
• Country:
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #18 on: September 14, 2014, 05:42:56 pm »
I can easily visualize why integrating a square wave gives you a triangle and integrating a triangle gives you a sine.

OK, I'm just going to declare today rs20-has-pedantic-hat-day: Triangle integrates to something vaguely sine-ish, but not a true sine wave -- only a (co)sine wave integrates to give a sine wave. However, it's true that as you keep on integrating over and over again, you get closer and closer to a sine wave as you attenuate those harmonics more and more: square --> triangle --> vaguely sine-ish string of parabolas --> even more sine-ish string of cubics --> (infinity* steps later) --> sine --> sine --> sine

* Where infinity is defined as anything greater than, oh, I dunno, seven.

Since I'm using the 1KHz 3V test signal I did try to make a triangle wave with Intg(CH1)-Intg(3-CH1) that gives me a triangle wave.

But if I integrate that I do not get a sine wave.

Further I did try Intg(Intg(Intg(CH1)-Intg(3-CH1))) and I get 2 quadrants of a sine wave on 16 square wave cycles then it does a parabola down to minus infinity.

Edit: here is what it shows:

I'm just wondering what should I input in the math function to actually get a sine wave from a square wave (not using the sine cosine and tangent operators of course).

Edit: If I differentiate the result with  Diff(Intg(CH1)-Intg(3-CH1)) I do get the square wave back as expected.
« Last Edit: September 14, 2014, 05:53:48 pm by miguelvp »

#### bktemp

• Super Contributor
• Posts: 1623
• Country:
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #19 on: September 14, 2014, 05:47:40 pm »
Sorry but I don't get it. What is the advantage of using a scope to measure the avarage current consumption? Would it not be much easier and more accurate to simply add a low pass filter after the uCurrent and measure the avaraged voltage with a DMM?

#### Bored@Work

• Super Contributor
• Posts: 3932
• Country:
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #20 on: September 14, 2014, 06:25:53 pm »
I used the mid range boost function in the camera, designed for speech. Was an experiment.
Sounds good to me.

There was a kind of "bump" in the sound quality in the middle of the video.
I delete PMs unread. If you have something to say, say it in public.
For all else: Profile->[Modify Profile]Buddies/Ignore List->Edit Ignore List

#### Dave

• Super Contributor
• Posts: 1148
• Country:
• I like to measure things.
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #21 on: September 14, 2014, 08:47:06 pm »
Sorry but I don't get it. What is the advantage of using a scope to measure the avarage current consumption? Would it not be much easier and more accurate to simply add a low pass filter after the uCurrent and measure the avaraged voltage with a DMM?
You would need a really low frequency filter, therefore huge inductance, resistance and capacitance. Capacitor leakage would kill the accuracy.

It might not be a bad idea to use a low pass filter in combination with a fast multimeter. The filter would stretch the pulse enough for a meter like 34401A to sample it at 1000/s or so. Slap the acquired data into Matlab and presto.
<fellbuendel> it's arduino, you're not supposed to know anything about what you're doing
<fellbuendel> if you knew, you wouldn't be using it

#### T3sl4co1l

• Super Contributor
• Posts: 12294
• Country:
• Expert, Analog Electronics, PCB Layout, EMC
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #22 on: September 14, 2014, 09:50:50 pm »
Sorry but I don't get it. What is the advantage of using a scope to measure the avarage current consumption? Would it not be much easier and more accurate to simply add a low pass filter after the uCurrent and measure the avaraged voltage with a DMM?
You would need a really low frequency filter, therefore huge inductance, resistance and capacitance. Capacitor leakage would kill the accuracy.

It might not be a bad idea to use a low pass filter in combination with a fast multimeter. The filter would stretch the pulse enough for a meter like 34401A to sample it at 1000/s or so. Slap the acquired data into Matlab and presto.

If you're only looking for DC, any standard integrating DMM will do (i.e., not the \$3 cheapshit yellow box kind).

Even if your meter responds poorly to AC (sample-and-hold type), a moderate R and sufficiently large C (larger than might be used for line frequency filtering, but no need for sheer farads) will get the cutoff frequency down in the Hz where absolutely any measurement device will do the job.

If you want to know the peaks and pulse widths, you have little choice but to graph or sample it.  Measuring the peaks quantitatively is best done with an integral as shown here -- the widths, heights and shapes may be deformed, but the integral over that range must be consistent.  This is used in many physical analyses, such as MS, NMR, XRD, nuclear spectroscopy and so on.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life? We can help.

#### Tek_TDS220

• Regular Contributor
• Posts: 62
• Country:
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #23 on: September 14, 2014, 10:21:02 pm »
Strictly speaking, it doesn't make sense to say 'total power consumption'.  It should be 'total energy consumption'.  Proper energy units would be uWs.  Similarly, when you write 'total current' you probably mean 'integrated current'.

#### dentaku

• Frequent Contributor
• Posts: 830
• Country:
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #24 on: September 15, 2014, 12:55:54 am »
I can easily visualize why integrating a square wave gives you a triangle and integrating a triangle gives you a sine.

OK, I'm just going to declare today rs20-has-pedantic-hat-day: Triangle integrates to something vaguely sine-ish, but not a true sine wave -- only a (co)sine wave integrates to give a sine wave. However, it's true that as you keep on integrating over and over again, you get closer and closer to a sine wave as you attenuate those harmonics more and more: square --> triangle --> vaguely sine-ish string of parabolas --> even more sine-ish string of cubics --> (infinity* steps later) --> sine --> sine --> sine

* Where infinity is defined as anything greater than, oh, I dunno, seven.

That would be a funny looking hat

I guess you're right but I really don't know anything about this stuff anyway. It's just that this video finally helped me understand what is happening when I build an integrator with an opamp to modify different waveforms.
When making analog synthesizers, nothing's ever perfect and I guess that's why the analog synth geeks love them so much.

I did a little experiment in Excel so I could graph what I was imagining and it works.
I broke up a triangle into little squares under the curve then added them all up and drew a graph.

« Last Edit: September 15, 2014, 01:53:23 am by dentaku »

#### HighVoltage

• Super Contributor
• Posts: 3977
• Country:
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #25 on: September 15, 2014, 04:01:46 am »
I am using the Integral function very often to measure discharge energy
Voltage input to Channel 1 [Voltage in kV]
Current input to Channel 2 [Current in mA]
Math function one: CH1  * CH2 [Power Watt]
Math function two:  INT (Power) [Energy in mJ]

Once you set the probe correctly, the Energy is shown correctly
in mJ on the oscilloscope measurement output.

This works well on the modern Agilent scope, but the old
FLUKE / Philips scope PM3394B did this already in real time
in the 1990's

Great Video, Thanks

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

#### miguelvp

• Super Contributor
• Posts: 5549
• Country:
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #26 on: September 15, 2014, 04:14:21 am »
I did a little experiment in Excel so I could graph what I was imagining and it works.
I broke up a triangle into little squares under the curve then added them all up and drew a graph.

That is what is shows per cycle if I do a single integral, but the next cycle  goes on top of the other one.
What it's needed is an offset in the triangle wave so that it shows that at a 90 degree phase for half a cycle and then for the other half cycle starting at 270 degrees it produces the inverse.

But when I scaled the single integral of the triangle wave without offset it showed a secondary wave that surely will affect the process above, not sure why that happens yet.

#### dentaku

• Frequent Contributor
• Posts: 830
• Country:
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #27 on: September 15, 2014, 11:43:14 am »
I did a little experiment in Excel so I could graph what I was imagining and it works.
I broke up a triangle into little squares under the curve then added them all up and drew a graph.

That is what is shows per cycle if I do a single integral, but the next cycle  goes on top of the other one.
What it's needed is an offset in the triangle wave so that it shows that at a 90 degree phase for half a cycle and then for the other half cycle starting at 270 degrees it produces the inverse.

But when I scaled the single integral of the triangle wave without offset it showed a secondary wave that surely will affect the process above, not sure why that happens yet.

I wish I knew more about he match behind it. I just did another of my crude Adobe Illustrator and Excel experiments with a full cycle and this is what came out of it.

#### EEVblog

• Posts: 27666
• Country:
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #28 on: September 15, 2014, 01:53:49 pm »
Didn't expect the level of math nit-pickiness on my latest video, that was rather foolish of me

#### fvdpol

• Contributor
• Posts: 8
• Country:
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #29 on: September 15, 2014, 04:35:42 pm »
Thanks Dave for the (as usual) clear explanation.    Some time ago a found on the Jeelabs blog an interesting post where the power consumption of a board was analysed by type of operation. Great to see correlation between the code/logic executed, specific hardware operated and the power consumption.

http://jeelabs.org/2011/12/30/anatomy-of-a-room-node-transmission/

#### HighVoltage

• Super Contributor
• Posts: 3977
• Country:
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #30 on: September 15, 2014, 05:38:59 pm »
Didn't expect the level of math nit-pickiness on my latest video, that was rather foolish of me
I guess, when you use the word "Integration" as a math term in your video description,
all the mathematicians are coming out for offering suggestions and corrections.

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

#### EEVblog

• Posts: 27666
• Country:
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #31 on: September 15, 2014, 09:35:32 pm »
I use Math functions as well, they are very useful too for quick easy measurements. They also help build reports as well. Either Baffle with Bullshit or hope someone else knows what is being displayed.

I'd sometimes put bullshit units into reports to see if anyone notices, like Furlongs per Fortnight
https://en.wikipedia.org/wiki/FFF_system
No one ever did!

#### dentaku

• Frequent Contributor
• Posts: 830
• Country:
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #32 on: September 15, 2014, 09:51:01 pm »
Didn't expect the level of math nit-pickiness on my latest video, that was rather foolish of me

At least it was civilized math nit-pickiness.
I don't really understand the math but at least this video finally made me understand what integration is.

#### EEVblog

• Posts: 27666
• Country:
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #33 on: September 15, 2014, 10:14:11 pm »
I don't really understand the math but at least this video finally made me understand what integration is.

Well, there was hardly any math in this really, it was meant to be a video showing the concept of integration on a scope and a basic usage case for it. If that helped you, then successful video!

#### Circlotron

• Super Contributor
• Posts: 1319
• Country:
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #34 on: September 15, 2014, 11:33:30 pm »
One of the first things I did with my scope is measure the milliJoules energy output of a number of different car ignition coils. The integration function is a perfect fit for this. Just clamp the high voltage side of the coil to 1700V max with a string of zeners (typical arcing voltage) and integrate volts x current. One really interesting result was after measuring the output of some boxes from a REALLY big name CDI manufacturer. They claim with regard to one particular box "100mJ spark energy" but that is only what their box pumps into the coil primary. Actual coil secondary output with one of their CDI-specific coils was only 38mJ, and with a more conventional coil it was as low as 25mJ. See pics for good conventional ignition output vs CDI under same test conditions.
« Last Edit: September 16, 2014, 12:03:55 am by Circlotron »

#### dentaku

• Frequent Contributor
• Posts: 830
• Country:
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #35 on: September 16, 2014, 01:21:38 am »
I don't really understand the math but at least this video finally made me understand what integration is.

Well, there was hardly any math in this really, it was meant to be a video showing the concept of integration on a scope and a basic usage case for it. If that helped you, then successful video!

By "the math" I mean the stuff other people have posted in the forums, your video actually showed it visually so that's how it helped.

#### DrJoe

• Contributor
• Posts: 19
• Country:
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #36 on: September 16, 2014, 04:50:19 am »
Why is the integral wave less than (below) the wave of the input?  If the integral and the pulse begin together, it would seem to me that the integral function would initially follow the pulse curve, then level out as the pulse ended, but it should always be greater than the input and continually rising since it is, after all, the integral of the input (assuming the input is always positive).

Was the integral's scale much, much greater? I can only guess that the scales were different or the integral function actually began before the impulse. Or I'm misunderstanding something...

Very interesting video, BTW. The colors and sound were fine on my computer.

#### robrenz

• Super Contributor
• Posts: 3035
• Country:
• Real Machinist, Wannabe EE
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #37 on: September 16, 2014, 05:01:25 am »
The vertical scale of the integral is representing area under the curve. Even though the current pulse height is very high it is also very narrow yielding a small area.

#### David Hess

• Super Contributor
• Posts: 8333
• Country:
• DavidH
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #38 on: September 16, 2014, 01:49:03 pm »
Does anyone know if the quantization noise distribution veers from the ideal for other types of ADCs?
Also, what kind of ADCs are typically found in oscilloscopes?

They used to use predominantly flash converters but now they use folding interpolating or pipeline converters and of course interleaving is common which will alter the characteristics and *that* may change depending on the number of active channels.

If you can fiddle with the interleaving, then the change in the distribution of the noise may be revealing.

#### T3sl4co1l

• Super Contributor
• Posts: 12294
• Country:
• Expert, Analog Electronics, PCB Layout, EMC
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #39 on: September 16, 2014, 03:19:44 pm »
Why is the integral wave less than (below) the wave of the input?  If the integral and the pulse begin together, it would seem to me that the integral function would initially follow the pulse curve, then level out as the pulse ended, but it should always be greater than the input and continually rising since it is, after all, the integral of the input (assuming the input is always positive).

Integration is always "PLUS A CONSTANT", which for a proper integral (one which spans a defined width, such as what's shown on screen) is technically zero at the start.  It seems this scope adds an additional offset so it remains balanced visually; which is kind of handy, as most integrals veer off to infinity and starting at mid-screen means you only get to see half of anything.

As long as the horizontal axis is indicated, it's a visual effect only, the math is still correct.  (And anyway, measuring a difference with cursors subtracts the "PLUS A CONSTANT" so even if the offset were wrong, it disappears again in that measurement.)

Quote
Was the integral's scale much, much greater? I can only guess that the scales were different or the integral function actually began before the impulse. Or I'm misunderstanding something...

The scale is necessarily different, because the units are different.  They're always adjustable, which is definitely handy!

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life? We can help.

#### T3sl4co1l

• Super Contributor
• Posts: 12294
• Country:
• Expert, Analog Electronics, PCB Layout, EMC
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #40 on: September 16, 2014, 03:26:33 pm »
Oh, another wonderful use of integration:

Current sense probes.

If you do the old "scope probe grounded to clip" trick and wave that over a circuit, you're bound to see impulses and ringing.  The ground loop isn't very particular at that size, so what you can do is, wind a small coil (maybe 10-20 turns of fine wire) and fit it in the end of a 6mm brass tube, which has been slotted up one side.  Add a 50 ohm series termination resistor, and run coax up to the scope (with source termination, it's not necessary to terminate the scope end).  Now, the brass tube shields stray E and B fields from your probe, except the ones that are axial with the tip.  Wrap it with tape, and you can wave it around your circuit and sniff the currents flowing through components, traces, even individual vias!

But you're not actually measuring current.  You're measuring EMF.  Which is the derivative of current.  So, you can integrate it, and now instead of impulses, you have steps -- corresponding exactly to the current steps in your circuit!  Of course, it's not calibrated, but knowing the general proportions and how the signal varies with distance, you can get a feel for how much current is flowing in a circuit, and where.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life? We can help.

#### rs20

• Super Contributor
• Posts: 2075
• Country:
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #41 on: September 16, 2014, 04:23:30 pm »
If you do the old "scope probe grounded to clip" trick and wave that over a circuit, you're bound to see impulses and ringing.  The ground loop isn't very particular at that size, so what you can do is, wind a small coil (maybe 10-20 turns of fine wire) and fit it in the end of a 6mm brass tube, which has been slotted up one side.  Add a 50 ohm series termination resistor, and run coax up to the scope (with source termination, it's not necessary to terminate the scope end).  Now, the brass tube shields stray E and B fields from your probe, except the ones that are axial with the tip.  Wrap it with tape, and you can wave it around your circuit and sniff the currents flowing through components, traces, even individual vias!

Awesome idea! When you say slotted up one side, do you mean a cut all the way down one side so that the tube has a "C" cross section? Is the idea to prevent the tube from acting as its own shorted-out coil and producing its own cancelling EMF? How long would you normally make the tube?

#### T3sl4co1l

• Super Contributor
• Posts: 12294
• Country:
• Expert, Analog Electronics, PCB Layout, EMC
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #42 on: September 16, 2014, 07:27:31 pm »
Slotted lengthwise near the end, yes.  It doesn't have to be full length.  The closer the end of the slot is to the coil, the more it shields the coil in that direction, which makes it less sensitive, more directive, and pushes the pattern off center (imagine the tube were mitered, instead of slit, to the same depth).

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life? We can help.

#### fpliuzzi

• Regular Contributor
• Posts: 157
• Country:
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #43 on: September 16, 2014, 10:24:44 pm »
Here's a nice closeup of the tiny coil in the tip of the EMI sniffer probe referred to by T3sl4co1l. This image was extracted from page 55 of AN70 by Linear Technology (Jim Williams). This closeup detail came in handy when I made my EMI sniffer probe a few years ago.

AN70... http://www.linear.com/docs/4159
« Last Edit: September 17, 2014, 12:45:15 am by fpliuzzi »

#### MarkL

• Supporter
• Posts: 1397
• Country:
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #44 on: September 16, 2014, 11:53:09 pm »
Another great app note by Jim Williams - thanks!

Here's another clever use of integration on a scope, this time to measure output load capacitance:

http://www.edn.com/design/test-and-measurement/4370468/Oscilloscope-math-functions-aid-circuit-analysis

This was done on a Tek DPO3034 which has generalized, software-driven math functions (like many Tek scopes).  This particular example can't be done on the Agilent MSOX because it needs a second computation after the integration, which isn't a supported combination on the MegaZoom ASIC.

It seems this scope adds an additional offset so it remains balanced visually; which is kind of handy, as most integrals veer off to infinity and starting at mid-screen means you only get to see half of anything.
(Referring to the Agilent MSOX...)  It does.  There's an adjustable constant that pops up on the Math menu when integration is selected.  Dave didn't show that or maybe he didn't have to do anything since the input offset was already close enough to zero.

#### KedasProbe

• Frequent Contributor
• Posts: 451
• Country:
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #45 on: September 17, 2014, 12:39:22 am »
Calculating Power Value in the selected time range.
http://blog.hameg.com/?p=1799#more-1799
Not everything that counts can be measured. Not everything that can be measured counts.
[W. Bruce Cameron]

• Regular Contributor
• Posts: 126
• Country:
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #46 on: September 17, 2014, 09:47:03 pm »
Pity my Agilent DSO-X 2024A doesn't have integration. At least I can't find it in the Math functions.

#### rs20

• Super Contributor
• Posts: 2075
• Country:
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #47 on: September 17, 2014, 10:01:59 pm »
Pity my Agilent DSO-X 2024A doesn't have integration. At least I can't find it in the Math functions.

That's surprising, but I've had a quick look through the manual for the series and I concur that it doesn't seem to be there. However, the average of a waveform is just its integral divided by its width on the screen. So if you position your signal of interest to be the only thing on the screen, then measure the full-screen-width average (page 176 of the manual) and multiply it by the width of the screen, you'll get exactly the same result.

• Regular Contributor
• Posts: 126
• Country:
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #48 on: September 22, 2014, 07:11:18 pm »
Thanks for that info. I was surprised about the missing feature. It's all done in software so would be fairly cheap to implement.

#### Digital Corpus

• Contributor
• Posts: 27
• Country:
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #49 on: September 26, 2014, 08:26:53 am »
I'm happy to see another video from you Dave. As I'm working on a measurement project for automotive use, I've needed to quantify some signals coming out of the cars electronics, specifically some old diesel fuel injection ones. In the some of the first commercial direct inject diesel applications, primitive monitoring of fuel injection is required for to maintain engine speed and operation. This was done on one fuel injector and the signal lets the engine control unit know what's going on (clicky if you want to ready more). Well, no one outside of the manufacturers ever really hooked up an oscilloscope to see what this signal looked like, so I decided to.

The cursors are setup at the beginning and end of injection and the voltage is a function of the movement of the needle. In order to figure out its physical location, an integral needs to be taken. I exported the on-screen data plot into a spreadsheet, I ran the integral manually to compensate for the DC offset also so I wouldn't just idle my car forever in a day.

I don't have applicable units, but knowing other parameters of the injector such as fuel pressure, opening pressures, closing pressures, nozzle orifice size, a pretty accurate estimate as to the amount of fuel injected is able to be calculated from this reading. The fuel is also used as a lubricant so there is more fuel that flow through the injector than what is actually injected as well.
« Last Edit: September 26, 2014, 08:28:27 am by Digital Corpus »

#### Circlotron

• Super Contributor
• Posts: 1319
• Country:
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #50 on: September 28, 2014, 12:10:36 am »

#### ichbinsnur

• Newbie
• Posts: 1
• Country:
##### Re: EEVblog #662- How & Why to use Integration on an Oscilloscope
« Reply #51 on: September 30, 2014, 02:48:21 am »
Hi Dave and all you others round here!

At first i must say a really gigantic thank you to Dave.

THIS BLOG AND YOUR VIDEOS ARE ABSOLUTELY AWSEOME!

I just picked up this Video because i exactly want to do what was mentioned : measuring my µc power consumption.

(still a bit fuzzy from it)

Inspired by the Scope videos i decided to get a new scope (Rigol MSO1074Z-S) for my lab. (should arrive this week )

Unfortunately measuring the low currents of sleeping microcontrollers is almost impossible if you don't own one of Dave's brilliant µCurrent Devices.

And that's where i suffer now.

I can't order at the eevBlog Store cause i'm located in Germany, where Dave won't ship to.

Other source (Adafruit) is sold out.

Can anyone help me getting one of these? Maybe there are additional sources that ship to germany?

I want to support Dave for his great work, so i surely want the original thing!
(not one of the rebuilds, where i don't know how reliable the are also)

cheers Chris
« Last Edit: September 30, 2014, 03:36:45 am by ichbinsnur »

Smf