I’m trying to read the ignition pulses from a 4-cylinder 4 stroke petrol engine, as part of an ongoing project. The circuit I’m using takes the back emf generated by the ignition coil on the breaking of the contact breaker points. This voltage is well in excess of 30v on triggering the spark.
I have a 30v zener diode and an optical isolater in the input feed to pin 2 of the arduino. it all work fine upto about 3000 rpm.
I have a scope attached to the arduino pin 2 and from 1000 to 6000 rpm the input signal looks correct.
But the arduino reports 33 pulses @ 1000 RPM which is correct
66 pulses @ 2000 RPM again correct
64 pulses @ 3000 RPM error (should be 100 pulses)
6 Pulses @ 4000 RPM error (should be 133 Pulses)
anything above 4000 rpm gives the output as 0
My simple code
volatile int IRQcount;
int pin = 2;
int pin_irq = 0;
int result = 0;
void setup() {
Serial.begin (115200);
pinMode(2, INPUT);
attachInterrupt(pin_irq, IRQcounter, RISING);
}
void IRQcounter() {
IRQcount++;
}
void loop() {
cli();
IRQcount = 0;
sei();
delay(1000);
result = IRQcount;
Serial.print("Pulse Count = ");
Serial.println(result);
}
What is happening?? at 6000 RPM the signal is only 200HZ surely thats not to fast for the arduino to recognise or measure.