Hello everyone,
I am a mechanical engineering student, and recently discovered arduino. You can not imagine, how happy I was, that I will not have to buy commercial products to do simple tasks, but actually do it myself, the way I want it to perform.
I watched and read a lot of tutorials, and had no problems monitoring sensors and doing simple tasks with servos.
BUT not I am stuck.
I try to monitor a single cylinder 4 stroke IC motor and strugling to register RPM with ne 555 and interrupt function.
The schematic is attached to the post. It is based on a very popular in this forum sport devices capacitive spark pickup (found here SportDevices. Chassis and Engine Dynamometers)
The code I am using is very simple, which sends the data back to the seial port.
int sensePin = 2;
int rpm = 0;
unsigned long oldTime = 0;
unsigned long newTime = 0;
unsigned long interval = 0;
void spark()
{
newTime = micros();
interval = newTime - oldTime;
if (interval > 500)
{
rpm = 60000000 / interval;
}
}
void setup ()
{
Serial.begin(9600);
pinMode(sensePin, INPUT);
attachInterrupt(0, spark, RISING); // analog2 input
}
void loop ()
{
noInterrupts();
unsigned long rpmDisplay = rpm;
interrupts();
Serial.println(rpmDisplay);
delay(1000);
}
and I constantly get zero values back to com monitor ![]()
I tried FALLING and RISING, tried different interval comparison, even to the 1 microsecond and still getting zeroes.
There are some slight variations of NE555 wiring posted over internet, so I think I might have done something wrong with wiring the chip NE555.
Also, is there any arduino based osciloscope I could try using, to see if there is any signal coming to arduino. I tried googlig, but xciloscope does not work for me, due to being old version and SimpleArduinoOsciloscope freezes after a few seconds ![]()
Thank ou for al lthe input.
