NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Support Forum » Advanced?

September 28, 2009
by Jesuz
Jesuz's Avatar

I know this might be advanced, or not? I just started with all this.. but one of my main goals are to make some kind of digital read out for my analog speedometer. I was wondering if anyone has done this, or know of where I can get any information on it.

September 29, 2009
by rusirius
rusirius's Avatar

The first question I would have to ask is rather the speedometer is analog or not... I doubt it is... Don't get me wrong, I know it's an analog DIAL, but I'm guessing the signal feeding it is a digital signal from the ECU...

Let me throw some ideas out there for you...

The first easiest way would just be to count the pulses being fed to it... The higher the frequency, the fast you're going... (think the reverse of the PWM on the MCU...) That one would be really simple... Power input from battery (make sure to fuse it just in case) feeding the power regulator, feeding the MCU, which would have a single I/O pin connected and simply collect the number of pulses occuring in a specific time period... Then you can relate that to a given speed... (trial and error on that part).

The other possibility, and this is a little nicer... Take the pulses feeding the tachometer (even if your dash doesn't have one, your ECU does, so you can still find it...). Do the same thing... Then somewhere you'll have something from the transmission telling the ECU (or possibly a dash display?) what gear the tranny is in... Tie that to another I/O... This one is probably an analog voltage so you'll probably have to use the ADC for it... Now look up the specs on the tranny and find out what gear ratios you have (don't forget to calculate in the gear ratio of the transaxle too!)... Now you have RPM and gear ratio (calculated from gear information) so you can relate that to a speed...

The nice thing about doing it that way is that you can now make it "adjustable", so you could clock it with GPS or something and "tweak" it to get it exactly right...

September 29, 2009
by rajabalu21
rajabalu21's Avatar

Please take a look at the OBD II car Computer. You may have to research to find out what standard is used by your car. But, the speed information can be directly obtained without any transducer. All the best!

September 29, 2009
by mcai8sh4
mcai8sh4's Avatar

Hi Jesuz, interrestingly enough, there's another member who's looking at doing the same thing - only his vehicle doesn't have any OBD. We have been discussing this on the IRC channel (freenode #nerdkits). At this point, whilst the theory seems good - in practise it isn't working perfectly.

The chaps name : Capt.

Maybe with the help from the forums and bouncing ideas off each other you could both reach your goals. I speak to him (fairly) regulaly, so I'll let him know you are wanting to do the same type of thing.

Another idea - as Rusirius has mentioned, the trikiest part should(?) be counting the pulses. Perhaps using the pules from the HT leads to induce a current connected to an MCU pin could be used to count the firing times - the rest is maths. OR hall effect sensors.

Also read JKITSONs tractor sled thread (here) does this type of thing (monitoring RPM), so that might be worth a read.

Good luck - keep us all posted on your findings.


September 29, 2009
by dangraham
dangraham's Avatar

If the car has ABS brakes there will be a nice sensor on each wheel for the ABS system. You can tap the signal from this to the MCU, easy to calculate because it is on the wheel its self; just count the teeth on the sensor wheel.

The hard part and part I am still working on is reading this into my program. Below is info from Humberto...Share and share alike.

Using ICP1 is a good idea, however, as that is the pin we use as the programming mode pin I recommend you don't use that pin and instead copy its functionality using a normal pin change interrupt and a normal timer. This will also give you more freedom with which pins you can use, and which timers you can use, and allows you to break up the functionality neatly into the pin change interrupt code and the PWM code which you can test independently. You will be able to set up a pin change interrupt on any pin on your chip. Once you have the pin change interrupt working with your hall effect sensor, id suggest trying to merge in the real time clock code, this is also interrupt driven, and uses a timer to keep time down to hundredths of a second. Using this and your Hall Effect sensor you should be able to output something like RMPs to the LCD.

I am still stuck on how to setup the code for the pins and timers, but working on this.

September 29, 2009
by mcai8sh4
mcai8sh4's Avatar

dangraham : For the clock timer - see the realtime clock example - you can just copy the basic setup code and interupt handler and then you have a variable that increments by one every 1/100th second. (I've done this myself, so might be able to help if you have problems)

For the pin change interrupt, maybe looking at the ps2 keyboard tutorial, specifically seting up the pin change interrupt in the function init_keyboard(); and the handler, ISR(PCINT1_vect)

I haven't played with pin change interrupts yet (it's on my list), but if you have problems, shout out - I may try and get a better understanding soon.

Since I'm new to all this, it's good to figure out a basic example then play around.

October 01, 2009
by Jesuz
Jesuz's Avatar

wow, I am going to look into this as much as possible, even though most of it is a little over my head still.

I dont want to go the way of the obd 2 way, I want to leave that open.

The counting the pulses seems pretty difficult, how does the needle know? It appears to just be some sort of motor?

I do have ABS sensors on my wheels, one of which is bad. So when i replace that I might look into that a bit.

My car is a 92 BMW 325i, I also have a 95 325is. Do you think the signal going to the tach needle would be digital? Anyway to check?

I was thinking about just taking a multimeter to the connector of the RPM gauge and seeing if the volts went up.. which is what I was thinking was happening. Thanks for all the input. Any Ideas are appreciated, Who dosent want a digital dash in a digital world? Needle gauges are outrated.

October 01, 2009
by rusirius
rusirius's Avatar

Jesuz, It depends really... Someone with more auto experience might be able to tell you if there is a standard that has been developed... Or even a google search might be of help... Basically though, as far as I know there are several ways the data could be being delivered to the speedometer... Of course there are serial and other types of links, but given the data and function, I seriously doubt that's being implemented...

Most likely it is one of the two following options... 1) True analog... 2) PWM...

1) I seriously doubt it's true analog... The simple reason is that true analog is very difficult to regulate and to keep consistant, especially over temperature variations...

2) PWM... This is probably the most likely way that the data is being sent... Basically there is a fixed "frequency"... Within that frequency you have a "pulse"... The amount of time that pulse is high or low within that "window" determines what "information" it represents... In other words, to make it easier to understand, let's blow it way up and out of proportions...  Let's say the period or "Frequency" was 10 seconds...  (it will actually be probably in the ms range, but lets roll with it... ;)  If you were going 3 miles per hour, then the signal might go high for half a second, and then go low for the remaining 9.5 seconds.  Speed up to 50mph and it might be high for 4 seconds and off for 6 seconds...  Hit 120 and it might be high for 9 seconds and off for 1, etc...  PWM like this can be used to very accuratly drive motors... In fact, it's the same modulation used to drive servos and the like... If you think of your speedometer as a servo (it probably very much is) then it's easy to picture how this would work.

To "process" this, you just have to find out what the period of these pulses are and that will give you a starting point...

Now here's the bad news...  Unless you can find specific information on this, the only way that I know of that you'll be able to find out the info you'll need is by using a scope.. (i.e. an oscilloscope)... A multimeter won't tell you anything... Why?  Because to a multimeter the PWM will look exactly like an analog voltage.. Because digital multimeters "Average", and are way to slow to respond to quick pulses, you'll see exactly what you "expect" to see, i.e. a low voltage when it's going slow and a high voltage when it's going fast... But that won't tell you if that low/high voltage is being generated as a true analog voltage or as a PWM waveform.. Only a scope will tell you that...  A scope can "look" at the actual waveform and display it exactly as it is...  If it's an analog voltage, you'll see exactly that, a nice flat waveform that changes verticle position (i.e. voltage) as the speed increases...  If it's PWM, you'll see a waveform that varies from high to low at whatever period the speedometer is being driven at... (rising edge to rising edge)... You'll also see the pulses "extended out" as the speed increases...

Now here's the good news...  Getting your hands on one shouldn't be that big of a deal...  If you didn't buy the nerdkit JUST for this project, and really want to play around with electronics, then it's an investment WELL worth the money... In fact, I'd go as far as to say that it should probably be one of your first investments...  Buying a new one would be a pretty large hit to your wallet, but you can find lots of decent scopes on Ebay for reasonable costs... Heck, if you're interested let me know and I'll see if I can't fix you up with a decent analog scope for a dirt cheap price... I think I've got a pretty nice Tektronix 100Mhz analog scope that the only thing wrong with it is the second channel doesn't work... (2nd channel allows you to display a 2nd waveform on the screen at the same time)...

A quick note about scopes if you go this route...  You'll find the first choice is digital or analog... Analog scopes are typically cheaper and work great for most things... The advantage of a digital scope is that you can look at very long intervals or long pulses... An analog scope really doesn't do a great job of this because the "past" information "fades" off the screen before the new info arrives... On the other hand, they are great for most things you'll ever do...  Digital scopes are kinda the opposite... They are great at looking (and capturing if it's a storage scope) at very slow periods of time... Here's the catch though... Because they take "samples" at certain intervals, most digital scopes are very good at catching very fast "glitches" etc...  To get a GOOD all purpose digital storage scope you'll usually end up putting out a fair bit of cash, or at least waiting for the right deal to come along... I personally use a Tektronix 2440 DSO... It's an old scope (mid to late 80's I think?) but it was absolute top of the line in it's day and is riveled by few others even today...  I think it's price was around $13,000 new, and I managed to pick mine up off ebay on a sweet deal for about $400... You'll find quite a few "cheap" scopes with very low bandwidth...  They might suit your purpose for this project and a lot of others, but sometimes you do get what you pay for... There's a reason Tek and HP scopes cost so much money new... ;)  Here's the other thing.. If you buy a good used scope, you can always sell it on ebay later for probably about the same price you paid for it... They really don't lose much value over time after they're older... I could easily sell my 2440 for probably $500-$1000...

 Now, here's the second bit of good news...  If you are just working on this project, or don't want to invest the money in a scope, you might already know someone that has access to one... (given your project)...  Because so much of a car is computer controlled and based on electronics, most decent auto repair shops will have a few scopes laying around... They're usually portable hand-held models with lower bandwidth, but they'll suit your purposes for this just fine... So if you have any friend or know anyone that works in a garage, I'm sure they can fix you right up...

Last but not least, if you decide to purchase one, I'd be more than happy to answer any questions you have and I'll even have a look on Ebay for you for a scope that meets both your price range and usage...  Just let me know what kind of stuff you'll mostly be doing to help me figure out what your "requirements" are, and what your budget is and I'll see what I can dig up...  You can post up the info on here, or just shoot me an email at

Hope that helps!
October 02, 2009
by Capt
Capt's Avatar

Helo! I've working on the same prodject, Or i was, I've hadn't had time to do more. Hope that i've get more time soon.

I've got it "working" in some way, Could count up to ~4 Km/h.

My program was a mixture of the real time clock and my own code. It worked as this:

Wheel passed the hall sensor, And added 1 to a value Then when the value counting 4, i've calculated the average speed over the 4 Rounds.

The problem was that i've used to mutch time to update the display and didn't use interupts (i've think).

The speedometer on older car's uses a wire from a sprocket in the transmisson,

This sucks becaus if you change the dimension on your rim, the speedometer is wrong. The rpm is counting pulses from the coil (divided on the amount of sylinders/pistons) By using optocuplers you get an digital signal.

for testing i've attached a hallsensor from a bicycle speedometer to a bicycle upsinde down.


Post a Reply

Please log in to post a reply.

Did you know that any circuit of voltage sources and resistors can be simplified to a "Thevenin" equivalent circuit? Learn more...