Frequency measure library arduino. I hope this will work for you.