Arduino Speedometer Using Hall Sensor and Magnet

Arduino Speedometer Using Hall Sensor and Magnet

Have you ever wondered how a speedometer works? In this tutorial, we will show you how to build your own speedometer by measuring the magnetic pulses generated by a disc magnet located on a spinning wheel.


MATERIALS 

HARDWARE: 

SOFTWARE:


Step 1: Connections

  • Connect the Wireling TinyShield to the TinyScreen+.
  • Use the long 5-pin Wireling cable to connect the Hall-Effect Sensor to Port 0 on the Wireling TinyShield.
  • Connect the TinyScreen+ to your computer via the micro USB cable.

Step 2: Software

  • Open your Arduino IDE and select the TinyScreen+ from Tools -> Board.
    • Confirm that you are connected to the correct port. Navigate to Tools -> Port and select the port that contains “TinyScreen+.” The port number may vary.
     

      Step 3: The Code

      • Please download the code and required dependencies from the above Software section.
      • Note that you will most likely need to modify some of the constant parameters located at the beginning of the program:
      • The constant Boolean value USE_MPH allows you to choose between the English and metric systems for both the WHEEL_DIAMETER input and the speed output.
      • Make sure that you set the WHEEL_DIAMETER parameter as it is essential to produce accurate results. Unlike store bought speedometers made for a range of wheel sizes, you will be able to specify an exact value. Be sure to set WHEEL_DIAMETER  to the overall diameter of your wheel and tire combination.
      • RPM_SAMPLE_PERIOD allows you to control how far into the past the program includes sensor readings. Feel free to experiment with how this value impacts your results.
      • Once you have modified these parameters, upload the code to the TinyScreen+ using the upload button on the top left corner of the Arduino IDE interface. (pictured below)

           


       Step 4: Hardware

      • In order to measure the speed, it is necessary to place the disc magnet somewhere on a rotating wheel. On bicycles, a common location is on the spokes. We attached ours on a screw protruding from the wheel of a scooter. If there are no magnetic surfaces, you may need to tape or glue the magnet in place. Do not place the disc magnet on a rim if you have brake pads.
      • The Hall Sensor needs to be placed somewhere on the frame of the vehicle. Make sure to mount the sensor in such a way that the magnet will come very close to the front with every rotation. A strong magnet will enable distances of 5-6 inches, while a weak magnet may need to be within 2 inches or less.
      • Mount the TinyScreen+ wherever you prefer the viewing angle.

      That’s all there is to it! We hope you enjoyed this simple speedometer project!


      CONTACT US

      As always, if you have any questions or feedback, feel free to email us at info@tinycircuits.com.

      Show us what you make by tagging @TinyCircuits on Instagram, Twitter, or Facebook so we can feature it!

      Thanks for making with us!