×

Polestar

Interactive block diagram Schematic Diagrams Polestar CANBUS Polestar LIN Bus HK Audio teardown Range Calculator

Austin A30

Mechanical Euro Trips Gallery Digital Dash

Archive

BMW Can-bus A30 computer Recipes

Logging

Weather Power

☰ Menu 1955 Austin A30


The A30 Digital Speedometer: A Subtle Modification

 

Basic speedometer theory of operation

The gearbox contains a worm gear located on the 3rd motion shaft (the final shaft in the gearbox that connects to the prop-shaft). This worm gear couples to the speedometer drive that screws into the side of the gearbox, which in turn connects to the speedometer cable.

The speedometer cable attaches to the rear of the speedometer unit. Inside the speedometer is a thin magnet that rotates in proportion to the gearbox output. There is no physical connection between the magnet and the speedometer needle, this is coupled via a metal cup. When the magnet spins it generates a tiny electrical field that moves the cup. The cup movement is regulated by a wire coil called a hairspring.

The odometer wheel is driven from a set of gears within the speedometer. These gears act alongside a small cam that pulls the odometer wheel around, incrementing the odometer count.



Building an electronic speedometer

Why build and electronic speedometer? If you have changed your differential, wheels or gearbox, then the standard speedometer will be incorrect by some margin. I have A35 gears and a 3.9 differential fitted to my A30 but I wanted to retain the A30 speedometer.

The cup and the odometer wheel are replaced with an electronic pick-up and digital display. The cup is replaced with a hall sensor that has been mounted in the original internal frame: a hall sensor is a small electronic device that acts as a switch whenever a magnetic field come close to it. This hall sensor is connected to a small microcontroller (computer). The microcontroller counts how often the switch opens and closes; from this switching it knows how fast the 3rd motion shaft / propshaft is going round. The relationship between the propshaft and the speed of road wheel is a fixed ratio, therefore by counting the number of switches of the hall switch you know exactly how fast the car is moving.

The display that I am using is almost the same size as the odometer hole. The display is connected directly to the microcontroller. All of the text and information that is displayed is controlled by the microcontroller. Displaying the speed is all done by the same computer program that counts the switches of the hall sensor.

Moving the speedometer needle is done by a small stepper motor; this motor is less than 16mm wide and 22mm tall, small enough to fit in the original space used by the cup and hairspring.




How does it all work?

The microcontroller is at the heart of the system, its functions are:

• Count the number of switch pulses from the hall sensor and convert it to speed
• Control the display
• Control the stepper motor
• Calculate the distance travelled (speed vs time)
• Read the external temperature
• Read the engine temperature
• Read the time and date.

The main task of the microcontroller is to count the number of switch pulses that it sees over a 2.7s sample period. This 2.7s sample period comes from a calculation of wheel circumference, differential ratio and speedo drive ratio. The formula shown on the yellow sheet shows how the digital speedo can work with any combination of wheel size and differential to give an accurate display.

There are 2 ways of determining the speed from counting the hall sensor switch pulses:

Method 1,
Count the number of hall sensor pulses that are seen during the 2.7s sample period. The number of pulses counted is the speed in mph. In practice a 2.7 second update frequency for the display and needle movement is too slow, so the 2.7 seconds is halved and the count is split across two 1.35s timers. This gives a much smoother needle movement.

Method 2,
This is a more complicated method but it allows a speed calculation to be made based on a single pair of switch pulses. This method involves measuring the interval between each switch pulse. Using this method you need to ensure that you only trigger and start counting on a known edge of the hall switch; in the example on the yellow sheet the rising edge is being used. The maths and formula for this is shown on the yellow sheet. Given that the measurement interval may be between 2.7s (1 mph) and 34mS (80 mph), the program architecture needs to take into account the large timing variation.

Controlling the display is done by the microcontroller sending a series of commands to configure the display and then sending the relevant display characters. The display is an OLED type; this means that the screen is made up of a grid of 128x32 dots that light up forming characters (or icons). The screen requires only 2 pins on the controller to link it up. The controller has to store and send all of the characters and dot locations to the screen. The screen has multiple levels of brightness, making it bright enough to read in sunlight but allowing you to make it dimmer for night time driving.



The cup and hairspring have been replaced by a stepper motor; a stepper motor is different to a standard electric motor. With a standard motor; when you apply a voltage to it, the shaft will spin continuously until the voltage is removed. With a stepper motor it will only move a fixed amount. With the motor that I have chosen it moves an accurate 18° of rotation with each pulse that is applied to it. I require more accuracy than this, so I have selected a motor that incorporates a small 100:1 gearbox. This means that for every pulse it receives it moves 0.18°. When you look at the speedometer of an Austin A30, the 0 mph and 70mph increments are about 180° apart. This means that I have an accuracy of 1000 pulses between 0 and 70mph (or 0.07mph per pulse). This is a more than adequate resolution for this speedometer. The direction of the movement is selectable depending on the pulse polarity.

The motor is driven by a specific motor driver board. This takes care of all of the more difficult power phasing that is required to drive a stepper motor. This board allows for micro stepping (1/2, 1/4 or 1/8 of a step): if I want it can give me movement accuracy of up to 0.025° per step. The trade-off of this is that the movement is slowed down considerably.

The microcontroller must remember the location of the speedometer needle at all times. Every time that a new speed is calculated, the microcontroller must calculate the number of steps (and direction) that are needed to get the motor to the new position. The program that runs on the microcontroller contains a smoothing algorithm to make the needle movement as fluid as possible. If a large distance is required, each step delay is made quite small. If only a small amount of movement is required, the step size is made quite large. I am working on a self-calibration feature that moves the needle to a known position every time that the car is turned on. This removes the manual ‘calibration’ that is in place at the moment.

The microcontroller has a lot of processing power, mostly unused by the program that it is running. This opens the controller up to performing lots of other extra functions. One of these is calculating distance travelled. The maths for this comes from the simple formula of time between readings and speed. With a typical sample rate of 1 second this gives a very accurate distance calculation. There is an internal memory in the controller that can remember the odometer reading even when the power is removed. I have added 3 counters to the program: an odometer reading for the car, a yearly trip counter and a journey or fuel tank trip.

There are a number of inputs to the microcontroller, again mostly unused. These can be put to use as temperature sensor inputs. There is an external temperature sensor that is placed in the bottom of the front driver wing, and an engine temperature sensor that uses the standard thermocouple in the 1098 head.



Assembly



Mounting the hall sensor



Drill a hole in one of the four legs of the casting (see image above). This hole should be big enough for the hall sensor to fit in. The sensor body will need to be mounted in line with the rotating magnet.

The legs hall sensor will require bending to fit in the hole. The front should be flush with the front of the casting. The legs should have wire soldered to them and then covered with heat shrink or some other insulator material. For electronic noise immunity it is suggested to add a 100nF 25V decoupling capacitor across the power pins.

Fill the hole with epoxy resin to hold the hall sensor in place.

Wiring

   

There are a number of ways to wire the system together.

1) FR4 Matrix board (As used above)

When using this board, follow the wiring diagram above to link the pins of all devices appropriately with ~0.6mm multicore wire.

2) Vero board,

This has a number of conductive lines running through the board, you will need to cut the lines to suite the wiring that is required.

3) Breadboard

This is a good starting block to prototype different wiring connections. This cannot be mounted in the car as a long term solution but is good for bench testing.

Arduino Pro Mini, selection.



There are a number of different Arduino Pro Mini’s available.
My suggestion is the ATmega328p, 5V, 16MHz”

The ATmega328 is the type of processor and amount of program space available. It is possible to use the smaller Atmega168 or even the Arduino Mini that use the ATmega32U4 processor with build in USB.
5V is the interface voltage, I have selected the 5V part so that I can use a standard cigarette lighter USB 12V to 5V power supply to power it.
16MHz the speed of the processor, for what we are doing 8 or 16MHz will work.



A PDF of this page (as was written up for the A30/A35 club magazine) can be downloaded from here