Go Down

Topic: Messure RPM width interrupt problem (Read 6642 times) previous topic - next topic


Hi First post here
Must say arduino is great for special thing in a car. :-)
But got a problem messuring RPM, i need to messure absolutly perfectly. at the messuring is used to control an injectingpump.

i use attachInterrupt(2, rpm_fun, RISING); have also tryed high low falling. non seams to work great.

i messure almost 10 times as many pulses as i should. and the PRM is flagging from 200 RPM 1000 RPM when is is actually running 700 RPM.

I think the problem is in the signal i get from the car. as i have messured RPM perfectly from other cars, width no problem.


Any idea what to do width this signal before it goes in the board ? maby some extra components is needet ?

Any help GREATLY appriciatet.


No shure the the link was working here it is.



It seems there is noise on the line, you need a scope to confirm that.

You can adapt the code of the IRQ to handle noise to certain extend. If you know that #pulse per second is e.g. max 50 you can use the following trick. Check if the last IRQ is at least 20 millis ago. SOmething like this:

Code: [Select]

volatile uint32_t last;

void IRQ()
  if( millis() - last > 20)
    last = millis();
    // do your IRQ things here

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)


Hi Rob
thanks for a suggestion. its a good idea, but the problem is that when the engine is running full speed its almost the same as the noise when idle, 700 RPM idle 6000 RPM max. you see the problem,
I think i need some hardware before the signal goes in to the interrupt pin on the arduino. but no idea what to use, any help from you hardware guys :-) 


but no idea what to use

First off, I'd use an oscilloscope.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.


I have used an oscilloscope, here is the signal i need to detect.


it gives me almost 10 times to many signal. and i have a common ground, on the board and the car.


shouldnt two (one ?)diodes in series take care of that ???


Yes it did, the voltage drop takes the lover part away. Thanks. But got a new problem when i drive my mosfett i have interference, on the interrupt same frequence as my pwm. I run the board from usb power, and the mosfet from car. The arduino board and mosfett has common ground?



Are u taking the signal directly from the crank sensor on the car, or the output for RPM which is given by the engine control module??
If you are taking the output from a sensor, what sensor is it? Hall-effect or variable reluctance??



The problem may the very slow rise/fall times of that signal (very slow means more than about 1us for logic purposes!!!)

If there is high frequency noise on the signal it will cause multiple triggering.  The 328 chip has a small amount of hysterysis on its inputs but I am guessing this is not enough.  A schmidt-trigger logic gate is needed to 'clean up' the signal and prevent multiple triggers.  A 74HC14 hex-inverter chip for instance - this will be resistant to noise of several volts magnitude and the output switches fast and cleanly whatever the input does.

Another problem might be signal reflections from the leads and EMI pickup - this can be reduced by using an RC low-pass filter in the input before the schmidt trigger gate - say 10k in series with the input to 1nF to ground.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]


To Nishad :
The sensor is an inductive type a coil width a magnet in the middle, and metal running by, and i want to be able to read this signal, as i dont have this computer in the car where the engine goes,

To MarkT :
Thanks alot for hopfully some great info, Just ordert some 74HC14 hex-inverter chip, this sounds just like what i need, lets hope. and i will try out the RC low-pass filter. to see if this helps.

I get back width info when i have tried it out.  THANKS


you may bre able to get a cleaner signal from an injector wire, or from the wire that triggers the ignition coils

ht leads are noisy by nature and you may need to use something other than an inductive pickup

you may need to halve the signal on a 4 cylinder car if it is running wasted spark


There is no ignitions wires as it is a diesel, the only thing i got is the RPM sensor.
The Diesel injection pump controlling the amount of diesel injectet by a PWM signal.
It is a 3,0 L mercedes turbo Diesel engine witch can give 400 HP, width the rigth turbo and amount of diesel.
Thats why i am focused on getting a clean signal,

I got the 74HC14 hex-inverter chip today and now ready to some test on the car. get a totally square signal now from a PC blower i used to test it

By the way i have many ways of killing the engine, as we dont want a 400 HP runaway engine.


If you are interested you can see the previous test here


Jun 12, 2011, 01:09 pm Last Edit: Jun 12, 2011, 01:13 pm by GlitchBoy Reason: 1

To Nishad :
The sensor is an inductive type a coil width a magnet in the middle, and metal running by, and i want to be able to read this signal, as i dont have this computer in the car where the engine goes,

I just went through this same thing reading RPM off my car from the crank signal, which is also a reluctance sensor.  Since this signal is AC and, at least on my car, has an output range from <1v to over >40v) you may need something like the LM1815 chip to convert its signal to something an Arduino input can reliably read.

Go Up