# Creating a Filter (with difficulty...)

Discussion in 'Mathematics and Physics' started by Bill Lohman, Jul 31, 2015.

1. ### Bill LohmanNew Member

Joined:
Jul 31, 2015
Messages:
5
Likes:
0
I am trying to condition a signal output from an engine ignition system to use as an input for an engine detonation monitor. We have determined that the rapid double pulse that the ignition system is generating is confusing the detonation monitor, so I need to filter the (double) pulsed output into a single pulse.

Presently I have two pulses occurring ~218μS apart. This repeats itself at a ~1mS interval (endlessly) as a "waveform". The pulses are around 85 VDC (with some minor variation). My idea was to introduce a capacitor into the circuit which would charge without added impedence, but would discharge through a resistor giving me a very vertical charge and a much flatter discharge when looking at it on a scope. My hope was that, by the time the second pulse strikes, the flattened decay from the first pulse would be very close to the peak of the second pulse (and thus look more like a sort of flat-topped pulse with a gradual decay. I have roughly 780μS, after the second pulse's peak, for the entire charge to decay back to 0VDC.

My present pulses have the following characteristics: ~10μS charging time, ~85 VDC peak, ~50μS decay time, ~150μS at 0VDC then followed by a second (nearly) identical pulse. Peak-to-Peak of the two pulses is 218μS. Once the second pulse decays to ~0VDC (~260μS from the leading edge of pulse #1), the balance of 1mS passes (at 0VDC) and then the whole process repeats itself.

I put together a little filter based on my calculations which yielded no notable effect on the output. So I decided to try much larger components to see if I could get a better effect (and pretty much tossing calculation to the wind). I'm attaching a drawing of my filter and a capture of the output waveform. The drawing is pretty self explanatory. The capture consists of: Top waveform (A) is output signal from ignition system (entering filter); Bottom waveform (B) shows output signal (post filter).

Based on the values of my components (3.2μF capacitor (50V), and 1MΩ +/-5%), and using T=RC, I calculated my time constant to be 3.2 seconds (which would roughly yield 99% discharge in 16 seconds!). But what I observed on my waveform was a quicker decay that was much flatter than the input signal, but only decayed for about 200μS (not even close to the 3.2 seconds calculated). I should add that the load device's electronic input, which my filter's output will feed, is very high impedance (but I don't know how to factor that into this equation - or if it matters, except for with respect to the amount of discharge current that will be passed from the output). Further, after I had the scope readings, I went back to the T=RC equation and I substituted real values and omitted R first, and then C, and recalculated to see how those equations came out. I set T=~44μS (allowing that full discharge time is roughly equal to 5T - my measured peak to peak was 218μS, so I just went with that as the discharge time - I know it's off a tad). With T=44μS and R=1MΩ, C was 44nF (I had 3.2μF installed...). And with T=44μS and C=3.2μF, R was 13.75MΩ (I had 1MΩ installed).

So I'm wondering why the big discrepancies between calculated and measured values (and I'm reasonable sure load impedance [so thus, current] is the key here, but I just can't find anything to help me to interject that into my equations). Please bear in mind that I'm an electrician with enough knowledge to be dangerous - not an engineer, so this is kind of on the fringe for me. I'm know that, since I can substitute different resistance or capacitance values, insert my desired time constant value, and then solve for the missing variable, I can come up with a wide array of (let's say...) resistance values that I can calculate corresponding capacitance values for. But how to I go about choosing which combination to use? (and herein is where I think the current part comes into play, but I can't find how to use that)

File size:
821.5 KB
Views:
125
File size:
705.6 KB
Views:
125
2. ### MikeMlWell-Known MemberMost Helpful Member

Joined:
Mar 17, 2009
Messages:
11,211
Likes:
569
Location:
AZ 86334
What happens to the double pulse train as the engine rpm changes?

3. ### Tony StewartWell-Known MemberMost Helpful Member

Joined:
Aug 31, 2012
Messages:
3,152
Likes:
282
Location:
Richmond Hill , ON Canada near Toronto
This is proof of concept only of a Pulse "swallower" as they are called.
85V pulse is attenuated for either 5V or 15V logic (CD4xxx) and squared up and inverted with a Schmitt Trigger.

The Input trailing edge is now rising edge and triggers a Monostable or 1-shot.
The Q output drives the transistor to clamps the 2nd pulse to ground for about 250us after the trailing edge.

If it is the 85V pulse you need to drive the analyzer, then move collector to input.

I dont see any difference in detonation. why is that?

Last edited: Jul 31, 2015

Joined:
Jan 12, 1997
Messages:
-
Likes:
0

5. ### MrAlWell-Known MemberMost Helpful Member

Joined:
Sep 7, 2008
Messages:
11,057
Likes:
963
Location:
NJ

Hi,

Is that first pic a picture of the pulse before it is filtered and after it is filtered, or what?

If you have two pulses close together you might try a simple low pass filter. Your filter is close to this, but it needs an input resistor. The input resistor together with the capacitor make up the time constant, which is R*C. So with R=100k and C=10uf, you get a 1 second time constant.

If you have a second real pulse coming in later, you need to keep the RC time constant low enough so that it can work on this new pulse too, but at the same time absorb the second unwanted pulse which comes in much sooner.
This means you have to adjust the RC time constant somewhat.
If you show a scope pic of your actual pulse without any filtering, and any pulses that come after that for say two or three cycles, we can come up with something.
What we also need to know here is what is the shortest time the next real pulse will come in at because that helps put a limit on the time constant value. If the dual pulse comes in after 200us and the next real pulse comes in after 1 second (and that is the fastest it will ever come in) then we know what the RC time constant must be. If the dual pulse comes in at 200us and the second real pulse comes in after 0.5 seconds, then we need a shorter RC time constant.
So it is a tradeoff between absorbing the offending dual pulse while still letting the next real pulse be recognized.
A series resistor, parallel resistor, and diode would help here as that would allow us to set the charge time and the discharge time to whatever we wanted it to be.

6. ### Tony StewartWell-Known MemberMost Helpful Member

Joined:
Aug 31, 2012
Messages:
3,152
Likes:
282
Location:
Richmond Hill , ON Canada near Toronto
Filtering might detract from the ignition analyzer functions.

7. ### Tony StewartWell-Known MemberMost Helpful Member

Joined:
Aug 31, 2012
Messages:
3,152
Likes:
282
Location:
Richmond Hill , ON Canada near Toronto
Some 1shots also have negative edge triggering, so the inverter is not needed.

8. ### Bill LohmanNew Member

Joined:
Jul 31, 2015
Messages:
5
Likes:
0
Mike...the time spacing remains fixed regardless of engine rpm, although in the real world this monitor will almost never see a variation in RPM (as the engine always stays constant) and it ignores monitoring until we are at target rpm.

9. ### Bill LohmanNew Member

Joined:
Jul 31, 2015
Messages:
5
Likes:
0

Last edited: Aug 5, 2015
10. ### Bill LohmanNew Member

Joined:
Jul 31, 2015
Messages:
5
Likes:
0
Al... that picture is showing the waveform before and after my filter (top is unfiltered, bottom filtered). I was in essence trying to do what you've described, but I moved my resistor past the capacitor so as to only affect the discharge time. Maybe that concept is just off... so I'm going to try just a true-blue RC low pass filter built in the traditional sense to see what it yields. Because of the nature of this device, timing is pretty critical, so I was afraid putting the resistor ahead of the capacitor would start sliding me in the time window. My original design incorporated a diode also (just not the second resistor you mentioned because I didn't want to time the charge - I just wanted it to charge as fast as it could).

Hope that makes sense.

11. ### MrAlWell-Known MemberMost Helpful Member

Joined:
Sep 7, 2008
Messages:
11,057
Likes:
963
Location:
NJ
Hi,

Yes it does make some sense, but what is driving that cap then?
Sometimes you have to have a buffer between, and that wont slow anything down.
For example, have the input turn a transistor on and off, and then the output of the transistor can be used for the filter drive signal.

12. ### Bill LohmanNew Member

Joined:
Jul 31, 2015
Messages:
5
Likes:
0
MrAl... That is exactly what I'm ending up doing. I'm using the double pulse to switch a mosfet (actually 2, because I need to first switch an N-channel [positive gate], so I can switch a P=channel [positive source])... but it's working (almost). What I've ended up with is a sort of round humped stair stepped additive pulse. I'm going to add to the resistance of the charging circuit today and I think that should get the charging ramp more or less linear...just have to play around with the resistance values. I ordered some pots because I'm tired of switching out resistors on my breadboard.

Thank you all for your great suggestions. I love this place.