Frequency Counter Library

Have you considered using a light based counter? Shine an IR light at whatever is spinning and fix piece of something shiny to it. Then point an IR detector at it which should detect rotation.