Tachometer, interrupt and square wave...

Hi all

I am back into my project of building a dashboard for my racetrack motorbike.

Simple design : 40 LEDs for RPM indication and a 16x2 LCD display for useful info. And a bunch of LEDs for indications such as neutral, low fuel and warnings...

I got some REAL help previously on the forum on how to do the programming to drive my 40 LEDs via 74H959. Works great in "demo mode" (like splash screen, all LEDs going up then down)

My BIG concern is now reading engine velocity from ECU. Loadsa posts on the forum and on the internet. Got many answers to questions i hadn't asked myself at the time of reading... Great! Except....

Except that it's not quite working as i expect.

ECU provids a 30Hz square waveform. Pretty clean, nice shape, very sharp. Go it thanks to Xoscope. Xoscope gives me frequency but not voltage... A voltmeter gives me a value but i guess that an average value... so i made a voltage divider to get what i think is a 12V wave down to a 0.8V wave to feed to Xoscope...

That's where i am loosing it : i asume wave is 12V, but is it 12V peak to peak or 24V peak to peak ?
My voltage divider is doing what i ask it : 12V DC down to 0.8V DC for Xoscope
Another one does its job as well : 12V DC down to 5VDC to feed ECU signal down to arduino...

All these questions to a final one : do i get funny count of RPM because of a poor (or too high) voltage from ECU square wave ?
What is the threshold for arduino to be able to "read" a wave ?

Some thoughts as they come :

  • i put a 1N4001 diode between ECU signal and voltage divider... i am now unsure if i can feed arduino with a negative part of a wave (digital 5 of my Uno, to work with interupt)
  • i even took the risk to reduce the voltage divider ratio (higher voltage coming out) and i got a more stable reading, but still got a value between 20 and 50Hz where i should get something close to 30Hz...
  • i know it's a Ducati engine, but i get from my ears that it is fairly stable... and the needle from original tacho is also fairly stable... so i can only blame my input...
  • ordered a LM2907 from ebay this afternoon just in case :smiley: so not funny, please dont take me down that road...

Thanks a lot for reading that messy report, and thank you even more for advice from your side !

Good night people !

Ben

The Atmel datasheet (for an Atmega 328 if you are using an Uno) defines the voltages that are treated as HIGH and LOW.

LOW is a max of 0.3 Vcc and HIGH is a min of 0.6Vcc - but check the document yourself in case I have made a mistake.

...R