Pages: [1]   Go Down
Author Topic: Hall Sensor to Find Speed  (Read 1480 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 5
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!  smiley-grin
« Last Edit: June 17, 2011, 12:52:09 pm by BasicElectronics » Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 78
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

pulsein()?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 5
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

could you explain in more detail?
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 508
Posts: 31431
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 5
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
« Last Edit: June 17, 2011, 12:53:10 pm by BasicElectronics » Logged

Offline Offline
Edison Member
*
Karma: 3
Posts: 1001
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 508
Posts: 31431
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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().
Logged

UK
Offline Offline
Sr. Member
****
Karma: 0
Posts: 308
Arduino - very interesting !
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Sussex UK / CT USA
Offline Offline
Edison Member
*
Karma: 0
Posts: 1028
Forums forever
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

UK
Offline Offline
Sr. Member
****
Karma: 0
Posts: 308
Arduino - very interesting !
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 !
Logged

Deep south of Italy
Offline Offline
Faraday Member
**
Karma: 7
Posts: 2961
The quieter you become, the more you can hear
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

another solution could be using a Schmitt trigger to clean the analog signal
Logged

UK
Offline Offline
Sr. Member
****
Karma: 0
Posts: 308
Arduino - very interesting !
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I tgink the easiest way to do tgis is program an interrupt on digital pin 2.   everytime it updates increase a counter by one and write it and the system time to the serial port

or calculate the speed and write  that to the serial port

speed is distance/time
Logged

Pages: [1]   Go Up
Jump to: