# Noisey signal from EDIS car ignition .

I'm currently working on a nano project to run an EDIS 4 ignition module.

If you don't know a ford edis module sorts out all the hard parts of reading and processing a flywheel sensor and sorting the sparks out . All you have to do is tell it how far to advance the sparks.

Problem is the signal from the EDIS can get quite noisy even with shielding and filters so I have done this small bit of code to see if I can reduce false readings

The pulse from the edis is up to around 200hz square wave and I need to know when the pulse is falling . So to make sure I get the correct wave and not an oddball spike i've looked for 3 high readings and then counted the output on the next fall ( the rpmcount) . I'm hoping that the checks at 3 separate times will ensure i'm on the top of the square wave and not a random spike.

Is this going to work? , please note my code skills are pretty poor at the moment as i'm learning this for the first time.

{

{delayMicroseconds(150); int reading = digitalRead(PIP_Pin);int z=1;} // delay to check definate pulse
{delayMicroseconds(150); int reading = digitalRead(PIP_Pin);int z=z+1;} // delay to check definate pulse
{delayMicroseconds(150); int reading = digitalRead(PIP_Pin);int z=z+1;} // delay to check definate pulse
if (int z=3) // adds up all 3 definate pulses to eliminate chance of noise giving false pulse
{rpmcount++;}
int z=0;
}

You really, REALLY should action the pulses from the EDIS as interrupts rather than just trying to read the pin.

The best way I've found to do the filtering is with a simple high pass filter within the interrupt. Here's a slightly simplified missing tooth decoder I've written that I have run on EDIS systems with good results:

``````void triggerPri_missingTooth()
{

curTime = micros();
curGap = curTime - toothLastToothTime;
if ( curGap < triggerFilterTime ) { return; } //Debounce check. Pulses should never be less than triggerFilterTime, so if they are it means a false trigger. (A 36-1 wheel at 8000pm will have triggers approx. every 200uS)
toothCurrentCount++; //Increment the tooth counter

//Begin the missing tooth detection
//If the time between the current tooth and the last is greater than 1.5x the time between the last tooth and the tooth before that, we make the assertion that we must be at the first tooth after the gap
targetGap = (3 * (toothLastToothTime - toothLastMinusOneToothTime)) >> 1; //Multiply by 1.5 (Checks for a gap 1.5x greater than the last one) (Uses bitshift to multiply by 3 then divide by 2. Much faster than multiplying by 1.5)
if ( curGap > targetGap || toothCurrentCount > triggerActualTeeth)
{
toothCurrentCount = 1;
toothOneTime = curTime;
}

toothLastToothTime = curTime;
}
``````

If you set triggerFilterTime to something less that your maximum time between pulses, then it will filter out a lot of the noise.