# How to use Interrupt() corretly

Hey, guys.

I'm working on a project and I need to measure the speed of a baja vehicle. The best and inexpensive way I found to do this is to use a reed switch right in front of the wheel's axis (with a magnet attached on it). That way, arduino can process the number of pulses it sends and calculate the speed. The problem is: how to do that? I found some tutorials out there but nothing really effective about interrupting functions.

I'd appreciate if you guys could help me to develop this code or to find some tutorial that teaches how to use Interrupt() correctly or another way to do this using this system. Thank you!!!

If your wheel is turning at less than 1,000 RPM you don’t need to shouldn’t use interrupts. Just count the number of pulses in a given time and multiply by the circumference of the wheel. Look up ‘state change detection’.

Most of the rpm measurement/speedometer projects use a Hall sensor rather than a reed switch, because is no mechanical switch bounce to deal with and they are quite fast.

I have successfully used the Hamlin flange mount 55140 or 55100 series in some projects. A good source for strong magnets of all shapes and sizes is: http://www.kjmagnetics.com/ You will need to mount the magnet so the polarity is correct for the Hall sensor. Some Hall sensors are activated by facing a south pole, and other by facing a north pole.

Henry_Best: If your wheel is turning at less than 1,000 RPM you don't need to shouldn't use interrupts. Just count the number of pulses in a given time and multiply by the circumference of the wheel. Look up 'state change detection'.

I agree except that it is easier to measure the time for a given number of pulses.

...R