Go Down

### Topic: Hall Sensor to Find Speed (Read 2967 times)previous topic - next topic

#### stevent

##### Feb 01, 2011, 04:24 amLast Edit: Jun 17, 2011, 07:52 pm by BasicElectronics Reason: 1
Hi everyone, I have started a site up to upload my projects. My first project is measuring speed of a wheel using a hall sensor. To view what I have so far, please visit http://basicelectronixs.com/ and navigate to electronics > projects > speed sensor. So far I have implemented one version of the code but I will be posting another version up as soon as I tweak some things out. The version I have now measures revolution over x time while the newer version will measure x revolution over a given time period. This newer version which I will try to have up also consists of a op-amp design so feel free to look around, explore and learn!

#1
pulsein()?

#### stevent

#2
##### Feb 04, 2011, 12:11 am
could you explain in more detail?

#### Grumpy_Mike

#3
##### Feb 04, 2011, 01:06 pm
There is a function in the arduino called pulsIn(), it measures the period of a pulse.
It might be simpler or more accurate than what you are doing.
http://www.arduino.cc/en/Reference/PulseIn

#### stevent

#4
##### Jun 17, 2011, 07:31 pmLast Edit: Jun 17, 2011, 07:53 pm by BasicElectronics Reason: 1
pulseIn() would not work for this since your trying to measure peak to peak and not from a high to low or low to high since if you think about it what if a wheel stops on a magnet, then it would have inaccurate readings. Measuring peak to peak will get the actual correct time.
Sorry it took so long to post back.

For a more detailed information, the link is as followed ---> http://basicelectronixs.com/node/41

#### borref

#5
##### Jun 18, 2011, 12:08 am
If you measure the width of a single pulse (I assume this is what you mean with measuring peaks), it will be subject to calibration as the slope (rise/fall time) of the opposing edges is likely to be somewhat unpredictable. The PulseIn() function will cancel out such errors  when you calculate the time difference between two sequential pulses and so is more accurate and appropriate for RPM/frequency calculations.

#### Grumpy_Mike

#6
##### Jun 19, 2011, 09:35 am
That project uses an A1302 linear hall effect sensor. This is not the right sort of sensor. The web poster says it is his first project and it shows.

The problem with a linear sensor is that you have to read the value with the analogue input A/D converter. This takes quite a long time and is going to add errors to your measurement. You need to use a hall effect switch, this gives a logic level output that you can use with pulseIn().

#7
##### Jun 19, 2011, 08:04 pm
If you wanted to use the analogue vr sensor it would be easier to find the zero point crossing.

But as mike says it is easier to use a sensor that is active and outputs a digital square wave

#### tkbyd

#8
##### Jun 21, 2011, 10:30 am
Another approach... and it has its cons as well as its pros!... is to send the output from the Hall sensor to a counter. You can then visit the counter from time to time, and see the number of pulses since the last time you looked.

Implementing the counter is something I haven't tried... although it is discussed in various posts.

"... since the last time you looked..." will use "millis", and a stored record of what millis returned the last time you looked, and what the counter was at back then.

#9
##### Jun 21, 2011, 10:33 am
i have used the counter approach in other hardware and it works well

count the number of revolutions since you last looked and the time and you know the rpm / speed

i suggest you use the clock in the arduino and not the clock in windows !

#### brainbooster

#10
##### Jun 21, 2011, 04:26 pm
another solution could be using a Schmitt trigger to clean the analog signal