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.
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.