# Speedometer Question

#### Art

Joined Sep 10, 2007
806
Hi Guys,
I expect this to be considered lame....

My car's ECU transmits a certain number of pulses per kilometer traveled for the speedometer to work out the speed. It should be the same number for every kilometer.
Say I know this figure...

What is the formula for Kilometers per hour if I give you
the number of pulses counted over one second duration?

#### hgmjr

Joined Jan 28, 2005
9,029
$$\frac{kilometers}{pulse}\ *\ \frac{pulses}{second}\ *\ \frac{seconds}{hour}\ =\ \frac{kilometers}{hour}$$

pulses cancel and seconds cancel.

hgmjr

#### Art

Joined Sep 10, 2007
806
What does that mean in English for an uneducated git?

#### hgmjr

Joined Jan 28, 2005
9,029
Hi Guys,
I expect this to be considered lame....

My car's ECU transmits a certain number of pulses per kilometer traveled for the speedometer to work out the speed. It should be the same number for every kilometer.
Say I know this figure...

What is the formula for Kilometers per hour if I give you
the number of pulses counted over one second duration?

You have given the following:

- Pulses per kilometer which is equal to$$\ \ \ \frac{1}{\frac{kilometers}{pulse}}$$

- Pulses per second

You know that there are 3600 seconds per hour. That means you have everything you need to calculate kilometers per hour.

hgmjr

#### Art

Joined Sep 10, 2007
806
Sorry, I understand & the result seems correct, thx

#### Art

Joined Sep 10, 2007
806
As a programmer, by English, I meant something like this:
(Pulses counted in a second X 3600) / constant pulses per km.
which I *think* is correct.

#### hgmjr

Joined Jan 28, 2005
9,029
But you asked for kilometers per hour. That means you will need to multiply by the number of seconds in an hour.

hgmjr

#### Art

Joined Sep 10, 2007
806
Sorry, you're right of course. The result has to be multiplied by 3600.
Now it seems there's one more instruction than there has to be!

((Pulses counted in a second X 3600) / constant pulses per km) X 3600

I warned you it was lame

#### hgmjr

Joined Jan 28, 2005
9,029
The question was a legitimate one.

hgmjr

#### Wendy

Joined Mar 24, 2008
22,205
And hgmjr got there first.

#### Art

Joined Sep 10, 2007
806
No worries, I might need more of this type of help very soon (like in a small number of seconds)
So if you're keen, watch this space. Thanks.
I can think procedurally and logically, but the maths behind it is not my forte. I hope you have faith that I "kind of" know what I'm doing and you're not completely wasting your time

#### Art

Joined Sep 10, 2007
806
I could go out right now and fill in the blank (constant pulses per km),
but am already aware that the figure is much smaller than I want it to be.
Maybe through some error of mine, but the result pulse count per second is linear as speed increases, and quite precisely repeatable which is good news.

The number of pulses I can count in one second is 7 pulses
when traveling at 99Kmph as unbelievable as it is.
This is the most accurate relationship I've measured.
The 6 pulses counted in one second clicks to 7 just as the GPS speedo clicks to 99Kmph every time.

I can measure the real time between each pulse for a different approach,
and work out kmph from that, but guess what? I'm stuck with the math!

I can also go out and measure (not quite as precisely),
How many pulses occur per kilometer, but I don't think that information is needed other than to see it is repeatable for each kilometer.

#### thatoneguy

Joined Feb 19, 2009
6,359
Why not just look at your GPS $$\reflectbox{?}$$

#### Art

Joined Sep 10, 2007
806
I found the error that was causing my count to appear so low
so it appears I can work out pulses per kilometer and use the first formula.
Why not just look at your GPS
A computer has to know the speed so it can take action based on that, not to tell me what the speed is.

#### thatoneguy

Joined Feb 19, 2009
6,359
Using GPS, why not measure the number of pulses per second when going 90km/h?

That would make it a simple frequency problem without much math to work out.

#### Art

Joined Sep 10, 2007
806
I can do that later tonight.

EDIT,, there's 63 pulses per second @ 99Kmph speed measured by GPS.

Last edited:

#### thatoneguy

Joined Feb 19, 2009
6,359
Ok, drop it to 70 km/h, then 40 km/h and finally 30 km/h, measuring pulses per second at each speed.

You should end up with a linear fit function for frequency at any speed if you plug the two numbers in to Excel and do a curve fit.

#### Art

Joined Sep 10, 2007
806
I am going to have to look at pulse width instead of counting pulses per second eventually.
If there are less pulses counted in a second than the number of
kmph which is to be printed to the display, there won't be a formula that will display every increment from 0-100.

Works though

#### thatoneguy

Joined Feb 19, 2009
6,359
Pretty cool display! I love VFDs if I can find one that has all the stuff I want on it.

It looks like you don't spend much of any time in the 0-10 km/h range anyway.

#### Art

Joined Sep 10, 2007
806
And it can talk using Roman Blacks btc algorithm!
I know the forum's stance on auto projects,
but I won't detail it here, or ask electronics or programming questions.
Just here for math.

At the moment I'm testing it speaking the top speed every time it is bumped up