0

One of my biggest questions concerns coding a Hall effect sensor to find wheel speed with an arduino mega.

I’ve got an lcd in digital pins(7,8,9,10,11,12) and a Hall effect sensor in digital pin 2.

I just have no idea how to code the actual rpm measuring process. Does anyone have any ideas or experience that can help me? My form of measurement is to spin something with a mounted magnet near it. The end game is to measure a car wheel rpm. Pointers? Tips?

3
  • 2
    yes, many people have ideas and experience ... is that all you wanted to ask?
    – jsotola
    Mar 15 at 3:08
  • 2
    break the program into individual sections ... start by reading sensor and turning led on and off when signal is detected .... then work on learning how to display numeric data
    – jsotola
    Mar 15 at 3:09
  • There are numerous tutorials online. An example is maker.pro/arduino/tutorial/…
    – RowanP
    Mar 17 at 3:28

1 Answer 1

1

You can measure this in either RPM (revolutions per minute) or frequency (cycles per second).

Whether it be a minute or a second, you count the number of times you get a pulse and at the end of the minute/second you copy the total to your variable and reset the counter variable. If you need a fasster update rate, you can count for fractions of minute/second and do the calculation to show it in terms of RPM/frequency.

My first concern when solving this issue is how fast the magnet is going past the sensor (ie how many pulses per second).

If it is slow, you can do it in your main loop as long as you don't have any blocking instructions (such as delay()).

If it is fast you will probably have to look into an interrupt. When the pin goes high, it jumps to the interrupt function and increments a counter. Check the input section for libraires that make the interrupt process easy (or do it the old fashioned way, your choice). Some of the button libraries have interrupt specific functions.

1
  • Make sure to only count a pulse once. For example, you could achive this by looking for the rising edge of the pulse.
    – sa_leinad
    Mar 18 at 12:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.