Speed Signal Pulse Modification

Hey guys, I'm pretty new to the Arduino but I've been playing with some of the kits and creating setups for applications in my car pretty successfully so far using the basics. But I have a problem with a conversion I'm working on that I'm wondering if I can't use an arduino to solve. There's basically two parts.

I have a digital square wave 0-5v tach signal out of my ECU that feeds an instrument cluster looking for a digital square wave 0-5v signal, but the ECU is sending 6 pulses per rev and the tach is looking for 4 pulses per rev (6 cyl engine conversion into a 4 cyl car). Right now I can directly trigger the tach from the ECU, but it reads 1/3rd fast (engine speed 4000rpm gives a tach reading of 6000rpm). Can anyone point me towards a sketch that will allow me to use pulsein with a 2/3 multiplier? Or is there some other step I need to take?

The second issue is also a pulse modification, but this time it's for the speedometer and from what I can dig up more complicated. I have an analog square wave 0-12v signal at one pulse per tire revolution coming out of a gear driven sensor on the transmission that is feeding a speedometer that is expecting an analog square wave 0-12v signal that is one pulse per tire revolution. The issue here is the new transmission and tire size do not match the speedometers expected pulse rate (the tires OD is smaller that the speedometer is expecting and the transmission final drive feed to the sensor is higher than the speedometer expects). Since I do not have the drive information on what the speedometer is expecting, I can't calculate the expected multiplier so it will take some experimenting to figure that value out (GPS speed vs. speedometer indicated will give me that) but that means I need to be able to multiply the analog pulsein by some multiplier that is input into the sketch I would assume. The other part of this I got lost in was the voltage conversion of the pulse. I haven't had a lot of exposure to selecting electronic components, but I have used 5v regulators for 12v systems and I thought it may be possible to cut the 12v pulse to a 5v pulse using one of these, but would a component intended to be used for steady state voltage react fast enough for a pulse? And I don't believe it will increase the voltage to 12v if I ran it in reverse so I'm not sure how to handle that either.

I appreciate any help you guys can give. I'm having a bit too much fun with what I can do with these toys so Im trying to get a better understanding as I go. Thanks a lot.

For the tachometer I think you need code that produces a regular stream of pulses at different intervals based on a value stored in a variable. And another separate piece of code that measures the gap (interval) between the incoming pulses and produces the stored value based on the simple formula outGoingInterval = inComingInterval * 6 / 4. I think you can use pulseIn() to measure the interval between the incoming pulses.

Edit to change "width" to "interval"

...R

Do we know for sure that the widths of the pulses matter at all? Maybe only the frequency of pulses matter. Maybe both.

Does the duty cycle (mark:space ratio) change as engine revs increase? If not, the tachometer can't simply be a low-pass filter feeding an ammeter. Some experimentation may be needed to see how the instrument reacts to various frequencies and duty cycles.

For the 12V signal from the gearbox, a simple voltage divider may be enough, say 4K7 and 6K8?

Paul

PaulRB: Do we know for sure that the widths of the pulses matter at all?

I was using width (meaning the interval between pulses) as a proxy for frequency because it is easier to manipulate.

I have edited my original post to replace "width" with "interval" to avoid any confusion.

...R