You seem to be the hardware guy

Me being the software guy I would not give up that quickly. It's solved very simple: Just let the RPMs be calculated every time you get an interrupt. Don't take the millis() but the micros() and you get enough sensibility (I guess, depends on your setup). Your interrupt handler does not count the number of times it's called but the time difference between these calls.
BTW: in your sketch rpmcount is not declared volatile although it's changed in a interrupt handler. You should only change global variables in an interrupt service routine declared "volatile".
Snippet:
- Code: Select all
volatile unsigned long last_irq_time = 0;
volatile unsigned int rpm = 0;
void rpm_fun() {
rpm = 30000000L / (micros() - last_irq_time);
last_irq_time = micros();
}
So you have always an accurate RPM value (given you get two rising edges on pin 2 for every round of your motor) and you can decide in every run of loop() if you wanna stop or start your motor. No additional electronics needed

.