RPM Measurement Using Hall Sensor and Arduino




In continuation with my previous instructable, RC Car that you can find on this link

RC Car using infrared

I've decided to upgrade the car with RPM measurement using Hall sensor and a neodymium magnet. In the following steps I'll describe the parts needed for the setup and will provide the code.

I did not encounter a good Instructable about RPM measurement with Hall sensor on this site so I hope it will provide valuable information for the potential readers.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Parts

  • first of all you will need a Hall sensor, I am using a SS461A Honeywell latching Hall sensor. I found it in my local store but you can use any one, order it on ebay or buy it local too. If you are not familiar what does a "latching" sensor mean, google the types of Hall sensor and you will find your explanation
  • next you will need a magnet which would rotate on the shaft of the motor and when it comes close to the sensor, it will trigger it. I use a neodymium magnet I collected from an old hard drive, but you can order them from ebay too in large amounts, or you can try to use a different magnet, but it may not be strong enough to trigger the sensor
  • you will also need a 10K resistor
  • since I am just upgrading my RC car, I have all the rest of the components needed already, but if you are doing this project solo, you will also need :
    • an electrical motor
    • some kind of driver to drive it
    • microprocessor
    • power for your micro and the motor

Step 2: Setup for the Magnet

I have 3D printed a case for my magnet. It has a hole to fit the magnet and a hole to place it on the shaft of the motor

Step 3: Setup for the Sensor

I also 3D printed the setup for the sensor, with a hole to fit the sensor connected to Dupont wires, and 2 screw holes to attach it to the main car setup.

Step 4: Connect the Sensor to the Micro

Connect the sensor to the micro in a way described on the picture.

The main point is to connect the VCC to the power, GND to ground, then connect the VCC to the signal with a 10K resistor, you can do it on the board like I did on the second picture, and connect it all to a pin on your micro (yellow wire on the picture).

Step 5: Final Setup

As you can see on the picture, the magnet is currently away from the sensor, but when the motor starts spinning, it will pass next to the sensor and trigger it, triggering the interrupt in the code and you will get your rpm count.

Step 6: The Code

I will attach the code I used.

I also used LCD to display the results, but you can use Serial Monitor too.

I also use the IR remote to change speed of the motor (I change the PWM signal +/-20) to check if the code and the setup is working.

On the first picture you can see there isnt any noise in the incoming signal, unlike the optical encoders, and in the second picture you can see the final result in my case.

I hope you learned something new and that you will use it too in your future projects :)

Be the First to Share


    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest

    4 Discussions


    1 year ago on Step 6

    Hello, JureINV.

    I am running your code and see that from time to time the sensor keeps firing although my magnet is away (for example, as I pass the magnet over the sensor, it reads it once for a few passes, and then occasionally, after I pass it, it would fire keep firing). This incorrectly multiplyies the distance, although there is no magnet over the sensor at all. It takes another pass of the magnet over the sensor to stop this, and everything goes to normal for a few more passes. Then the uncontrolled firing repeats. Maybe you have encountered the same behavior and have any tips?


    1 year ago

    Can you upload the case you used for your sensor?


    2 years ago

    Can you upload a schematic?


    2 years ago