digital tachometer project


The design of a modern digital tachometer

formula1sm.jpg formula2sm.jpg


At first glance, a tachometer seems like a simple enough instrument - and in some incarnations, it is. You need to determine the speed of an engine for a number of performance reasons, from fuel economy, to engine stability, and most certainly driving performance.

All of those goals get complicated when you start digging down - what is the best way to determine the engine speed? How do you do this reliably? Is the pickup mechanism accurate? What is the best way to send information to a computer? How about presenting that information to a casual driver? What about a driver under high-stress racing conditions?

The futility of using instruments I didn't like in racing conditions bothered me. That's why we started doing what we do - necessity. Imagine that - instruments made by someone who actually uses them. What a concept! 

xtachv.jpg tach_lit_sm.JPG

 The xTach mk V - see 'products'


I started work on a racing tachometer when I was in university, and built a crude, but functional wire-wrap prototype. I then built a much smaller, but still not optimal version based around a LM2917 frequency-voltage converter IC. Both had their obvious problems. After becoming frustrated with commercially available equipment, when I got involved with racing on a more serious level, it became clear what I needed was a dedicated instrument.
This project is made available for everyone who asked for help over the years in building their own, or had problems getting something to work. Hopefully this will save you some time. Since I put up the original project, I recieved enough feedback to motivate me to do this writeup in all it's incarnations and edits. I hope this puts to bed the tachometer demons forever!
You can purchase this project in kit form - or as a finished product. The source code and schematics are avaialble with purchase for noncommercial use.  If you're interested email This e-mail address is being protected from spam bots, you need JavaScript enabled to view it  
Xtach mk II - the first generation

how it works:

Automotive tachometers provide a measure of how fast the engine crankshaft or main shaft is turning. Exceeding this is obviously quite bad for the engine, and in a performance application the tachometer is the most important tool a driver uses. Flexibility and absolute accuracy in how this tool operates was the driving force behind developing the tachometer board.

Tachometers can tell you other things too; when wheels slip, how fast you are travellling, how rapidly you are accellerating. Under race conditions, the tachometer reading at corner exit is the primiary indicator of how well you judged the apex.

How this is sensed depends on the type of engine. The most common way in a gasoline, or internal combustion engine is to tap into the ignition signal; for a standard 4-stroke engine, there will be two ignition pulses per rotation. In a mechanically-actuated ignition, this doesn't tell you how fast the engine actually IS going - often, it tells you how fast the ignition thinks the engine is going. 

In a diesel or electric motor application, there is no ignition, so sensing RPM needs to be done with an external sensor on the crankshaft or other linked rotating assembly. This is commonly done with a hall-effect or variable reluctance sensor arragement. 

Once a source of pulses has been found, the signal needs to be cleaned up. Your average mechanical and cheaper electronic tachometers do not worry much about glitching - they average, often using the mechanical inertia of the needle to provide you an approximate signal. This solves many problems, but leaves you with an inaccurate instrument affected by vibration and limited to the response of the mechanicals. The practical impact of this on a race course is you cannot push your engine to the limit you wanted, and as a result, you are slower than you might otherwise be. 

Seems simple enough right?

There is, of course, a problem - noise.  Your ignition is a wonderful source of the worst evil imaginable - radio frequency interference. It's pulses get transmitted to every wire and sensor that is not shielded. The nature of capacitive discharge and other high power ignitions means large current pulses are present. Noise is transmitted as a result of conducted spikes from the ignition coil,  or transmitted via radio frequencies through the air. This pulsing causes a very fast oscillation that is a challenge to measure accurately.

Accuracy is the key! Mechanical tachs and some electronic ones rely on averaging to deal with glitchyness. This works, but results in two unacceptable (to me) things: Sluggish response and a inaccurate measurement.

The goal whould be to measure each and every data point available - in this case, each ignition cycle.  If that is not possible through the ignition, then another pickup should be used. This is less of an issue with a diesel or other electric engine - dedicated sensors are placed to provide an accurate measure. OEM applications frequently have a tachometer output. Race applications frequently don't.


pickup schematic:

This board was primarily designed for use with 4-stroke gasoline engines driven with an engine management computer, or an elecronic ignition providing a clean 12V output. The ignition systems in these types of motors is especially nasty on microcontrollers; spikes of over 400V are not uncommon to have to deal with, or even worse on a high-output performance ignition.

This is done primarily with a transient voltage supressor and an optoisolator. This produces a nice clean input into the microcontrollers external interrupt. Optoisolators are especially well suited for this type of application - the type of voltage spikes present have little current and are easily rejected.




Notice that the TACH IN- return signal is routed external to the board. It is important that this be grounded very well at a point external to the board, perferably direct to the chassis. This helps keep spikes isolated away from the microcontroller.

The signal is first clamped with a high-performance transient voltage supressor (TVS) (~20V), then run through a 1N4001 diode to take most of the heavy abuse and handle the reverse voltage present. This arrangement is current limited via a 420ohm resistor, filtered again through two capactors to remove frequencies 1000hz+, and finally to the optoisolator that generates the clean signal for the microcontroller.

PULSEOUT is then wired directly to an external interrupt on the AVR. Driving the input off a timed interrupt guarantees that the tachometer will not "miss" pulses; each ignition cycle is precisesly timed and used to calculate the RPM for display.



Errant pulses caused by an excessively noisy signal pickup


What if this isn't enough?  We ran into a situation on our test RX7 where the electronic ignition module they were using had much too much noise for this setup, and driving off the coil wasn't an option with the multiple spark discharge ignition setup.  The oscilloscope captures above were taken directly off the output from the Crane ignition box - garbage in, garbage out.

To this end, we experimented with a small secondary filter to be installed near the pickup source or the ignition coil. It is comprised of a schmitt trigger arrangment - it looks for a signal above the activation threshold, around 2.0V. Once this signal has been detected, it will hold the value at this level until the low threshold is reached - about 1.5V. This prevents the signal from "oscillating" from the ground trigger.

<< schematic and filter shots >>

It helped, but it wasn't what we wanted. So we set out to derive some DSP techniques in the microcontroller to clean up the signal and reject false inputs. 40 hours or more of testing later, we came up with some schemes that rejected the errant signals, smoothed the output nicely, and most importantly - perserved an accurate measurement. It's better to have a clean input to start with - but not all applications have ECUs.


alternative sensing:

If you don't have an ignition, you need a way to generate pulses that relate to the engine rotation. An easy way to do this is with a hall effect sensor; mounting two rare earth magnets on a flywheel spaced 180 degrees (to maintain balance) is the only modification required. Placing a hall effect sensor close to these magnets will generate a 12+V pulse that can then be fed into the tachometer board. By using two pulses per revolution, no change is needed to the software.

Here is an example of this technique on a diesel Mercedes that was imported from Germany with no tachometer. You can see where the rare earth magnets were epoxied to the flywheel. The hall effect sensor in this case was an open-collector model, so a simple pull-up resistor was wired in to generate a +12V square wave pulse.

Another approach is to use an inductive proximity pickup capable of handling a signal of several hundred cycles per second. This would allow sensing of an existing timing tooth, or other metallic pickup. We have even seen optical sensors used - a mark with some white paint in a relatively clean area will provide a good signal pickup. It depends on the application - if you want things done right, you need to do some work. There are rarely any shortcuts.

Using an isolated pickup technique like this provides the cleanest, most accurate and error-free means of determining your engine's actual crankshaft speed. Delve into any modern ECU crank angle sensor and you'll see that's exactly how it's being done.

<< schematics of various pickup types >>




calculating RPM:

Some math is needed to determine the number of pulses per revolution. Given that we get two pulses per revolution; the microcontroller is used to measure the time between each one of the pulses. From that time, we can calculate how many revolutions will happen in a minute based on the current speed of the engine. Using an interrupt-driven approach complicates the software, but allows you to be accurate and quick.

To go from a pulse time in seconds, to an RPM figure for an engine, is straightforward:

Time_per_pulse_seconds = (number of clock cycles timed) * (1 / CPU frequency in HZ) 

Time_per_pulse_minutes = 60 seconds/min * Time_per_pulse_seconds

RPM = Time_per_pulse_minutes / Pulses_per_rotation


display considerations:


Initially I developed the tachometer with a remote display; this proved to be inconvienient for a bunch of reasons - almost everybody who purchased or was interested in the project had one goal - something as small as possible in an attractive, perferably indestructible case. The compromise I came up with in the most recent version of the tach was to set up the boards so that they can stack a display on top of the signal board. This would allow for different faceplates, but still maintain a compact package. For example, this allowed us to use the same PCB for the 4 and 5 digit version of the tachometer.

 displayfront.jpg displayback.jpg

Early prototype display on the mk IV 


Digital technology is great - custom displays can be quickly made to any application. This same technology was repacked for another high performance application - RB Racing's ORCA Tacometer.



 RB Racing's ORCA Tachometer


 Current Multifunction Display


Why LED 7-segment displays?


The board's native display technique is through a LED 7-segment display driver. 7-segment displays are well suited to this type of instrumentation - they're inexpensive, the microcontroller has a lot of spare IO we can use, and they are very bright in sunlight. One thing you don't want to have difficulty with is reading the display. LED lights have the advantage that they're not encumbered by polarized sunglasses or visors. They're very easy to read quickly at a glance, and with the addition of some tint film, have very high contrast compared with more typical (and cheaper) LCD displays used on a lot of instruments.

Look on the top of the steering wheel on any Formula One car - you'll see LEDs prominently marking the shift points and customized to the driver's preferences.

Sometimes bright is too bright! To this end, we had a dimmer mode in software and as a remote optoisolated input. This allows you to wire the tachometer DIM function into the running lights of your vehicle to automatically dim in nighttime conditions.


how do 7-segment displays work?

If you want to wire up your own display, it helps to see how 7 segment displays are connected. The principle behind their operation is very simple, and is the same as how your lights work. If you turn something on and off fast enough - eventually your eye cannot determine that there has been any change. By changing how long we leave the display on for, we can modify how bright the numbers appear to be.


To display a single digit, we just need to turn on each of the lights. To display more than one, we need to use a "common cathode" arrangment for the 7-segments. This means that the cathode side of the leds on all the digits are tied together, and the anode is seperate. Applying a voltage to the anode will light up that segment. Each segment in the display has it's anode wired to a common bus. (see diagram)



So, in effect, all of the digits are wired together - A to A, B to B, etc. Then each of the "common" pins for that digit are individually run back to the microcontroller. So instead of 4 x 8, or 32 i/o lines, we only need 8 + 4, or 12 i/o lines. Much better!

We use the microprocessor to pick which "common ground" is active. So the appropriate value is sent to the port, and the digit is selected. This turns the lights on. The micro then quickly changes which common ground is active, and puts another value on. Done fast enough, you just interpret the display as reading the value in question.

Any "common cathode" arrangment LED panel can be used with this display. For example, the bargraph output has two digit 'grounds', and 8 segment lights. This lets us make a bargraph from some standard LED elements. To make the display large, I drove two LEDs from each output - so each bank of 8 segments controlled 16 leds, combined into two banks of 32 lights.


rpm triggered output:

There is open-collector transistor output is designed for activating shift lights, or a relay for an RPM-activated switch. The output can drive up to 500mA. The shift point that activates the output can be configured in software, or by the menu.

A convienent package for a shift light is to take a high-output LED and mount it inside a drilled out, threaded bolt with a current limiting resistor. This can then be potted with epoxy (non-metallic) or silicone and panel mounted. Then the LED anode is connected to a 12V source, and the cathode is connected to the tachometer RPM triggered output.

How bright the LED gets is a function of the current. This is set through the resistor choice. Assuming we want a bright shift light, a good value might be around 20mA. Assuming a +12V nominal input, we'd need a resistor that was (12V / 0.020) = ~600ohms. There is an inline 100ohm resistance on the tachometer to prevent an over-current situation.




Simple LED shift light wiring diagram

enclosure design:


Electronics are only half the battle - to be useful, the design is just as important. Off the shelf boxes didn't have the durability or form factor we wanted. The solution we ended up on was to mill a pocked from billet aliminum, and pot the electronics in it. A faceplate was laser cut from 20 gauge stainless steel, making a durable, custom-fit enclosure that's easy to integrate.






You can purchase this product in kit form complete with schematics and source code, including all the necessary tools to compile and build your own version of the source code.



email This e-mail address is being protected from spam bots, you need JavaScript enabled to view it - I'll do my best to get you sorted.