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 3117 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
Reply
  • 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
Children
  • 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
  • Former Member
    0 Former Member over 12 years ago in reply to Workshopshed

    i've got the idea sir...but base on the arithmetic operation rpmcount * 60, my rpm display seems to be so inaccurate

    and in fact the resultant is always a divisible by 10 and when the motor is too slow, it will also display 0.. any way you have

    to fix this? i mean how to make the tach reading as accurate as possible using interrupts?

    • 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

    For slow readings you've got a couple of choices, you can either count over a longer period or increase the number of pulses per revolution by adding additional magnets to your rotor

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

    basically what i'm trying to do right now is a speed control device for utility fans with an arduino based tachometer and display the feedback speed

    in matlab. so i would be dealing with slow and fast speeds. but what i am really trying to figure out is on how to make this tachometer as accurate as

    possible using interrupts considering that i am dealing with variable speed. i dont really have any idea sir?

    • 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

    Build stuff, record accuracy, make changes, record accuracy, repeat until happy.

     

    So your first thing to think about is how you can estimate the accuracy and then how to measure it to see if it meets your expectations.

     

    I'm no expert on Matlab but can't you use that to simulate different situations?

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

    Have you considered using an optical sensor to create a pulse as each fan blade interrupts the sensor. Either a led on the front of the fan and a sensor on the back or a reflective sensor on either the front or the back. Some cheap RPM meters us a reflective tape mounted on the rotating member and a laser with sensor to measure the period  of rotation, then the speed is calculated. You could count the pluses created by a timer on the Arduino during the period created by the fan blades. The accuracy could be excellent if the timer as set to a high frequency . More accurately make the count after a full revolution that is after 5 periods if it is a five blade fan, four if it is a four blade etc. Does this make sense?

    Bill

     

    Message was edited (Typos) by: Bill Penner

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • mcb1
    0 mcb1 over 12 years ago in reply to billpenner

    re Optical mice.

     

    Be aware they are usually a 38Khz signal between the led and sensor to eliminate any stray light.

     

    mark

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • billpenner
    0 billpenner over 12 years ago in reply to mcb1

    Mark:

    Thanks for the comment I didn't know that the LED was pulsed at that rate on a mouse sensor. However, I was refering to a digital tachometer such as below.

     

    Edd Niel Tabudlong

    This link will take you to the one I have. I am very happy with the results. This could probably be hacked, but I suggest it only for reference.

     

    http://www.google.com/shopping/product/9074361313685627858?

     

    Here is another link you might find useful.

    http://www.pyroelectro.com/tutorials/tachometer_rpm_arduino/img/schematic.png

     

    Bill

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

    thanks for your suggestion sir...i get the point and in fact i've already tried using CNY70 ir sensor.. but my problem now is on how can i send this tach reading from 1 arduino to another via serial wireless communication. the arduino with tach is the same arduino receiving the command of which speed level the user transmit. knowing that the tach reading is constantly updating at a matter of second, signals might bump if a user from the other arduino transmit a command. any idea sir how can i incorporate my tach code to my existing speed control code in 2 arduino's communicating wirelessly?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
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