I am trying to make a digital dashboard for a motorcycle using a Raspberry Pi, a display and some sensors.
I am using this speed sensor.
When I put the sensor on the axis of the motor wheel and run the engine, it shows random values even if the wheel is fixed and not turning.
The magnetic field generated by the engine and the alternator is affecting GPIO value, so I am trying to move all that noise from the signal. I added a low pass filter.
The maximum of speed is 120km/h so the frequency should be at maximum fmax= S / ( R x 2 x Pi), S is the speed , R is the tire radius.
In my case fc = 13.71 Hz and (fc = 1/(2 x Pi x R x C))
The capacitor used is a 22uF 40V and the resistance R= 530 ohm.
When running the engine the GPIO pin is still detecting noise and is reading like 10 pulses per second. Would it be better if I add an LC low pass filter?
This is the electrical diagram of the sensor and the opotocoupler 4n25.
Can someone please tell me how to do the conditioning for this type of sensor?
The idea of adding a low pass filter comes from this video tutorial at min 5:41.
He made his own dashboard and it is on sale so the low pass filter should do the work and filter all that noise.
If nothing is wired (the Raspberry is supplied by the power supply so the Raspberry is totally isolated from the sensor and the engine's battery) and I run the engine and the GPIO is configured as pull up and an interrupt so it is conected to an internal pull up, it detects nothing but if I just add any type of wire (just simply to add an external pull up resistor without even connecting the sensor's output to the GPIO) the wire acts like an antennae and detects all the noise coming from the engine and the alternator. I tried also with the coaxial cable and got the same thing. The problem comes from the GPIO.