Please note: Currently trying to set up a hall effect sensor for the wheel speed of a car. Eventually we will have discs with teeth to produce a good signal but currently just using a lump of metal and mr arm to generate the signal. Using UNO R3

So what I have so far is a hall effect sensor that outputs an analogue signal and I have managed to read this and convert it to a 1 or 0 stored in a variable "hallval". The led part is just so I can see it working.

what I would do is: connect the signal of your hall effect sensor to one of the interrupts of the arduino. Make a interrupt routine that increments a variable every time the routine is called. In the main loop subtract the value of the variable 1 second before from the current value of the variable. Then you have the number of pulses per second. Now you can calculate RPM or the time for one revolution.

Note that hall effect sensors come in different 'flavors'. Yours appears to be one that outputs a analog voltage relative to the magnetic field strength being sensed? Others come as simple digital switches that out either a logic high or low depending on if the magnetic field being sensed is above or below a specific value. A digital hall sensor would be better to use as a speed detector as you can easily interface it as a interrupt and use timers to keep track of the last change of signal to the next change of signal and then calculate the speed based on the delta time passed.

Now what I do not understand is how a hall effect will work with just metal gear teeth? A hall effect senses the strength (and in some cases the polarity) of a external magnetic field. Unless the gear is magnetized I don't see where there is a magnetic field to be sensed in your application? There are speed sensors that are designed to just sense gear teeth, called variable reluctance sensors that work on a different principle as the magnetic field is generated internal inside the sensor and the rotating teeth effect the magnetic field and is sensed by the internal circuitry of the speed probe. Perhaps a link to the sensor you are using will verify if it's best suitable for your application?

sorry quick reply but this is the datasheet, we have used this on a previous car for some testing although we believe it is too slow for the higher speeds

http://sensing.honeywell.com/index.php?ci_id=50300

Interesting sensor. It's not a pure simple hall effect sensor as it has an internal magnetic field generator that 'biases' the sensor such that rotating teeth will effect the field. It's also outputs a pure digital signal so you should not be reading it with a analog input pin using a analogRead() statement, but rather read it as a digital input signal using digitalRead() commands or better yet learn how to use the user interrupt functions on the arduino using digital pins 2 or 3 (on a Uno) board.

As far as maximum speed capabilities you will have to work out the minimum time between teeth to see that you are not exceeding a maximum switching speed of the sensor. The key spec seems to be:

Quote

Fast operating speed - over 100 kHz

This will of course be related to the number of teeth on the gear wheel and the maximum RPMs of the wheel. Less teeth would allow higher maximum RPM.