Go Down

Topic: Speed Measurement 0 to 12 km/h (Read 528 times) previous topic - next topic


Ardunio Uno
I wish to measure the time in milliseconds between the operation of 2 reed switches [ 100 mm apart] when they open ( not close ) as there is very little bounce then.
Do I use unsigned long millis() to measure the time between SW1 & sw2 .
Or is there a way to use interupts?
I would be grateful for any help as this is my first project with a uno.
Regards, John Chappell


The basic idea is fine. You could use the two external interrupts, but it would probably work very well just to poll two inputs. 12 km/h is 3.3 m/s, so the shortest time between switch openings is about 100 milliseconds (a long time for the Arduino).

How do you plan to hold the switches closed, and what opens them?


Hi JR,
A magnet keeps the reed sw closed and the rim of a steam loco interupts the magnetic field. IE to measure speed of train.

Go Up