element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Arduino Forum RPM measurement from a motor tachometer
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 14 replies
  • Subscribers 402 subscribers
  • Views 3116 views
  • Users 0 members are here
Related

RPM measurement from a motor tachometer

Former Member
Former Member over 12 years ago

Good Day,

 

     I'm currently doing a project involving wirless speed control and speed monitoring devices using an Arduino ATMEGA644.

The sensor I'm using is a unipolar hall switch which turns on with the presence of a magnetic field. The sensor generates a

waveform relative to the speed of the motor. I can calculate the speed in terms of RPM by multiplying 60 to the frequency of

the generated waveform. I'm aware that the signal must be an analog input but I don't know how to code my arduino for it to

be able to calculate the frequency generated as well as the RPM speed of the motor. I badly need your help.. Anyone who

can answer my question??

  • Sign in to reply
  • Cancel

Top Replies

  • Former Member
    Former Member over 12 years ago +2
    Hi Edd Niel, To do motor speed measurement, you need little more intermediate knowledge of Arduino. There are two ways you can do this. 1. use the Arduino function pulseIn() and count the pulses in 1 second…
  • Workshopshed
    Workshopshed over 12 years ago in reply to Former Member +1
    Here's a couple of places with examples for interupts. http://tronixstuff.wordpress.com/tutorials/ http://www.engblaze.com/we-interrupt-this-program-to-bring-you-a-tutorial-on-arduino-interrupts/ This…
  • shabaz
    shabaz over 12 years ago in reply to Workshopshed +1
    The interrupt approach is very ideal. Just for the rare cases where a different method may also be needed: another way (slightly more analog!) is to just take the pulses from whatever sensor is generating…
Parents
  • Former Member
    0 Former Member over 12 years ago

    Hi Edd Niel,

     

    To do motor speed measurement, you need little more intermediate knowledge of Arduino.

    There are two ways you can do this.

     

    1. use the Arduino function pulseIn() and count the pulses in 1 second. This will be good starter. Check the Arduino -> References -> pulseIn function.

     

    The second is more accurate, but little complex than the first approach, but uses two interrupts. It is more efficient design

     

    Use Timer1 to generate an interrupt every second (actually 1.04 sec)

    Use attachInterrupt(0, countPulses, CHANGE) ; 

    // connect the sensor output to either pin2 or pin3 digital.

     

     

    in countPulses, increment a variable. On Timer1 interrupt elapsed..check count of pulses. This is accurate way of counting pulses..

     

     

    There is an example of this in my book "freeduino.begin(), the ultimate beginners guide to Freeduino/Arduino platform", you can buy the same on iStore or printed copy on www.bhashatech.com

     

    cheers

    sid

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 12 years ago in reply to Former Member

    Sir? i really have no idea in using these interrupts and i'm quite new to using functions other than

    void loop() and void setup(); but i understant the flow of process.

     

    i have to count how many times the digital input pin from the sensor goes to HIGH state every 1 second.

    and multiply it by 60 to have an accurate RPM.

     

    next i have to display it in the serial monitor. and to update the speed reading for a time less than 1 second.

     

    but in terms of coding this in the arduino, I really don't have enough idea.. could you please help me in this?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Workshopshed
    0 Workshopshed over 12 years ago in reply to Former Member

    Here's a couple of places with examples for interupts.

     

    http://tronixstuff.wordpress.com/tutorials/

    http://www.engblaze.com/we-interrupt-this-program-to-bring-you-a-tutorial-on-arduino-interrupts/

     

    This project might also give you some ideas

    http://www.instructables.com/id/Arduino-Bike-Speedometer/?ALLSTEPS

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • shabaz
    0 shabaz over 12 years ago in reply to Workshopshed

    The interrupt approach is very ideal.

    Just for the rare cases where a different method may also be needed: another way (slightly more analog!) is to just take the pulses from whatever sensor is generating them, and just put them through an integrator type circuit (could be as simple as a resistor and capacitor). Then, there is a voltage that varies with the speed. You could then read that with an ADC if there is one built-in to the microcontroller.

    But the interrupt approach is the most ideal of course. The analog method is useful sometimes if there isn't  a convenient interrupt available (e.g. running the software on a PC).

     

    EDIT: It could also be useful if you are expecting very high speed and if it is not divided down to be convenient for the microcontroller. However  if this is for a car then you know the RPM range.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • shabaz
    0 shabaz over 12 years ago in reply to Workshopshed

    The interrupt approach is very ideal.

    Just for the rare cases where a different method may also be needed: another way (slightly more analog!) is to just take the pulses from whatever sensor is generating them, and just put them through an integrator type circuit (could be as simple as a resistor and capacitor). Then, there is a voltage that varies with the speed. You could then read that with an ADC if there is one built-in to the microcontroller.

    But the interrupt approach is the most ideal of course. The analog method is useful sometimes if there isn't  a convenient interrupt available (e.g. running the software on a PC).

     

    EDIT: It could also be useful if you are expecting very high speed and if it is not divided down to be convenient for the microcontroller. However  if this is for a car then you know the RPM range.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube