What are some techniques for filtering and amplifying pulse signals?

In summary, you can use a series capacitor to amplify pulses and then use a window comparator to compare the pulses and trigger a gate or output when the pulses are lower than a certain threshold.
  • #1
petterg
162
7
Whats the way to go to apply filter to a pulse signal?

I have a signal with some weak triangle pulses, positive or negative, mixed with some very slow sine wave. I've tried to illustrate this in the attachment. The sine is actually slower than it looks in the chart I don't really know how low frequency it has, but I know it's less than 1Hz. The pulses has a length of 30-50us and they come about every 200-220us.

My goal is to feed this signal into a microcontroller. The controller needs to count pulses and know if they are negative or positive. My challenge is that the pulses are so weak that they have to be amplified, without amplifying everything else. In other words, a highpass filter. The thing with any kind of filter is that signals are weakened - in particular pulses. And that's really the issue I run into in my attempts with this.

So my idea to work around this is to send the signal through two parallel circuits with an opamp in each - one that do lowpass, and one that do nothing except for make the same delay as the lowpass. Then feed the output from those two circuits into a the next stage that subtracts the lowpass filtered signal from the original. The result should then contain pulses only - I thought.

It turns out that even with second order lowpass the output of the filter is affected by the pulses, and the signal that is supposed to pass untouched is also affected by the filter in the parallel circuit. And the subtraction method requires gain from the two parallel circuits to be equal - that wasn't so easy to get properly either.

So, what's the way to apply filter to pulse signals?
 

Attachments

  • pulse-excel.png
    pulse-excel.png
    2.5 KB · Views: 738
Engineering news on Phys.org
  • #2
It sure sounds like you want to use a highpass filter, not a lowpass filter...EDIT:

My challenge is that the pulses are so weak that they have to be amplified, without amplifying everything else. In other words, a highpass filter. The thing with any kind of filter is that signals are weakened - in particular pulses.

You can certainly have gain in your HPF opamp circuit. Why do you think that the input signal cannot be amplified as part of the HPF?
 
  • #3
probably the simplest circuit is a series capacitor into the center of two resistors (say 1 to +5 and 1 to ground). You then get positive and negative pulses relative to the 2.5V divider voltage (this is a single pole highpass). Two comparators can detect the pulses and then you can do whatever you want, or you can amplify and filter some more before the comparators if needed. Size the resistors to not load down your source, and the capacitor to let just enough high frequency through.
 
  • #4
berkeman said:
It sure sounds like you want to use a highpass filter, not a lowpass filter...


EDIT:



You can certainly have gain in your HPF opamp circuit. Why do you think that the input signal cannot be amplified as part of the HPF?

I need gain. The thing is that the filtering is weakening the pulse, so what is amplified is a weaker pulse and a weaker sine. The result looks much like I could drop the filter and just do amplification without filter.
 
  • #5
meBigGuy said:
probably the simplest circuit is a series capacitor into the center of two resistors (say 1 to +5 and 1 to ground). You then get positive and negative pulses relative to the 2.5V divider voltage (this is a single pole highpass). Two comparators can detect the pulses and then you can do whatever you want, or you can amplify and filter some more before the comparators if needed. Size the resistors to not load down your source, and the capacitor to let just enough high frequency through.

I don't think I understand how you're thinking. After the highpass, the signal goes to two parallel comparators? What do they compare?
 
  • #6
Look up LM339 window comparator.

Assume the resting voltage at the divider is 2.5V and it spikes up and spikes down. In addition some low frequency comes through, as well as the slower ramp you showed. But imagine for the moment that the filter is perfect and all that comes through are positive spikes and negative spikes. Assume for the moment that they are +-0.25 volts. Set a comparator reference input to 2.5 - 0.20 = 2.3V. whenever the pulse goes below 2.3V the comparator triggers. Set the other comparators reference to 2.7V. Whenever the input goes above 2.7V the comparator triggers.

That is the simplest from a conceptual viewpoint. If you need gain, amplify the signal and possibly filter it again. Or, go to more complex active filter architectures. Then send the signal to the "window comparator"
 
  • #7
Here is a crude example. You will have to mess with the input polarities, decide on the input capacitor size and compute the proper reference resistor values and maybe change the output logic.
 

Attachments

  • pyro1_36.gif
    pyro1_36.gif
    2 KB · Views: 772
  • #8
Just looked at your signal levels. Look at Google Images for high pass active filter. Lots of circuit examples.
 
  • #9
I see your idea of using comparators. It introduces an other challenge thou; Trigger level needs to be dynamic. The signal strength may vary in the range of just a few mV to 500mV. The good thing is that the sine and pulses scale near proportional. Pulse amplitude will always be within 3-5 times the amplitude of the sine.

Any idea of how to make dynamic trigger level?
 
  • #10
Read up on basics of "differentiator", which is a term closely related to high pass filter

trouble is it amplifies high frequency noise

One approach is to low pass to reduce noise, then high pass

another is to low pass at two different cutoff frequencies and subtract or compare the result

many ways to skin that cat

filters are math intensive

here's an old National appnote on filters you might enjoy
http://www.swarthmore.edu/NatSci/echeeve1/Ref/DataSheet/IntroToFilters.pdf

updated version at
http://www.ti.com/lit/an/snoa224a/snoa224a.pdf

THIS project will be educational for you !

Have fun, and my hat is off to you for building real stuff.
 
  • #11
You could approach the wide dynamic range issue in different ways. One complexity is the time rate of change of the average signal amplitude. If it is slow enough you can build an Automatic Gain Control (AGC) based on either the peak or average signal level. Then you need to deal with attack and decay times. (lots of info through google).

The brain-dead approach is to design the circuit to work with the lowest signal level and then let the signals clip at the higher signal levels. The key to this is that your filter needs to be good enough that at the high signal levels the low frequency feedthrough isn't enough cause false detections. Your filter probably needs to be completely linear (no clipping) and then followed by a gain stage that can clip. If that can't work then the gain stage needs gain control of some kind.
 
  • #12
Thanks guys. I've got a lot to read into, and lots to learn.

And as expected, I ran into an unexpected issue. Why does the lm324 seem to behave very different from the ua741 (in simulation)? Even with the simplest circuit as attached, lm324 give 1.48V on the output. I expected 2.5V. Ua741 give 2.49V.
 

Attachments

  • vground324.png
    vground324.png
    2.5 KB · Views: 1,005
  • #13
Try connecting the rest of the opamps in the package? I don't know about how the model gets mapped to the schematic, but the pin numbering differs between package styles. Maybe there is an issue there.

BTW, You should use a rail to rail variant of the LM324. Standard LM324 only drives to (V+)-1.5V or in your case, 3.5V.
 
  • #14
petterg said:
Thanks guys. I've got a lot to read into, and lots to learn.

And as expected, I ran into an unexpected issue. Why does the lm324 seem to behave very different from the ua741 (in simulation)? Even with the simplest circuit as attached, lm324 give 1.48V on the output. I expected 2.5V. Ua741 give 2.49V.

That circuit should give half your supply voltage.
Is your supply nice and quiet? Try a 6 or 9 volt battery.
What happens if you remove C1 ?
 
  • #15
Removing capacitors - no change.
Increase the values of capacitors to 1F (good thing this is simulation) - no change
Connecting all 4 opamps - no change (that's where I realized something didn't make sense and started to strip down the circuit to isolate the behavior, ending up with this simple test circuit). Pin numbering seems to agree with the datasheet.

Seems like lm324m simulates close to expected behavior. Lm324n outputs noisy 1,5V no matter what it get for input. Ni Multisim has 25 versions of lm324xxx in library, and 2-8 sub versions of each of them. I have no clue what the difference between those are (it can't be that many packaging) and they surely behave differently. Some of them even cause the simulator to crash. I'll stick to lm324m from now on as it seems to behave as expected, and hopefully the physical lm324n that I'll get in the mail soon won't be way off.
 
  • #16
Attached is my highpass approach.
Input is wires coming in from the left.
U1A is virtual ground generator.
U1B is an impedance buffer, having a DC block before it.
U1C and the RC's in front of it is the highpass filter.

Ch.A on the scoop is output from U1B. It's almost flat between the pulses. Voltage in the pulse max is about 4 times the level of voltage between the pulses.
Ch.B is output from U1C. It's starting to look more like sawtooth. Voltage in the pulse max is only about double the level of voltage between the pulses. And the voltage between the pulses are stronger than before the filter. So I've managed to get only the negative effects of the filter, none of the positive ones.

That's why I don't think highpass is the way to go.
Next up is lowpass + comparator.
 

Attachments

  • highpass.png
    highpass.png
    36.5 KB · Views: 734
  • #17
Here comes lowpass scoopshots. I suspect the simulation is wrong, cause what I did between those two shots was to swap the input wires. I my head this should make signal mirror around 0V, which it doesn't.
If the simulation is correct, I don't see how I can use the lowpassed signal any further, as I seems to be independent of voltage level between the pulses.

RC-net for lowpass is set for 18Hz, 2nd order.
 

Attachments

  • scoop-lowpass-negative-pulse.png
    scoop-lowpass-negative-pulse.png
    5.3 KB · Views: 653
  • scoop-lowpass-positive-pulse.png
    scoop-lowpass-positive-pulse.png
    5.4 KB · Views: 662
  • #18
That's a weird circuit. Did you make it up? Where does the AC input connect to? Oh, it's a way to halve your supply voltage. Why aren't you using a double power supply?

attachment.php?attachmentid=61606&stc=1&=1378687651.png
 
  • #19
petterg said:
Attached is my highpass approach.
Input is wires coming in from the left.
U1A is virtual ground generator.
U1B is an impedance buffer, having a DC block before it.
U1C and the RC's in front of it is the highpass filter.

Ch.A on the scoop is output from U1B. It's almost flat between the pulses. Voltage in the pulse max is about 4 times the level of voltage between the pulses.
Ch.B is output from U1C. It's starting to look more like sawtooth. Voltage in the pulse max is only about double the level of voltage between the pulses. And the voltage between the pulses are stronger than before the filter. So I've managed to get only the negative effects of the filter, none of the positive ones.

That's why I don't think highpass is the way to go.
Next up is lowpass + comparator.

not sure I understand the red part.

Observe C1R6 form a differentiator
and it looks to me like ChA is about what you wanted to accomplish.

What does it look like if you skip U1B and feed input straight into C4?

EDIT: PS I would connect my scope common to negative side of 5volt supply.

Why ?

Virtual ground is only as stout as the op-amp that's creating it.
Power supply rails are quite rigid in comparison, that's why they are called 'rails'.
Then your 'scope trace will center around mid power supply and it'll be clear when you hit a 0 or 4 volt limit.
And you could monitor virtual ground, too.

late addition: You're aware that C3-C2 form a capacitive voltage divider for power supply noise... your virtual ground will be better behaved without C3. And C2 can be large.

old jim
 
Last edited:
  • #20
NascentOxygen said:
That's a weird circuit. Did you make it up? Where does the AC input connect to? Oh, it's a way to halve your supply voltage. Why aren't you using a double power supply?

attachment.php?attachmentid=61606&stc=1&=1378687651.png


Dual supply is not a option in the real circuit.
 
  • #21
jim hardy said:
not sure I understand the red part.

Observe C1R6 form a differentiator
and it looks to me like ChA is about what you wanted to accomplish.

ChA is the closest to the preferred signal I've been. This is basically the original signal. Ideally I'd have a signal that is constant 2.5V between the pulses. That is not the case for this signal. My goal is the make the signal closer to the ideal. I want to amplify the pulses, not the what-ever-voltage there is between them.

Values for C1R6 is chosen so that the filter does not affect the signal.

jim hardy said:
What does it look like if you skip U1B and feed input straight into C4?

U1B has one purpose only; secure that the input impedance is as stable as posible.
Connecting input directly to the highpass network in front of U1C makes output about 5% better than going through U1B. Still output from U1B is the best signal so far.

jim hardy said:
EDIT: PS I would connect my scope common to negative side of 5volt supply.

I agree. Just one problem thou; To see the pulses I need resolution of 1mV/Div. Max offset is 99 Div. Hence I don't get to see the signal if scoope is grounded to rail. To compensate I have an extra scoope that monitors rail - virtual ground at 50mV/Div.

jim hardy said:
late addition: You're aware that C3-C2 form a capacitive voltage divider for power supply noise... your virtual ground will be better behaved without C3. And C2 can be large.

I was not aware that virtual ground generator would behave better without C3. (And I'm still not aware of that). Setting C2=220mF, and removing C3 makes virtual ground voltage = 0.06V. Removing also C2 makes virtual ground voltage = 2.5V. Should R1/R3 be changed in order to balance the virtual ground when using only one capacitor?

Powersupply for this circuit (at least the final stage of opamp) is planned to be the 5V regulated output from an arduino. This to make sure the voltage into the arduino board will be within the aurduinos spec. The arduino will be powered by a 12V battery.
 
  • #22
Are you at the moment constructing this, or are you relying on software simulation? It may be better to construct the normal dual-supply OP-AMP filter first, then when you have it tailored to your needs, convert it to single supply.

Although your need is for a high pass filter, in practice you'll be giving it a bandpass filter, so maybe go with that right from the start, using a designed upper falloff instead of letting it default to the OP-AMP limitations?

Is the shape, size, width or height of the pulses important? If you could trigger a monostable with your noisy signal would the pulse-train of fixed shape pulses satisfy your need for a cleaned up signal?

Those caps should have no effect on the DC output of your virtual ground. What you are finding is puzzling.
 
Last edited:
  • #23
Are you really using milli-farads? Maybe you better wait a while for a transient sim to settle. I think you want uF.

100K 200uf is a 20 second time constant, BTW
 
  • #24
Setting C2=220mF, and removing C3 makes virtual ground voltage = 0.06V. Removing also C2 makes virtual ground voltage = 2.5V.

That is absolutely bizarre. Sounds like when you remove C3 the connection is also lost between R1 and U1A's pin 3.

Get U1A working without either capacitor, just R1 and R3, then plug C2 back in. (could capacitors be backward? Electrolytics are polar devices and will conduct if installedbackward. )

Should R1/R3 be changed in order to balance the virtual ground when using only one capacitor?
That should be unnecessary. Electrolytics have insulation resistance in tens of megohms when polarity is right.

Onward ! Each little step is another piece of knowledge.
 
  • #25
I'm still in simulation. The shipment of lm342 is still in the mail somewhere (maybe in my mailbox, but I'm traveling this (and almost every) week)

Virtual ground simulates as expected without capacitors. I would expect with C2 connected the virtual ground would start low and increase to 2.5V. Simulation tells it starts at 59mV, increase to 60.[something]mV. Maybe it's something about the version of lm324 I'm using?
As far as I can see, there is no polarity of capacitors in NI multisim.

@meBigGuy
When Jim says big, I make it big :)


@NascentOxygen
Using a monostable may be a very good idea!
Whats important is to signal to the MPU the following three states: positive pulse, negative pulse, no pulse. This can be done either using two digital input pins, or one analog input pin. Using two monostable circuits, one that is triggered on positive pulses, another that is triggered by negative pulses would be good. Important that they do not trigger on the slow sine wave thou, even when the sine for a strong signal will have higher voltage than the pulse of a weak signal.
 
  • #26
If you are going to be doing any filtering, I think it's the Bessel with its reasonably flat delay that best preserves the waveshape.

What height is each pulse? About 0.5mV is it?
 
  • #27
Ahhh simulation, eh ? So anything goes !

Indeed virtual ground will start at zero and increase with circuit time constant; your understanding is correct.. C2 keeps power supply noise from reaching the amplifier input.
It should hold as steady as the opamp is capable of holding it. WHat's its output current capability?

(Interesting trick - some folks use an audio opamp for virtual ground. It biases its output mid supply and has substantial current capacity - that one is in LM383 application notes. )

That simulator sounds hokey... Rather than removing C3 set it to about 1/10th picofarad - probably there's that much wiring capacitance anyway. If there's some threshold where it starts working, we learned something about the simulator program.
 
  • #28
It's not even worth writing about the latest attempts of simulation. Results seems to be more random than real. Time to switch to LT spice. What LTxxxx is similar to lm324n?
 
  • #29
much better input impedance and offset than LM324,,,, comparable gain-bandwidth
more of a 'precision' opamp

see if your simulator has ithttp://www.linear.com/product/LT1013

http://cds.linear.com/docs/en/datasheet/10134fd.pdf
 
Last edited by a moderator:
  • #30
Thanks, Jim. What's the trick to find similar opamp from different brands? Just read a bunch of datasheets until you find something that looks similar?

Simulation with LT spice seems a lot more logical. (T=0 is when the circuit has stabilized.)
Attached is an attempt using 4th order, bessel highpass tuned for 300Hz. Green is the output of U1, blue is the output of U2 and red is output from U3. It seems to just add DC.
Same circuit tuned for 3kHz makes sawtooth output. As the other high pass attempts, I don't see how they can be useful for pulse signals.

Attached is also an test with a differentiator. With C2=[100p;500p] it responds quite well to the pulse edges. It's well balanced around 0. For some reason it's amplitude is different when the connectors is swapped.
This could clearly be used to trigger a monostable... but how should the direction of the pulse be identified?
 

Attachments

  • filter-bessel-HP-300hz.png
    filter-bessel-HP-300hz.png
    6.2 KB · Views: 403
  • filter-diff-pos.png
    filter-diff-pos.png
    14.1 KB · Views: 446
  • filter-diff-neg.png
    filter-diff-neg.png
    13.6 KB · Views: 477
  • #31
What is the fastest repetition rate of the pulses that will be encountered? You are using 50kHz here, is that representative? Is the baseline drift that you are trying to remove just mains hum, i.e., 60Hz?

You could build a monostable that triggers on the rising edge, this will indicate the +ve going pulses. Invert your analog signal and parallel feed it to a second identical monostable, the output of which will then indicate the presence of -ve going pulses.
 
  • #32
petterg said:
What's the trick to find similar opamp from different brands? Just read a bunch of datasheets until you find something that looks similar?

I find manufacturer's selection guide and look for similar supply voltage, input offset & bias, and unity gain BW.

Op-amps are getting so good it's hard to find ones as bad as I grew up with. LM324 was improvement over 741 which was improvement over 709 , and it is looking anemic now.
You young guys are amazing to me - you're not overwhelmed by so much progress and the myriad gizmos available. I guess that's why we are allotted but threescore and ten - world changes too much for us.

...but how should the direction of the pulse be identified?

Thought experiment time

Let the tail wag the dog.

Once you have them centered about zero,

IF you trigger on only one transition... and examine level shortly after that trigger..

A positive pulse has, shortly after its positive transition, a positive value
A negative pulse has, shortly after its positive transition, a zero value

Sounds like a setup for an edge triggered monostable delay (74123 or 555) and D flip-flop(7474?).

It's late - sanity check me please..
 
  • #33
NascentOxygen said:
What is the fastest repetition rate of the pulses that will be encountered? You are using 50kHz here, is that representative? Is the baseline drift that you are trying to remove just mains hum, i.e., 60Hz?

You could build a monostable that triggers on the rising edge, this will indicate the +ve going pulses. Invert your analog signal and parallel feed it to a second identical monostable, the output of which will then indicate the presence of -ve going pulses.

It's about .2ms between pulses. That makes 5kHz.
I'm want the pulses to start from 0. That is, remove the slowly changing offset. It's slower than 1Hz.

The challenge is that both the offset and the pulses changes amplitude with a factor of 500. That is, at some point the offset may be -0.3mV and pulse peak may be +1mV. At some other point the offset may be +150mV and puls peak may be +650mV. (That was for positive pulses. For negative pulses all numbers will change sign.) So the challenge with monostables is to trigger on the pulse, not the changing offset. The differentiator finds edges nicely, but it finds two edges for each pulse. If there is a way to remove / ignore the second edge, it would be perfect for triggering a couple of monostables.
 
  • #34
jim hardy said:
Once you have them centered about zero,

IF you trigger on only one transition... and examine level shortly after that trigger..

A positive pulse has, shortly after its positive transition, a positive value
A negative pulse has, shortly after its positive transition, a zero value

Sounds like a setup for an edge triggered monostable delay (74123 or 555) and D flip-flop(7474?).

It's late - sanity check me please..


I see half of your idea. How would you avoid that the falling edge of a positive pulse trigger the monostable as a negative pulse?
Two monostables, one trigger on rising edge, one on falling. They both are hooked up so that they don't respond to anything if any of them are in unstable state. If the monostables reminds in unstable state for 50us, then they would ignore the edge following close after the last edge. Hence ignore 2nd edge of pulse.
This sounds like something that could work?
 
  • #35
Edge triggered in my day meant it triggers on either a rising or a falling edge but not both.

Consider a negative going pulse.
Signal starts at zero, transitions negative to a non-zero value and holds a while, then transitions positive back to zero.
Just after its positive transition it has value zero. So if we look at it then and find zero, we know it was a negative pulse. We can ignore its negative transition

Positive pulse :
Signal starts at zero, transitions positive and holds a while then transitions negative back to zero.
Just after its positive transition it has value not zero. So if we look at it then and find nonzero we know it is a positive pulse.

That's the simplest, to look at transitions one direction only, but with your varying levels might be error prone.

Your dual approach is probably better -
with two data bits you can establish four states:
positive pulse,
negative pulse,
no pulse at all,
and 'error' or indeterminate.

Here's the sort of building block gizmos we had in my day:

http://www.ti.com/lit/ds/symlink/sn74123.pdf

http://www.electronics-tutorials.ws/waveforms/monostable.html

http://www.learnabout-electronics.org/Oscillators/osc45.php

old jim
 

Similar threads

Replies
20
Views
1K
Replies
19
Views
2K
  • Electrical Engineering
Replies
29
Views
3K
  • Biology and Medical
Replies
6
Views
434
  • Electrical Engineering
Replies
10
Views
2K
Replies
47
Views
3K
Replies
2
Views
2K
  • Electrical Engineering
Replies
6
Views
1K
Replies
3
Views
4K
  • Electrical Engineering
Replies
1
Views
3K
Back
Top