Hi there
I am having problems with FreqMeasureMulti.
At the moment I have just 1 frequency input, but there will be 2. Both are under 200Hz.
The problem is when I vary the frequency going in, reducing the frequency works fine, the number is quite rapid to respond. But when I increase the frequency, there is a significant delay and it often blinks a very low number and then carries on.
Always the same, decreasing frequency is smooth, increasing frequency something is going wrong, and I don't know what it could be.
The is coming off an RPS sensor for a motor, I have 28 pulses per revolution, and the max number of pulses will be about 200Hz.
I have tried the Serial_Output.ino example that comes with the library, and it does the same thing.
I have modified it a bit (minor) and this demonstrates the problem.
It shows a stream of numbers (just use 1 channel). Connect to pin 5, when you reduce the frequency it is smooth and seamless. When you increase it, the numbers pause for a bit (second or more), and then carry on, but often will show a number near 0.
This is a huge problem for me as I need a smooth up/down frequency stream.
Can anyone help, please?
Teensy 3.5
PWM Frequency input I have going in is at 5V logic level.
I am having problems with FreqMeasureMulti.
At the moment I have just 1 frequency input, but there will be 2. Both are under 200Hz.
The problem is when I vary the frequency going in, reducing the frequency works fine, the number is quite rapid to respond. But when I increase the frequency, there is a significant delay and it often blinks a very low number and then carries on.
Always the same, decreasing frequency is smooth, increasing frequency something is going wrong, and I don't know what it could be.
The is coming off an RPS sensor for a motor, I have 28 pulses per revolution, and the max number of pulses will be about 200Hz.
I have tried the Serial_Output.ino example that comes with the library, and it does the same thing.
I have modified it a bit (minor) and this demonstrates the problem.
It shows a stream of numbers (just use 1 channel). Connect to pin 5, when you reduce the frequency it is smooth and seamless. When you increase it, the numbers pause for a bit (second or more), and then carry on, but often will show a number near 0.
This is a huge problem for me as I need a smooth up/down frequency stream.
Can anyone help, please?
Code:
#include <FreqMeasureMulti.h>
#define pin_SENSOR1_RPS 5
#define pin_SENSOR2_RPS 6
FreqMeasureMulti freq1;
FreqMeasureMulti freq2;
void setup()
{
Serial.begin(115200);
freq1.begin(pin_SENSOR1_RPS);
freq2.begin(pin_SENSOR2_RPS);
}
float sum1 = 0, sum2 = 0;
int count1 = 0, count2 = 0;
elapsedMillis timeout;
void loop()
{
if (freq1.available())
{
sum1 = sum1 + freq1.read();
count1 = count1 + 1;
}
if (freq2.available())
{
sum2 = sum2 + freq2.read();
count2 = count2 + 1;
}
// print results every 100ms
if (timeout > 100)
{
if (count1 > 0)
{
Serial.println(freq1.countToFrequency(sum1 / count1));
}
if (count2 > 0)
{
Serial.println(freq2.countToFrequency(sum2 / count2));
}
sum1 = 0;
sum2 = 0;
count1 = 0;
count2 = 0;
}
}
Teensy 3.5
PWM Frequency input I have going in is at 5V logic level.