Frequency measure ATTINY85

Hi,
I have a project that uses freqMeasure library (FreqMeasure Library, for Measuring Frequencies in the 0.1 to 1000 Hz range, or RPM Tachometer Applications) with an arduino uno.
Now I want to make a small version of the project using ATTINY85, is there any frequency measuring library that works with ATTINY85?

Thanks!

I did a quick search and did not find anything; my belief is that libraries are written for large volume Arduino products. While the tiny85 gets its share of visibility, there are only a few commercializations of this chip: example Digistump's Digispark and Adafruit Trinket. You may wish to search the forums of these devices.

I did find this frequency count implementation: Measure Signal Frequency

You may also find some "gems" in the source code for Trinket and Digispark support devices. I have produced several homebrew Digustump USB designs and found the V-USB implementation stable enough for such things as digital voltmeters and thermometers.

Ray

The ATtiny85 does not have an Input Capture which means FreqMeasure is simply not going to work. The second best choice for AVR processors (first best for the ATtiny85) is to use the External Clock Source (T0) to drive a timer (timer 0 for the ATtiny85). I believe the FreqCount uses that technique but I'm not aware of an ATtiny85 port.

thanks to all, seems that I would have to implement my own way to read frequency, what a pain.

There are at least two solutions:

  1. Feed the input into pin T0 and use timer 0 to count cycles - as per CodingBadly's response. Use timer 1 to define a gate time over which you count them. This can be made to work for input frequencies up to almost half the system clock frequency.

  2. Have the input generate an interrupt and count pulses in software. Use either timer 0 or timer 1 to define a gate time over which you count them. This should be usable up to at least 100kHz. I posted some code to do this on a Uno here Frequency Counter Library - #36 by dc42 - Science and Measurement - Arduino Forum. It should be usable on an ATtiny with minimal changes.

Either way, if you want an accurate result, you will need to use a crystal with the ATtiny and not the internal oscillator, and this will use up 2 pins.

dc42:
This can be made to work for input frequencies up to almost half the system clock frequency.

fclk_io / 2.5. Using the internal oscillator the fast peripheral clock is 64 MHz so the highest measurable frequency is 25.6 MHz.

Are you sure the I/O clock can be set to be the fast peripheral clock? I didn't find anything in the datasheet that says it is possible. It does say that the fast peripheral clock can be used to clock timer 1, but that's not the same as being used as the I/O clock (which is what it says is used to synchronise the input from T0).

dc42:
Are you sure the I/O clock can be set to be the fast peripheral clock?

No. I can't tell from the datasheet if the fast peripheral clock is used for synchronizing the I/O. To make it even more difficult to answer the question, the nomenclature is inconsistent. Until someone has time to run the experiment, let's go with this...

Using the internal oscillator the fast peripheral clock is 64 MHz. If the fast peripheral clock is used for I/O synchronization, the highest measurable frequency is 25.6 MHz. If not, the highest measurable frequency is 3.2 MHz.