Opto isolator works fine on bench, noisy in deployment

I have an optoisolator on a board with the Arduino to read engine pulses.

I build another circuit to simulate RPM pulses, and it reads well and smooth. However, when placed in the engine bay the rpm readings would jump all over the place.

I'm trying to figure what i can do to clean up the signal. It's connected to the Coil on plug signal wire (5v) and i'm using 220 ohm resistor on the opto. Also tried a 100nf ceramic across the input of the opto.

Untitled.png

If the noise is on the LED side of the photocoupler, what do i do? I intend on adding a 150K resistor across the pins on that side.
What if noise is biasing the transistor? how do we fix that?

Untitled.png

I'd guess the "real" RPM pulses are not "clean" or simply not what you expect.

The signal from the coil is unlikely to be clean as it “rings”’when switched , plus if the car is running a distributer there will be some scatter around the switching point .
Best thing would be to use a toothed wheel on the crank with an inductive proximity sensor.

Google “ triggerwheels”

If indeed you are inputting from an engine coil primary you should google “engine coil voltage” or similar. You will find the voltage is quite different that one might expect.

One of the first things you need to do is to put a diode across the opto input LED in the reverse direction. This is to protect the input LED from reverse voltage when the coil “rings”.

However, I am confused on your statement

connected to the Coil on plug signal wire (5v)

. So maybe I don’t understand your application and the above is irrelevant.

Would be better if you could explain more about your system. Also the wiring lengths and location of the opto and arduino relative to the “vehicle?”.

JohnRob:
If indeed you are inputting from an engine coil primary you should google “engine coil voltage” or similar. You will find the voltage is quite different that one might expect.

Yes, I know all about that. I’m a tuner. I’m picking up from the injector or the coilpack

One of the first things you need to do is to put a diode across the opto input LED in the reverse direction. This is to protect the input LED from reverse voltage when the coil “rings”.

I had this in place, for some reason it would cause misfire on the car.

However, I am confused on your statement . So maybe I don’t understand your application and the above is irrelevant.

Would be better if you could explain more about your system. Also the wiring lengths and location of the opto and arduino relative to the “vehicle?”.

Reading engine speed, the arduino was placed in the engine bay as i’m reading other things as well. Saving on wires.

But HEY i got it solved. I first placed a resistor between the LED side (10K)…that didn’t work
I then placed a 100nf cap on the output side and that did the trick so well I am still in disbelief! Wow! I even removed my little “software filter” to smooth out the readings. I hope if anyone should run into this issue the will find that those little ceramic dudes are more important than they look! haha.

Capture.JPG
[adding c5 did the trick]