Please help with my car tachometer

I am trying to make a digital tachometer, and is going on too long by myself, frustrated and need help please.

I am using a 817c optocoupler, attached to a resistor that goes to my vehicles "rpm" wire that I got from going on Toyota forums and reading the service manual.

My opto circuit looks like this (to capture signal from tachometer wire of truck):

I have arduino project I bring under the hood, hook it up to get a reading sent to 16x2 lcd screen. I capture the # of "RISING" pulses (if I change to falling, the number is the same). I sample for 1,000 millis() - which should be 1 second.

The number of pulses I capture is 200, 205, 207. The dashboard reads about 1,000 rpm at idle, maybe 1050 rpm possibly.

205 pulses x 60 seconds = 12,300. The engine is not running 12,300 rpm at idle, for sure. I also read on forums, the tachometer wire will read 2 pulses per revolution. If I divide the number by 22, is still 6,000+ rpm (way off). I also read to divide the number of cylinders (which is 6 cylinders), and that number is not close.

Can anyone advise me on where to go from here? I do not own an oscilloscope, so I can't test the signal with that.

(205*60)/6/2 = ?

The other potential issue I see - depending on just where your opto isolator is, the wiring can be critical - the automotive environment is notoriously "noisy" (especially if any of your wires go anywhere near the spark plug wires - even resistor plugs/wires have a significant magnetic pulse when they fire.

I'm with Coding Badly.

205 x 60 = 12,300
12,300/2 = 6150
6150/6 = 1030 rpm

So... what else is required? That simplifies out to pulses/5 = rpm.

"polymorph" & "Coding badly" - thank you for your replies. That solves my issue. I have been working so hard to solve this simply obvious issue. I just needed a 2nd set of eyes on my problem.

gpsmikey: Yes, automotive has noise. If I get stable results and the device works - then I guess it works, until it breaks.... There really isn't a limit to the number of stuff working against me.

Actually, I was getting different results by changing the resistor on the 12v input side of the optocoupler. One of them made the results lower then then dashboard reading and the other one made abnormally higher. I think I put one in that was too low a value and was actually interfering with the rpm gauge in the dash.

What resistor value did you end up using?

2.3k ohm resistor, 1/4 watt. I am also using an 817c optocoupler, since I had those laying around.

DocStein99:
2.3k ohm resistor, 1/4 watt. I am also using an 817c optocoupler, since I had those laying around.

Lots of very important "designs" are based on "hmmm - lets see what is in the junkbox today" (which is how I often start. If I find I need something I don't have and it seems like a good thing, I will get 10 or so depending on the price so I have a stock for next time).

Lost without my Junkbox !!

Yea I'll buy 10 of something, use 1 or 2. They sit for 2 more years, then I will need 9 - if I am lucky to remember which of the 50 boxes it might be in. THEN, like the opto couplers, I have 817c and 816c for some reason, and I have to spend an hour reading both data sheets and finding a tutorial to match it up. It still takes less time then waiting a week for parts to deliver...

I don't see why the number of cylinders could change anything here :confused:
A revolution is a revolution.

Anyways, you could use the analogReadSerial Sketch and the Serial monitor + excel to see what your output looks like. If it's a nice square-wave your electrical setup is fine.

lg, couka

I have no idea what the car is basing that pulse rate on.

I built a wireless tachometer, it worked by picking up the noise pulses from the sparkplug wires. So you had to know if it was 2 or 4 cycle, and how many cylinders.

If it has electronic ignition the rpm sensor will have triggers for every spark surely?

That would explain having to do the math to get the output in RPM.

Automotive is so confusing to me. I thought all ignition was electronic. Why 2 pulses per cylinder, per revolution is also a mystery - I guess 1 pulse for spark and 1 pulse for fuel.

Actually, there should only be one spark per cyclinder every other revolution on a normal 4 cycle engine - one upstroke is compression (fired near the top) and the second upstroke is exhaust to push the exhaust out of the engine. That said, I have seen systems where they fire the plug at the top of every stroke because it is easier and the exhaust is already burned, so the spark there does nothing (except increase the wear on the plug electrodes).

Ok. I have been testing for a few hours now back and fourth with inconsistent results. So I setup 2 arduino's on my desk, 1 as the tachometer and 1 as a signal generator using the tone() function on pin #3 output.

When I tone (3,32) - the tachometer arduino board reads 32 pulses. Same for tone(3,31). If I do tone(3,30) -- THE TACHOMETER reads 1952, 1953, 1954 pulses. I'm confused...... I have a 1k resistor between pin 3 on the signal generator arduino and the tachometer arduino. Tried 2k resistor, same results.

Nevermind. I found the minimum frequency handled by tone() function is 31.....

DocStein99:
Automotive is so confusing to me. I thought all ignition was electronic. Why 2 pulses per cylinder, per revolution is also a mystery - I guess 1 pulse for spark and 1 pulse for fuel.

The modern engine does not have a HV distributor, they have an ignition coil for each pair of cyclic opposing cylinders.
So when the ignition coil is fired both cylinders fire, one on compression the other on exhaust,.
Ignition sync is taken fro the crankshaft and ignition timing is taken from the camshaft.
A four cyl engine has 2 ignition coils, 6cyl has 3 and a 8cyl has 4.

Others have a coil for each cylinder
http://arrc.ebscohost.com/ebsco_static/repair-tips/8852CH13_DISTRIBUTORLESS_IGNITION_SYSTEM.htm
Tom... :slight_smile:

4 cylinder means four pistons reach top dead center once each revolution. So x4. But each one only fires on every other revolution. So /2. Therefore 4 cycle 4 cylinder means 2 pulses per revolution.

It doesn't matter if it is one spark coil with a distributor, or one spark coil for every 2 cylinders, or individual coils on each cylinder.