ABS wheel speed sensor - measuring vehicle speed


I’ve been working on my own datalogger lately. I’m using an arduino uno, together with a BMP085 pressure sensor and a LPR530AL gyro sensor.
The goal is to measure height & angular velocity from the rear wheels in a ford fiesta R2. I’ve set up the arduino with both sensors and the program is working fine.

I’m using this data together with the data from the car’s ECU to put up a measurement of the different energy states in the car (Kinetic energy, potential energy…)
However, in order to synchronize the data from the ECU with the data from the arduino, i want to attach the ABS wheel speed sensor from the car to the arduino. This way i can read the wheel speed from both the ECU and the arduino, so i can put them next to each other with the rest of de data from the arduino (heigth, angular velocity).

I’m having quite the trouble getting a conclusive speed value on the arduino.
The signal from the ABS sensor (a 2 wire Hall effect sensor) is shown on the screenshot from an ossciloscope below. The frequency of the signal is then used to measure the speed.

When the wheel is standing still, it gives a 0V signal towards ground, when its spinning the signal is at 0.9V.
I need to count the pulses and deduct the frequency of the signal in order to define the wheelspeed… I just don’t really know how to do it.

Should i use an intterrupt and an internal counter on the arduino uno? Or is there an other way to do this?
Anyone has any experience with programming this kind of setup? I know the basics in arduino but i’m having a lot of trouble understanding interrupts & timers… If i can count all the pulses per second, i can deduct the distance traveled per second, thus the speed in m/s. (I don’t know yet how much pulses are in 1 wheel revolution, have to take the wheel apart for that. For now i’m just trying to get a pulse counter working…)

Thanks for your help

tm5.bmp (192 KB)

tm2.bmp (192 KB)

tm5.bmp (192 KB)

tm8.bmp (192 KB)

You need some signal-conditioning. Firstly a low-pass filter is needed to remove all the spikes and noise - this filter should have a roll-off about 3 or 4 times higher than the max frequency of pulses I guess.

Secondly the amplitude is very small (I wonder why - normally such a signal would be logic level). Given that there might be offset voltages that change I’d suggest using a high-pass filter at or below 1Hz to remove any DC bias, then low-pass filter to remove the noise, then put the output into a comparator. Something like:

The initial 10k/15nF gives a 1kHz low pass, the 3u3/100k a 0.5Hz high-pass (dc-blocking). The diodes protect against grossly overvoltage inputs. C is any open-collector 5V-compatible comparator, such as 1/4 of LM339

The only issue with my circuit is that it could generate random noise when there are no pulses coming in.

Is it really necessary to filter my signal, even if my only goal is to count rising/falling flanks? or would the offset voltages ruin my signal and make the arduino think it's a pulse?

And what's the exact use of the comparator?

I tried a couple of pulse counting programs i found on the internet, none of them are working so far... I can't seem to get a pulse acknowledged on the arduino, however when i attach a voltmeter to the signal and turn the weel, i can see a slight change in voltage from 231 mV to 224 mV and back...

Appreciate your help!


P.S. : At first i soldered a wire on to the wrong sensor wire (not signal wire), now i have one on the signal wire too, but the old one on the other wire is still there... Maybe it's reacting as an antenna causing all the filth on my signal?

I have written a little program to count pulses, can anyone tell me if there’s something wrong with the program? It compiles perfect but when i upload it and insert the sensor in digital input 2 , I just can’t seem to get it working. No pulses are counted when i spin the wheel…

Edit: i don’t know how to put the code in a little window inside my message, so here it is (sorry for inconvenience):

#include <avr/interrupt.h>

volatile int pulsecounter = 0; // variable to count pulses
void setup(){
pinMode(2, INPUT); // Make digital 2 an input, digital pin 2 is interrupt pin on arduino uno
digitalWrite(2, HIGH); // Enable pull up resistor

// attach our interrupt pin to it’s ISR
attachInterrupt(0, snelheid, FALLING);

// we need to call this to enable interrupts


// The interrupt hardware calls this when we have a falling pulse
void snelheid(){

void loop(){
// if pulse is triggered
if(pulsecounter > 0){


Pulsecounter.ino (701 Bytes)

Jasperdavid: Is it really necessary to filter my signal, even if my only goal is to count rising/falling flanks? or would the offset voltages ruin my signal and make the arduino think it's a pulse?

If you want to simply read the signal via a digital pin, yes you do need proper conditioning. If you assign an analog pin you'll have to do the equivalent conditioning in software - and be aware that you'll be sampling at 10kHz at most in the default setup. Simple hardware low-pass noise filter will help either way.

For the analog pin route you need the signal to be in 0 to 5V range of course (the hardware conditioning could be made to work on the automotive 12V rail - so long as the comparator output pull-up stay at 5V)

Ok thanks man, the signal is 0.9V above ground, so i think i'll try the analog pin route. You have any idea how i can software condition the signal? If that doesnt work i'll try to make the hardware config...

Appreciate it!

You should give the hardware way a try first. The less your arduino card do to clean the signal, the more features you can to your program…

I’ve previously thought about a similar feature (being able to measure the speed based on a hall effect sensor). One of my lead was using a frequency to tension converter. Thus, no need to deal with interrupts, just have to read an analog pin.

Hey guys,

Instead of trying a hardware configuration, i just bought a coax cable so normally there is no more noise on my signal. However, when i use interrupts (see code above, anyone who notices any mistakes please let me know!) i still don't get a correct pulsecounter. Sometimes it counts a couple of pulses (most i had was 8, but it should be a lot more), most of the time it doesn't respond at all. Does anyone have any suggestions?

Appreciate it!

Hello Did you manage your project ? I am working on a similar one

Thank you, Pm