mathematical brain fart

I’m trying to figure out the speed of rotation of a wheel using a Hall Effect sensor. Here is what I know:

I have 3 magnets spaced evenly on the wheel (71mm apart around circumference of wheel)
The hall effect sensor is working and counting (tested)
Their are 1,609,344 mm in a mile
1000 ms in a second (everyone knows that)

I just can’t seem to figure out the formula…

I have arduino counting each time it senses a magnet and incrementing each time a magnet passes. So I know the hardware is correct.

all I need to figure out, which I’m having trouble with, is the formula to calculate mph based on magnet spacing, etc… [smiley=undecided.gif]

You need to know the circumference of your wheel, then you do Circumference of the wheel * rpm of the wheel, you only need one magnet to do that and no three.
Read this:
http://www.arduino.cc/playground/Main/ReadingRPM

You measure the rpm of your wheel and then multiply by its circumference.

float mph(unsigned long interval) {
      float distanceM = 0.071; //71cm
      float ms = distanceM * (1000 / (float)interval);
      float mph = ms * 2.23561;
      return mph;
}

My initial thought. NOT TESTED AND PROBABLY NOT CORRECT
[edit]The interval should be in milliseconds between each detected magnet[/edit]

As Senso says you don’t need three magnets (unless for some reason you need much higher resolution).

Is this wheel on a vehicle with tyres? If so you should calculate the circumference based on the “rolling radius”, IE the distance from the hub to the ground which is not the same as measuring from the hub to anywhere else on the tyre because it will be compressed a little or a lot depending on the pressure in the tyre and the weight on it.


Rob