# Signal averaging

1. Jan 12, 2005

### Integral

Staff Emeritus
I have a 60KHz pulse, out of a sensor with amplitude of about 200mv I need, in real time, to generate a 0 -10 V ( or 4-20ma) signal which represents the area of my pulse. This signal will be feeding a data collection system which will be sampling at around 1Hz, so I have lots of time. I would like to have an average over many pulses (several hundred to several thousand). The pulse is pretty stable so it is not really necessary to take that long of an average. Optimally the circuit will be as simple as possible. While maintaining long term stability.

References or direct help will be welcome.

Off the top of my head I think I need a simple integrator with some form of an amplifier. Is there a cheap solid state alternative?

Unnecessary details: I am placing a photo detector behind a mirror in the beam path of a high power laser to measure the transmitted power, the main beam is reflected. This will enable us to monitor the laser power in real time with no interruption to our process.

2. Jan 12, 2005

### chroot

Staff Emeritus
You should be able to design this easily with nothing more than a single op-amp.

- Warren

3. Jan 13, 2005

### Integral

Staff Emeritus
No, Warren, YOU, should be able to design this easily with nothing more than a single op-amp. I would need a reference?

4. Jan 13, 2005

### chroot

Staff Emeritus
Touche. Well, do you know what the basic op-amp integrator looks like?

- Warren

5. Jan 14, 2005

### Integral

Staff Emeritus
I believe that it employs a cap in place of the feedback resistor. I also assume that the value of the cap will determine the time scale of the averaging. Just not sure how to calculate it.

6. Jan 17, 2005

### amuron

Getting a gated integrator to be stable over a long period of time is a non-trivial task... At least your pulse rate is high enough that its possible.

Dielectric absorbtion is a real problem when it comes to gated integrators, making a polypropylene capacitor the best choice. There is also the issue with discharging the cap... and the switching network to do so, often times adds a multitude of other factors. You can also run into electrical noise which can seriously put your measurement in jeopardy.

Another way is to use a low pass filter and amp stage. Set the roll off around 600Hz, use good quality caps, and your output will track the lasers power and be stable. However, if the frequency were to vary, the output will be affected, unlike a gated integrator where you count pulses to determine the gating interval. A low pass filter is sometimes referred to as a leaky integrator.

The other thing to consider is what sort of error can you tolerate on the measurement. While one could easily use a single op amp, often times the output levels needed to drive the DAQ can introduce non-linear effects due to thermal effects if only a single op amp is used. As such, a buffer amp, or amp for the output may not be a bad idea. For 8 bits, it should not be an issue, for 16 bits, its critical.

Ron

7. Jan 17, 2005

### Integral

Staff Emeritus
Thank you amuron, your comments elucidate some of my fears. I would like this to be stable. The goal of this measurement is to provide real time data to the technician team which has to keep this lasers running as consistent as possible. We will be watching the power to determine when and if intervention is necessary. Looks like I need to track down a EE for some help. I was hoping that there was something simple I could do myself. Working graveyard makes it a bit harder to use Engineering resources.

8. Jan 17, 2005

### chroot

Staff Emeritus
Integral,

This problem would be much more easily solved in the digital domain. I didn't realize upon first reading that you wanted the integrator to be reset between pulses.

It should be a simple job to program a timer/counter in a simple chip like a PIC and have it count the pulse widths and do the averaging. If you need an analog output, many also come with simple DACs.

- Warren

9. Jan 18, 2005

### willib

Integral , hi , if you could post some data on your sensor , ie who makes it, it would help ..
also i dont see how sampling a 60kHZ signal at 1 HZ would tell you anything..
also how does the pulse vary ? frequency , amplitude ?
you can easily sample your pulse at 1000 times your 60KHZ rate ,with todays ADC's, and get an 8 bit result which can be analyzed by PC any way your heart desires..

10. Jan 18, 2005

### Integral

Staff Emeritus
I am feeding data to a MASSIVE manufacturing floor Data collection system. So have very little control over the sample rate. I could get as much as 100hz sample rate. But since I need an averaged signal and I am not interested in individual pulses 1hz would provide more data then I need. We will be watching for variation which occur on the scale of ~10 minutes. In addition I do not want an average amplitude but the average area of each pulse. That gives me a signal which is directly proportional to the actual value (power) I want.

Thus a primary need is to integrate my pulses to obtain the area, then I want an average of that area over many pulses, resulting in a slowly varying 0-10V DC signal (or 4-20ma).

The pulses are more Gaussian then rectangular. Well, actually, half Gaussian they have a very rapid raise time followed by a slower decay. Average pulse width is on the order of a microsec.

The sensor I am using is a UDT PIN #10DP

11. Jan 18, 2005

### willib

ok so you could collect the data with a PC then send it to the 'massive data collection system'..

lets assume for a second that you are using an 8 Bit ADC, and its output values are 0 to 255,and say your sensor outputs a pulse of .75 uS in width, and this pulse spikes up to a value of 240 in 0.01 uS, drops to 230 in .10 uS then stays around 210 for the majority of the pulse then decays to zero at .75 uS...

the point is once you collect this data you can integrate the area under your curve to give you your power reading..
National semiconductor has an 8 Bit ADC with a sample rate of a Giga HZ but it is rather piicey..
this is one with 10 bits ( 0 to 1023 ) output values , 30 million samples per second ( more than enough) , and it has a built in sample and hold..( essential ) , and its less than ten bucks from digikey

Last edited by a moderator: May 1, 2017
12. Jan 18, 2005

### chroot

Staff Emeritus
You'd be much better off using one of the low-speed parts from National, like the ADCS7478 or a relative. 1 MSPS, 8 bit resolution, I2C interface, 5 pins, 30 cents.

willib,

Keep in mind that most ADCs will not run very well with sample frequencies far below their rated sample frequency, because of sample capacitor droop. You are much better off picking one that has the right sample frequency for your application. 30 MSPS is likely way too high for this application, because some device is going to have to store all that data to do the calculations. Thirty megabytes per second is a lot of bandwidth!

- Warren

13. Jan 18, 2005

### willib

the 12 bit one is only three bucks from digikey .. a good deal..and i like the I2C interface , very easy to use..
since the 12 bit version is so cheap , why not use it..
ok Integral , you would have to add an Op amp to the front of your converter to scale your 0.2 V sensor output from 0 to 0.2 V 0 to Vdd (usually 5 V.)
you could adjust for the offset with software , in the testing phase..
thats it !! done, problem solved..

14. Jan 20, 2005

### willib

I ment to say ..." you would have to add an Op amp to the front of your converter to scale your 0.2 V sensor output from 0 to 0.2 V To 0 to Vdd (usually 5 V.)" but it wouldent let me edit it..

15. Jan 21, 2005

### rayjohn01

You guys worry me . Int says 'I want to average a 60Khz pulse ' but
does not state the width (it could be a nS ) , nor does he say whether it is unipolar bipolar ( possible average zero ) .
We have to 'assume' it's 60 Kz repeat rate cause he does not explicitly say that.(it could have been a pulse containing 60 khz changes ).
So as a description of the problem, this is grade 1 stuff.
Then MR CH says --' Oh you can do that with an Op Amp' -- oh yes AT 60 KHZ .
This one 'mentor' talking to one 'ADmin ' I mean go back to school guys .

The information is contained in both the pulse duration and repetition.
If you are only interested in long term effects you can probably ignore the rep rate ( meaning you could ignore a lot of pulses )
but you cannot ignore the pulse duration . Also you must precisely define what change in pulse you are interested in ( amplitude , duration, shape etc etc. ) cause other wise you may average the wrong thing.
If this pulse is bi-polar you could easilly get a nul result by some too simple analysis --- i.e. you may have to rectify it .
I tend to agree on a sampling technique , digital conversion , then you can deal with it in software -- but -- the sampling rate has to be a fair number of samples per pulse duration -- ( which you cared not to say ).
I will explain --- if the pulse only changes slowly ( minutes ) then a single sample per pulse may be adequate IF you are not interested in say duration.
It still has to occur at synchronised 60 Khz rate , but not every pulse .
But you said ' pulse area' OK so how much do you expect the 'area' to change ???
10% 1% this tells you how many samples you need per pulse , you need 10x more samples than the expected change, over the pulse duration.
You know these threads are read by a lot of people (even if they do not replY )
and I believe accuracy is paramount --- my continual impression is that the 'mentors' and 'admins ' are less accurate than the contributors ???????????????
If you guys were in a practical engineering job you'd be fired in a minute . But then -- there are 'teachers'

16. Jan 21, 2005

### chroot

Staff Emeritus
rayjohn,

1) I'm a senior applications engineer for Intersil Americas, Inc. I have been doing high-speed digital communication and video for four years.

2) I misread Integral's first post, and, once I realized my error, changed my mind to suggesting a digital solution instead of an analog solution.

3) I assumed that Integral's signal was pulse-width modulated, with a pulse frequency of 60 kHz. Using a 1 MSPS ADC, perhaps phase-locking its clock to the 60 kHz clock, you'll get about 17 samples per cycle. Since Integral plans on averaging the pulse-widths over minutes, this will be entirely acceptable. I didn't ask him any more details about his pulses, because I'm not really interested in designing the entire circuit for him -- I just intended to point him in the right direction.

4) If you feel that I'm in error, feel free to correct me. So far, all you've said is that you agree with my conclusion.

5) You've already been warned a good number of times for making personal attacks, and you seem to be heading that direction again. You won't be around here much longer if it continues.

- Warren

17. Jan 22, 2005

### willib

i found several sources for the Sensor in question..
http://www.columbia.edu/itc/chemistry/c2507/CS_Material_04/CS6_Material_1.pdf
this is the actual part spec sheet..
http://www.udt.com/Datasheets/Products/PhotovoltaicSeries.pdf [Broken]

i would have to deduce that the 60Khz specification is from the LASER..!!
Integral is using a pulsed laser ..Maybe he could tell us how long it would be ON during that time interval..unless the pulses are 1.6 x10^-5 sec in duration and then maybe off for the same amt of time .. we can only speculate at this point..

Last edited by a moderator: May 1, 2017
18. Feb 14, 2005

### pervect

Staff Emeritus
The thing that confuses me about your problem specification is that the average area of the pulse is equal to the average value of the signal multipled by the pulse repitition rate. But you say you don't want the average value of the signal (?).

The average value of your pulse is the intergal of I*dt over the area of one pulse.

The average value of your signal (current) is the intergal of I*dt over a fixed unit of time.

If the pulses occur at a constant rate, the two quantities will be directly proportional.

If you can't count on the signals occuring at a constant rate, you can still measure the average value of the signal, and then correct for the frequency rate by counting the rate at which the pulses occur. Send both measurements over to the data system (the average signal value and the pulse frequency) and let it do the arithmetic.

Measuring the frequency of the pulses will entail some sort of accurate time reference. If you can put the accurate time reference on the pulse producing part of the circuit, or if it already is stable, then the easiest thing to do is to measure the signal value.

The "op-amp leaky integrator" approach first suggested would be the simlest way of measuring the average signal value.

Code (Text):

|---capacitor------------|
|---resistor-------------|
|                        |
--photodiode----- minus terminal        |
output|
ref. voltage------plus terminal

The current through the photodiode with a high quality op-amp must flow through the parallel capacitor-resitor combination. A small current (the bias current) will flow into the op-amp, you can read that on the data sheet. A small current will also flow through the photodiode even when it's off (you can read that on the data sheet). You'll have to evaluate these error sources to see if this simple approach will be accurate enough to sove your problem. If the photodiode is appreciably leaky, this approach may run into problems, because the leakage of the photodiode will happen all the time, while the pulse only happens for a short time. If this is indeed a problem, then you'd need to put in some sort of circuit to switch the photodiode out of the circuit when you know there is no pulse. This strikes me as being hard to accomplish for several reasons (you'll have to regenerate your pulses, with a circuit to enable the photodiode for the regions you expect the pulse occurs with a little prediction). You'll also have to worry about fake current generated by the chopping process (charge injection).

The value of the DC output of the op-amp will be the average current (per unit time) flowing through the photodiode times the resistor value.

The RC valule will set the time constant over which the averaging occurs.

The average current per pulse will be the average current per unit time divided by the average number of pulses / unit time, i.e. the frequency.

Anyway, measuring the average signal value is definitely the easiest approach - I'm not sure it will be good enough, but I thought I'd explain it more fully in case it would meet your problem specifications.

19. Feb 14, 2005

### Integral

Staff Emeritus
WOW! I thought this thread was dead! Thanks each and everyone for the input.

Post #10 contains a fair description of my pulse. In is not bipolar, I cannot believe that for what I am needing, you need more detail then the fact that it is essentially a rectangular pulse 1$\mu$ s width and .2V amplitude. Occurring with a 60KHz repetition rate. The goal is to monitor the output power of a laser by putting a sensor behind one of the mirrors in the beam path. We have about a 1% loss at each mirror so I have something over 50mW of wasted beam to work with. I was hoping for something simple and passive. I need to minimize costs. This is NOT AN EDUCATIONAL EXERCISE, this is real world stuff. We have a significant fleet of these lasers, power is a critical parameter, loss of power means loss of . This is my concept for a way to solve this problem, which was created by poor initial engineering.

As for how much I expect it to change, ideally it will NOT change, but if we have power reductions between 5 and 10% our product is in danger. So I need to be sensitive to a 5% loss in power which translates for this problem to a 5% reduction in the area of my pulse.

The cheap A/D chips are interesting, are these set up solely with hardware or is it necessary to read and analyze the output with a computer?

Thanks again for the input, I am reading it all.

Last edited: Feb 14, 2005
20. Feb 15, 2005

### pervect

Staff Emeritus
I'm a bit surprised that the pulses are voltage pulses - I only took a quick glance at the spec sheet, but I would have assumed they were current pulses, that's why I was talking about the intergal of I*dt, I being the current.

(You can of course turn current pulses into voltage pulses by making the current flow through a series resistor, and you can turn the voltage pulses into current pulses by applying the voltage across a resistor).

If your input frequency is reasonably stable, you can just measure the average voltage as I mentioned before.

If your input frequency varies by more than 5%, things get a little more complicated. But there is a way to do it via analog means. I don't know if it will be any cheaper than the D/A solution, which I don't quite understand, not being familiar with those D/A parts myself.

Anyway, to measure the actual average area of N pulses via analog means, what you'll need is

1) an actual integrator - take the previous circuit (the leaky integrator), and remove the resistor. The result is a non-leaky integrator. You'll then need to put in the place where the resistor was an electronic switch. When the switch is on, it will discharge the integrator (capacitor). This is the "reset" state. When the switch is off, the circuit will integrate any input current, slowly charging up the capacitor.

hmmm - hyperhpysics has a URL on op amps, You might look here for some background

http://hyperphysics.phy-astr.gsu.edu/hbase/electronic/opampcon.html#c1
http://hyperphysics.phy-astr.gsu.edu/hbase/electronic/opampvar4.html

but it doesn't show the reset circuitry for a true integrator (oh well). You can probably find something with google if you really need it, or just ask in the forums.

You'll need another analog switch, one that can cause the integrator to "hold", in order to give your data system time to readout the voltage. I'd put the hold switch in series with the input, when it's open, no current can flow into the integrator.

So what we've got is something that looks like this

Code (Text):

pulse source------"hold" switch-------integrator
|
| reset signal to integrator (second switch across cap)

2) a comparator, and a frequency divider. The comparator circuit will take the input pulses and drive the frequency divider. If you want to average over 1000 pulses, you need a divide by 1000 circuit. That gives you a 60 hz output, maybe you really want a divide by 10,000 circuit, which gives a more managable 6 hz output. It takes a little cleverness to drive the comparator at the same time you drive the integrator, but it can be done. If you have current pulses, the trick is to put in a series resistor to generate voltage pulses for the comparator, while putting the current into the integrator. Of course, this means that both the comparator and the op-amp for the integrator have to be low-leakage. The comparator will also have to be fast enough to handle the pulses as well as being low leakage (the two requirements tend to conflict).

3) Some auxillary logic - a couple of flip flops and some logic gates.

The logic would be driven from the output of the frequency divider, and would alternate between three states (not necessarily all of the same width)

a) a reset state is the first state. In this state, the integrator is reset
b) an accumulate state is the next state. In this state, the integrator accumulates pulses, slowly charging the capacitor.
c) a hold state is the final state. A signal is sent to your data system to indicate that the data is available, and the integrator "holds" its output. The output of the op-amp is the integrated area of the pulses counted during the accumulate state.

You can make a synchronus divide by 4 out of two D flip flops. If you know how :-) . Ummm, well, a very very terse description is that

(a)--(D---Q)----(D- notQ)----> (a)

where the two points labelled (a) are connected together, and the (D--Q) represents a D flip flop.

Each of the states can be decoded with a 'nand' gate. The count sequence goes

00, 01, 11, 10

and you could make 00 the reset state
01 the count state
11 and 10 the "hold" state, the leading '1' indicating "data valid"

But we're talking a fairly big part count - an op amp, some cmos switches, (one to reset the integrator, one to put it into the hold state), a comparator (to drive the freqyency divider), a divide by 10,000 circuit (could be up to four packages if you do it discreete, four divide by 10's), a dual-d flip flop, and some nand gates (4 to a package, you'd need 2-3). About 9 packages. Though they're probably all dirt cheap packages.

As proposed, there is no logic to ensure that the start of a cycle doesn't occuring during a laser pulse - in fact it probably will happen that way - but the error will be much lower than the 5% you need.

The overview - every 10,000 pulses, the state of the logic advances. The first state resets the integrator. The second state allows the integrator to accumulate charge (it accumulates exactly 10,00 pulses worth). The third state lasts twice as long as the others (20,000 pulses), during which the data is held so your data system can read it.