Determine frequency or period for a string of pulses

jbangura

New member
We are working on a motor project and will need to determine the speed from a string of pulses. Could someone please describe how we can input the signal to the controller and get frequency as an output from the microcontroller, which pins can be configured for the input and which pins can be configured for the output, and how do we configure the pins for this task?

Thanks!
 
Hello! For some reason I am running into this initial issue with the FreqMeasure library after installing it via the manage library tab in the Arduino IDE. I tried compiling and uploading the Serial_Output example.

#error "Unknown chip, please edit me with timer+counter definitions"

OS: Windows 10
Board: Teensy 4.1
IDE: Arduino IDE 1.8.19
 
You shouldn't install FreqMeasure manually, that will be the wrong version of the library. The correct version gets installed with all the other Teensy libraries.
 
Hi I thought installing it via the Tools>Manage Libraries tab on the Arduino IDE was the automatic way of installing libraries in Arduino.

Manual installation would be copying a zip file of the library and extracting it into the Libraries folder of the Arduino IDE.
 
Hi I thought installing it via the Tools>Manage Libraries tab on the Arduino IDE was the automatic way of installing libraries in Arduino.

Manual installation would be copying a zip file of the library and extracting it into the Libraries folder of the Arduino IDE.
To work with Teensy and Arduino IDE 1.8.19, you should download and install TeensyDuino from the link below. TeensyDuino includes Teensy versions of many libraries, including FreqMeasure. Since you are using Teensy 4.1, you probably should use FreqMeasureMulti, which supports frequency measurement on many T4.1 pins. The FreqMeasure library only supports one pin.

 
So it looks like my version 1.8.19 of the Arduino IDE doesn't play well with the library and is not up to date. I already installed TeensyDuino when I first started using the Teensy 4.1 board and redownloaded it again just now, but still not success. I then used another computer with Arduino IDE 2.3.2 version installed on a Windows 11, and there are more examples like the FreqMeasureMulti mentioned. That example code compiles and uploads. It is also successful at reading the frequencies I send it via the signal generator. I will need to update my IDE and do further testing.

Thanks
 
So it looks like my version 1.8.19 of the Arduino IDE doesn't play well with the library and is not up to date. I already installed TeensyDuino when I first started using the Teensy 4.1 board and redownloaded it again just now, but still not success. I then used another computer with Arduino IDE 2.3.2 version installed on a Windows 11, and there are more examples like the FreqMeasureMulti mentioned. That example code compiles and uploads. It is also successful at reading the frequencies I send it via the signal generator. I will need to update my IDE and do further testing.

Thanks
If you downloaded libraries such as FreqMeasure using the Arduino IDE Library Manager, you should delete those, because they will get linked to your application rather than the Teensy-specific versions in TeensyDuino. I still mostly use the 1.8.19 IDE, but it seems most people are transitioning to the new IDE.
 
Interesting. I did delete and uninstall them but I didn't recompile to see if it worked.

So by installing the TeensyDuino via the TeensyDuino.exe, that supplies the Arduino IDE the Teensy board libraries automatically?

I must of mis-interpreted the instructions of how the TeensyDuino works.
 
Back
Top