RPM Measurement Using Hall Sensor and Arduino




Introduction: 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.

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


    • Home and Garden Contest

      Home and Garden Contest
    • Tinkercad to Fusion 360 Challenge

      Tinkercad to Fusion 360 Challenge
    • Go Big Challenge

      Go Big Challenge



    Question 6 weeks ago on Step 1

    I have made a wired toy car, and want to upgrade it by adding a speedometer. But I don't know exactly how to do it. I have some ideas like : using hall effect sensor/variable reluctance sensor. But the tires are are completely plastic/rubber built, not metal, and there's no shaft to attach hall effect sensor. On all 4 wheels motors are attached.
    So what type of magnets should I attach on tire & what components can I use?
    Please, guys help me with it?


    4 years 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?

    David Hoskins
    David Hoskins

    Reply 2 years ago

    What is your sensor mounted to? If it is a ferrous metal there is a chance your magnetizing it enough to cause problems with your sensor?

    It could also be if what you have the magnet attached to varies in thickness and again is ferrous it could be mistaking the changes in the magnetic field for individual magnets passing by.

    Or your sensor may be getting ready to go out on you. That's actually where I'd start if you have another one of the same type laying about.


    4 years ago

    Can you upload the case you used for your sensor?


    5 years ago

    Can you upload a schematic?


    5 years ago