Electronic – Spark plug cable firing interrupts

emi-filteringinterrupts

I am building an electronic tachometer for an old motorbike (a moped).

For RPM monitoring I have come up with a solution of painting part of magnet black and using a TCRT5000 reflective sensor which is fed to a LM393 comparator which finally drives an interrupt pin on an ESP32. A DAC pin from ESP32 is used to set the LM393 threshold as a means for sensitivity control. There is about 100 – 150 cm of cable which needs to be routed more or less near the spark plug wire to the handlebar. The circuit has its own power and is isolated from the motorbike. For completeness: the motorbike has an induction coil and contact breaker. The spark plug cable is strained copper about 20 cm long.

The problem is that when the engine runs there is so much EMI from the spark plug and its cable that it causes countless interrupt firings. The interrupts happen only when the cable is connected to the pin. I am using a 3 x 0.08 mm microphone type cable with the shield connected to ESP32 ground and not used for communication.

So far I made the following improvements with limited success:

  • a low pass filter at 300 Hz (R = 5.1k, C = 0.1uF) at the
    microcontroller side
  • changed 10k pull up at the comparator output to 1k
  • added two 1N5819 Schottky suppression diodes at the microcontroller side
  • wrapped the spark plug wire with household aluminium foil, connected to motorbike chassis (this to my surprise helped quite a
    bit)

I am looking for practical solutions to my problem: preventing EMI propagation at the spark plug wire and shielding at the data cable. The space inside the motorbike compartment (where the sensor is located) is very limited so a more complex circuit cannot be put there (like a differential driver). Also, the spark plug cable cannot be changed nor relocated. Any other idea is basically doable. What are the best practices, which type of cable is to be used, etc. I am not an expert in electronics so I would be happy if answers included sources to allow me to further study the matter.

For the record: the setup is tested on the bench with an electro motor and at around 8k RPM still works as intended. I am unfortunately unable to include an oscilloscope measurement image as I do not own one. I hope an expert in the field can guess pretty well what is happening inside the cable.

Thank you in advance!

Motorbike setup

Schematic

Suppression diode idea taken from here:
https://www.digikey.com/en/articles/techzone/2012/apr/protecting-inputs-in-digital-electronics

Motorbike's technical book with electrical scheme (unfortunately Slovene):
https://www.google.si/url?sa=t&rct=j&q=&esrc=s&source=web&cd=10&ved=2ahUKEwjH7fXeg6PhAhVx-ioKHXaoDZQQFjAJegQIARAC&url=http%3A%2F%2Fwww.obnovi-si.si%2FSlike%2Fkatalogi%2FKatalog%2520rezervnih%2520delov%2520Tomos%2520Apn%25204.pdf&usg=AOvVaw2RTRIM5KcCoMEm13dPCL8S

Cable (unfortunately German):
http://www.produktinfo.conrad.com/datenblaetter/600000-624999/608065-da-01-de-MIKROFONKABEL_3_X_0_08_MM2.pdf

Edit 09/04/2019:

I was finally able to measure what is happening within the cable with a cheap usb scope. I am surprised that the signal going to the comparator is actually very clean, yet the interrupts fire randomly. The picture shows the non inverting input on the comparator.

enter image description here

Best Answer

Without knowing the type of .1uF capacitor you are using in the low pass filter, I would suggest adding a lower value ceramic cap in parallel with the .1uF cap, similar to the 100nF cap that is in parallel with the 1uF cap on your Vcc bypass.

The noise from the spark is wideband, extending into RF. Capacitors have parasitic series inductance that becomes important at high frequencies. Most capacitors will typically act as inductors at a high enough frequency, and the transition typically occurs at higher frequencies for smaller, lower value capacitors. Parasitics vary widely depending upon the capacitor construction.If you click on a capacitor type at this link, you will be able to select parts, compare their frequency response and download their spice models.Kemet has a tool for modeling their capacitors