Pages: [1]   Go Down
Author Topic: How to use Interrupt() corretly  (Read 150 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!!!
Logged

London
Offline Offline
Edison Member
*
Karma: 46
Posts: 1416
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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'.
Logged

Offline Offline
Full Member
***
Karma: 11
Posts: 140
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

UK
Offline Offline
Tesla Member
***
Karma: 121
Posts: 6923
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 619
Posts: 33961
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

How about this
http://www.engblaze.com/we-interrupt-this-program-to-bring-you-a-tutorial-on-arduino-interrupts/
Logged

Pages: [1]   Go Up
Jump to: