0

Pulse count to frequency solution

Jim DeVolder 2 months ago updated by Russell Gunn 3 days ago 1

has anyone successfully used this tool?  The pulses increment by 0.5 each time and the new pulses Qcode is not working

Hi Jim, if you still need a solution please add more details.  I will follow so i get an email.  I am working on using a pulse count input to read a fan speed that is generating a pulse output that is way to slow to use a frequency input. (frequency inputs return an integer value of pulses that were seen in one second I.E. the Hz. This does not give me enough resolution.)  i am using the pulse counter so that i can accumulate counts for several seconds instead of just the one that a frequency input returns. This creates a problem with the time required to get an accurate frequency. I need to know the fan speed over a wide range. My approach is to  use the same pulse counter input, to derive the speed two different way and then select the best speed for the range i need. 

Method 1: is for faster speeds and records the pulse count once a second into a chain of 16 memorizing channels in a type of FILO buffer. I then computes 16 speeds, the speed over one second, the speed over 2 seconds, and so forth up to the speed over 16 seconds. Because each speed is calculated using more pulses, each speed is more accurate. PROVIDED THE SPEED DID NOT CHANGE, which is where the complication begins. working on the assumption that the accuracy of a changing speed is mostly meaningless. I use the number of counts each speed is based on to compute the range the speed could be. i then compare each of the 16 speeds to the range of previous speeds and uses the longest time duration speed that is within the range of all the shorter sample time speeds. for example: if the 5 second speed 

has a range of 15 to 20 RPM and the nominal speed of the 6 second speed is 30 RPM. i use the 5 second sample speed because i know the 6 sample speeds is wrong, I.E. the speed slowed down. (keep in mind this method requires 100 sample to achieve 1 in 100 resolution. ) 

Method 2: is for much slower speeds. This much simpler method includes a math channel that i call "loop counter" that increments by one each software loop. the code watches the counter input for a change and records the value of the loop counter in a chain of two memorizing channels. it then computes the delta of the two channels and using the known loop speed it computes the speeds/frequency.  This method requires 100 loops to achieve1 in 100 resolution. hence it is not able be used for higher frequencies but becomes inherently more accurate as the frequency becomes slower. 


Both of the methods and combining them have problems that must be dealt with, i have not addressed. For example the Pulse counter value is a real with 7 significant digits. Parker does not clearly define what happens when the counter exceeds the 7 significant digits, so i am resetting, which is complicated by the fact that pulses can arrive when the counter is reset. 

Have fun.