Tachometer results not stable

as the datatype is unsigned it cannot be < 0 . By definition.

It can however overflow/underflow but by using subtraction you can compensate the overflow of the micros() with the underflow of the subtraction.

let ths prog run until overflow and you will see the deltas a

void setup()
{
  Serial.begin(115200);
}

void loop()
{
  Serial.print(micros(), DEC);
  Serial.print("\t ");
  Serial.print(lasttime, DEC);
  Serial.print("\t ");
  Serial.println(micros() - lastTime, DEC);
  delay(600000UL);
  lasttime = micros();
}

The micros is only reset after the program itself is reset. And then all counters are reset

Tested both now and the first one varies with +- 0.12 rpm which is fantastic and the second one are absolutely still as its a long,

OK sounds very good, probablyonle one or two pulses variation. Now the real life tests need to be done, its getting serious :slight_smile:

W'll hear from you in this thread.