Hi all

I want to use my arduino for some kind of tachometer.
My car has a tachometer output, with square 0-12V signal (verified with an oscilloscope), frequency is from 20Hz to 500Hz.
I've made a small input adaptor to have a square 0-5V input for the arduino, which is working as far I can see on my DSO Nano V2 (low cost oscilloscope).
The problem is: the frequency measured by the arduino is moving continuously. It's never stable.
I've tried with a square signal generated from the DSO Nano and the measure is stable.
My opinion is: there is some noise on the input signal in the car which is measured by the arduino. The library I use is simply counting the rises on the input regarding the time, and noise could make some rises.
Here is the adaptor circuit for the input. I'm using the ULN2803 as a driver for LEDs, and there was 2 network unused, so I've take one to do the trick.

And the code:
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <FreqMeasure.h>
#define OLED_DC 11
#define OLED_CS 12
#define OLED_CLK 10
#define OLED_MOSI 9
#define OLED_RESET 13
Adafruit_SSD1306 display(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);
#define NUMFLAKES 10
#define XPOS 0
#define YPOS 1
#define DELTAY 2
#if (SSD1306_LCDHEIGHT != 32)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif
//Input Pin 8
double sum=0;
int count=0;
void setup(){
display.begin(SSD1306_SWITCHCAPVCC);
FreqMeasure.begin();
}
void loop(){
if (FreqMeasure.available()) {
// average several reading together
sum = sum + FreqMeasure.read();
count = count + 1;
if (count > 50) {
double frequency = F_CPU / (sum / count);
display.clearDisplay();
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(0,0);
display.print("8 Frq: ");
display.println(frequency);
display.display();
sum = 0;
count = 0;
}
}
}
Do you think I need to use a low pass filter to keep only frequency under 1KHz ?
Or any other ideas about a better way to do it ?