Finding RPM of a motor

Hi all,
For a customer, I need to know the Rotations Per Minute of an industrial fan motor. It has a tachometer pin that you pull up to VCC and it’ll pull down upon the fan rotating to provide a nice pulse train.

I’ve formerly solved problems like this by using interrupts on the Microcontroller, but I’m afraid that doing so will cause problems to other timing critical parts of the system. What I would love to find is a chip that can just sit there and count and when it suits my main program, I can poll it to know how many counts it has received since last polling. The most suited part I have found is the NCT80 from OnSemi ($3.8). This uses I2C, so I won’t need to use any additional pins from my MCU so it’s not a bad solution.

But - shouldn’t there be more suppliers of IC’s like this? Or does just everyone else just throw a dedicated Microcontroller at this problem? How would you solve this if you cannot use the main Microcontroller? How would you go about making a Tachometer like this?

If you have your tachometer pin wired into a timer/counter peripheral’s count input pin, you can just tally up counts on one timer and then have a elapsed time on another timer. Then you can derive the rpm from counted pulses per elapsed time.

Yeah. I thought about that, but old-style counters require a lot of pins to read and the I2C/SPI based one’s I found were clock-ICs with no clear instructions on getting just the count? You wouldn’t happen to know of a specific IC that I could dive into?

(I need to know the RPM of two motors and the NCT80 can cover both. It just seems like a very common thing to do, so I’m puzzled that there’s not more IC’s for doing this?)

Feed it into an RC low pass filter and sample the voltage with an ADC.

1 Like

There are plenty - search for “Frequency to Voltage Converter”. Or as Slawek points out, if the pulse width is constant you can average the pulse train.

Many MCUs have fairly autonomous “Input Compare” modules that probably also can do what you’re looking for without obligatory interrupt servicing, especially if you set them up to DMA their results.

EDIT: Yeah, I meant “Input Capture”, not Input Compare, thanks @LukeBeno :slight_smile:

1 Like

Pretty much every MCU has a Timer Capture module. Highly recommend using this. This sort of thing would otherwise be very taxing on a CPU to IRQ so frequently. Can you share what MCU you are using? Even the cheapest AT tiny or MSP430 has this function.

1 Like

RC filter on the PWM output is a good way as Slawek wrote

If you have a switcher in front of the motor stage you can also retrieve the signal from the current loop. But that is just complicating stuff when as super simple RC filter can do the trick

1 Like

Thanks all!
I’ll try both the Input Compare method as well as analog input with RC filter. Great advice! I knew that there was something simple like this that I was missing!

J

Hi all. Thanks for great advice!
I just wanted to update on the solution I’m picking. If the fan had a proper Tachometer output (based on rotation), I’d just use the RC filter. Since it’s not a “normal” Tachometer, but rather a generated frequency that kind of mirrors the speed (non-linearly), I couldn’t get that approach to work well. I might also have to compensate for various fan types, so having this in software is easier.

I’m finishing up the board tomorrow. I’ll try both Input Compare and a dedicated IC and see what works best as we build up the system (this is just a prototype). It looks like Input Compare takes very little resources, but I want to see it in the complete system before selecting it.

The NCT80 (OnSemi) is identical to the LM80 (TI). The NCT80 seems hard to get in volume and the LM80 is no longer recommended and superseded by LM96080, so I’ll use that as my backup plan. It’s $6, so if I can remove it from the BOM by using Input Capture I’ll certainly do so. I couldn’t find any existing library for the LM96080, but I got it working after fiddling about with the registers according to the datasheet.

(Side note: writing a library based on a datasheet was incredibly daunting some years ago, but now it’s fairly easy, albeit a slow process).

I must be missing something, why are you not using one of the internal MCU timers as has been suggested by multiple replies? Zero additional parts count.

As I wrote, I’ll likely use Input Capture (using MCU timers) @tve, but I want to have a backup solution with the LM96080. It’s much easier to remove parts that are not needed than to spin a new version of a 260 component PCB :wink:

(For now, we’re prototyping so plans and requirements change from week to week)