Tachometer Project

I’ve been working on a tachometer project with a friend of mine for some time now. It’s using a Mini Pro 5v 16mhz, serial seven segment display and a 24 Neopixel ring.

I have an UNO that I’m using to simulate the PWM signal into the tachometer input pin of the Mini. Using this method the tachometer works flawlessly. It’s nice and smooth when I turn the pot to increase the frequency.

On the vehicle I’m using the negative side of the ignition coil, piped into a Schmitt trigger. I also have a resistor, a capacitor, and a couple of diodes between that signal and the input of the optocoupler.

This issue I’m having is when the tach is connected to the negative side of the coil for the signal, the tach never stays as at a steady RPM, It pretty much just jumps all over the place. Yet when I go back to the frequency simulator, it’s always nice and smooth. Is there a typical way of doing this if the negative side of the ignition coil is used at the tach signal?

Any help would be appreciated.

how are you monitoring your input, an Interrupt?

Yes.

You don't say what engine you are working with, but if you are measuring period between pulses AND you are working with a V-6 for example (at least the old Buick ones I had), that is a V-8 with two cylinders left off as a result, the firing angle between cylinders is not uniform - short, long, short, long (look at the cam in the distributor). If you are just measuring the period and working with an engine like that, you will never get a stable reading. You would have to count pulses for multiple revolutions of the engine for example then calculate RPM from that.

It's a 408ci V8. So, for example at 1 revolution of a V8 you get 4 pulses per revolution. The crankshaft to distributor ratio is 2:1. 1000rpm * 4ppr = 4000 pulses per minute / 60 = 66.666hz.

You are correct. My point was that if you had a V-6 (and you did not specify), those engines give you 3 pulses per revolution, HOWEVER, they are not evenly spaced and if you are measuring the time between pulses, you will get two different times - one for the long pulse and the next one for a shorter pulse. Something to be aware of if you ever work with a V6 that has the 90 degree "V" between cylinders.

Working with ignition systems invariably means having to deal with noise.
Simply placing an opto isolator may not be enough as it depends on how it is connected.
Best to keep supply to the opto and the micro completely isolated.
So, does your pro mini derive it's power from the vehicle?

Yes it does get its power from the vehicle. I have the 12v vehicle power going into a buck converter that drops the power to 5v.

In the ground connection going to the Arduino, I suggest adding a ferrite core (wind the ground wire through it 4-10 turns).

If the ignition signal looks like this, then the negative impulse will break the 6V reverse barrier of the opto diode and most likely create an extra impulse. I suggest adding a reverse connected diode to prevent this. Also a 10nF capacitor might be beneficial to smooth the signal just a little and ensure the schmitt trigger creates only 1 output pulse per input pulse.

Reason I asked is that with that arrangement you can get RFI leakage into your micro from the opto.

dlloyd:
In the ground connection going to the Arduino, I suggest adding a ferrite core (wind the ground wire through it 4-10 turns)

If the ignition signal looks like this, then the negative impulse will break the 6V reverse barrier of the opto diode and most likely create an extra impulse. I suggest adding a reverse connected diode to prevent this. Also a 10nF capacitor might be beneficial to smooth the signal just a little and ensure the schmitt trigger creates only 1 output pulse per input pulse.

Look at my first post and the pictures attached. In 1.jpg you'll see I have a resistor, capacitor, diode arrangement similar to what you've illustrated. I do not have a ferrite core however as you've suggested.

Hi,
Do you have access to an oscilloscope?
This will let you see what is going into your opto.


This is what your opto is looking at, not just 12V but a massive >300V spike.
You will have to clamp the signal from the neg side of the coil so it only produces clean pulses.
The signal on the primary side comprises of.

  • electronic points open
  • spark
  • spark stops (>300V spike)
  • ringing (coil dissipating energy)
  • electronic points close
  • electronic points go into current limit mode

Tom.... :slight_smile:

Yes I do have access to a scope. I actually had the scope on the output signal of the opto. It was at a 5v signal level as expected but I noticed that there was a thin intermittent pulse riding on the edge of the square wave. I could see the frequency fluctuate as well. I agree with you though, the signal from the negative side of the coil does look like that on the scope if I'm looking at only the signal from the coil.

Hi,
What is the resolution of your digital readout?
Does the line of LEDs jump about too?
Look at the input to the LED side of the opto.
Tom... :slight_smile:

Yes, it jumps around a lot as well. I'll get the scope back on it tomorrow so I can get another assessment of the signals.

Hi

What is the resolution of your digital readout?

Don't try for 1 RPM resolution, that digit will be changing all the time, your engine RPM is nowhere near that stable.
10 RPM is the usual resolution.
You need to check the input to the opto, google clamping circuits
There are a number of circuits, most just use passive components like diodes, zeners and resistors.
A good chassis connection is essential, not just a thin bit of wire.
Bypassing at the buck converter would also be advantageous.
Where is the opto located? I hope it is not on that PCB on the Nano, keep it separate so that the spikey primary cannot get anywhere near the nano.

Tom..... :slight_smile:

Look at my first post and the pictures attached. In 1.jpg you'll see I have a resistor, capacitor, diode arrangement similar to what you've illustrated. I do not have a ferrite core however as you've suggested.

Ahh, it wasn't on your hand drawn circuit. Anyways, if the signal is as TomGeorge has illustrated, it would be rather difficult to signal condition (but not impossible). Yes, a ferrite core will definitely help with any ground noise issues.

Having exhausted all this and there's still issues, it would be great if you could provide your code. It's certainly possible to software "debounce" your interrupt. I could help with this if interested.

EDIT: What's the values of your resistor and capacitor?

Hi,
The opto you are using, is open collector output, do you have a pullup resistor connected from the opto output to 5V, or pullup in you sketch turned on?

Tom...

Ahh yes, TomGeorge, I saw that too ... the diagram slowed me down :wink:

For the H11L1M The output current when high is very weak (100µA) yet the detector can sink 50mA.

Here's an updated circuit:

TomGeorge:
HiDon't try for 1 RPM resolution, that digit will be changing all the time, your engine RPM is nowhere near that stable.
10 RPM is the usual resolution.
You need to check the input to the opto, google clamping circuits
There are a number of circuits, most just use passive components like diodes, zeners and resistors.
A good chassis connection is essential, not just a thin bit of wire.
Bypassing at the buck converter would also be advantageous.
Where is the opto located? I hope it is not on that PCB on the Nano, keep it separate so that the spikey primary cannot get anywhere near the nano.

Tom..... :slight_smile:

The RPM sample size is 10 as you've suggested. You're also suggesting no buck converter? Would that mean I have to use the Raw 12v input on the Mini?