16 channel frequency measurmet?

Hi all,

Using a couple of magnets, a Hall effect sensor, and pulseIn() I constructed a PID velocity controller for a DC fan. So far so good, now the next step of my project requires to have 16 PID controllers working concurrently from one microcontroller and I´m thinking that pulseIn is not going to be the best solution for this.

A not-so-long google search got me thinking that what I want to achieve is impossible in an Arduino, however, after a few minutes of thinking I realized that the frequencies I need to measure are low (top speed 1500rpm, fq < 30Hz), therefore most port expanders (such as the MCP23S17 or the MCP3208) will have more than enough sampling frequency and serial speed to get frequency measurements with adequate accuracy for my project. So the idea is to use one of these port expanders and simply count the number of ups and downs in a pre-selected time frame.

What do you think about this? Is it feasible? Any feedback or suggestions will be greatly appreciated.

Thx :slight_smile:

The ESP32 has PCNT module that runs separate from the CPU and counts pulses. The CPU is freed from the chore of counting pulses.

Here is a link to the API of the PCNT.

Pulse Counter (PCNT) - ESP32 - — ESP-IDF Programming Guide latest documentation (espressif.com)

Oh right, I don´t know why haven´t I thought of the ESP32 before, and I actually have one lying around. Thank you @Idahowalker

That would slow the response time by the amount of precision you need, therefore drastically limit the PID response bandwidth. It makes more sense to time the pulse intervals. Then you get frequency results right away.

Example - you want to measure kilometers per hour. Easy, you just count the number of kilometers in an hour. But, you have to wait one hour to know how fast you're going. :slight_smile:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.