How to shield Hall effect sensor from unwanted magnetic field

I have a Hall effect sensor mounted to the engine that measures the RPM of the spinning engine shaft. One face of the sensor faces the engine, while the other side faces away from the engine (towards the disk with magnets mounted on the driveshaft).

I've discovered that the electro magnetic field generated by the ignition system firing interferes with the hall effect sensor (if I run the engine with the sensor but no disk/magnets, the sensor still reports ~200 RPM @ idle (~1900RPM). I know it's the ignition that's causing this since as soon as I cut the power to the ignition, the RPM drops to 0 instantaneously.

Is there a way to shield the hall effect sensor from any magnetic fields coming from the engine? I thought about creating a "wall" made of aluminum foil between the sensor and the engine.


This could be a grounding problem. The ignition system could introduce a peak throughout the whole system. I'm thinking in the direction of an electrical pulse that is picked up by the wires of the hall sensor.

Is it a hall switch ? Those are not very sensitive.
I mean a hall sensor with high/low output, and not a hall sensor with analog output.
Aluminum foil won't help against a magnetic field. And I would prefer a copper foil, that can be soldered to, to connect it to ground.

Keep the wires to the hall sensor away from the ignotion wires and other wires. Don't connect a wire to ground near the hall sensor. Use a shielded cable if possible.

How are the hall sensor wires connected to the measuring device ? Is it connected to ground in a bad way ?
Can you measure what kind of peaks are received, perhaps a simple RC filter is enough to get rid of them.