Speedometer, etc

Getting ready to build a controller for a model locomotive.

Among other things, need to continuously monitor the speed. Will probably put a Hall transistor near an axle, with a magnet(s) on the axle. At the same time, need to use the calculated speed to calculate the acceleration. The end result is to simply have an eight position throttle. Putting the throttle in any position would make the loco slowly and smoothly accelerate to the speed associated with that throttle position.

I'm an Arduino virgin, but have worked with and programmed many other computers along the way.

Can I set a counter to simply count Hall pulses from an interrupt, and do other chores between pulses?

Or is this asking too much?


You can use interrupts (pins 2 and 3) to trigger a count. You can use micros() to measure microseconds between interrupts to calculate frequency or use a timer to measure interrupts per time interval to calculate frequency. Between interrupts you have lots of time to do other things.

Thanks, John