Introduction: Redundant Car True Speedometer

A speedometer in a car shows always an up to 10% too high speed. Usually

this is around > 5% too much. This is definitive not what. I expect from a measurement instrument in an expensive car, I want to know exactly how fast I’m riding without to calculate the true speed.

So I decided to add a true speedometer in my car without spoiling the appearance of an 80’000USD car as far as possible. Therefore my targets for the project were: Avoid ugly wires as much as possible, hide all electronics as far as possible and it should be as reliable as possible in order to avoid speed tickets.

There are basically 3 different methods to measure speed with a reasonable effort in a car but all of them have certain disadvantages:

GPS is probably the simplest way to get accurate speed information but it requires a certain time after starting the car, doesn’t work in tunnels and has a quite high latency of minimal 1 second. Alternatively can the speed read from the ODBII bus which every car has. It has a security margin on this value as well (like the speedometer) and need to be calibrated if it should be really accurate. But mainly it is a one to one link to the car system and a mistake can have significant consequences. Finally the information can be fetched from a speed signal somewhere in the car. Some of the cars use such a signal for the built in navigation system or as in my case to prevent from dialling a number with the internal hand free while the car is driving. Of course does requires this signal a calibration as well

As a GPS is required for the calibration of the alternatives it might be the first choice but it provides the worst solution for driving. So I decided to use all of those methods and to build a redundancy into the program to ensure always the most accurate signal available is displayed. So I use the GPS for the calibration of the ODBII and speed signal display but use one of the other while normal driving. As a spin off from this I can additionally show the altitude, direction and the time on the display.

Step 1: General Concept

All 3 speed measurement devices are mounted somewhere where they don’t

disturb the look and feel and transmit there data to a display unit which is mounted as nicely as possible. In order to avoid unnecessary, ugly cabling they communicate by an nRF24L01 (RF device) unit. The system software selects the speed information from the available unit. So only one, two or all 3 methods for speed measurement can be used regardless which one are chosen and if a unit fails, the display just chose another source which makes the system redundant. Depending which units are available additional information can be displayed (toggled with the buttons on the ODB and signal unit):

GPS: direction, altitude, time, time since start, satellites in view

ODB: distance since start, time since start, engine on/off (hybrid car)

Signal: distance since start, time since start

Build a unit

The mechanical realisation is pretty simple for all units: Take a case or print one with the 3D printer and wire all the elements “on air” according the wiring diagram. For the power connections (VCC and ground) I used standard stranded wires while I used 0,2mm polyurethane enamelled wire for all the other connections. This polyurethane enamelled wire requires much less space and are more flexible which allows reducing the cable hack inside of the unit massive. When soldering this wire the polyurethane melts and makes desolation unnecessary.

Step 2: Display Unit

The display unit requires:

1 x Arduino mini pro 3,3V

1 x nRF24L01 module

1 x SSD1306 OLED I2C display

1 x LM1117 based DC-DC converter board

1 x standard diode

1 x 0,47 gold cap

1 x 10KOhm resistor

1 x 3,5mm audio plug.

1 x 3,5 mm audio jack

1 x car USB charger (12V to 5V DC conversion).

The display unit is soldered together as shown in the wiring diagram. For the supply a hole is drilled in the dashboard (diameter as the 3,5mm audio jack). The USB charger gets connected with the 12V car supply (switched with the ignition e.g. the cigarette lighter) from the inside of the dashboard. Then the 5V side is soldered to the jack (the polarity doesn’t becomes an essential role but the plug must be connected in the same way) and the jack is glued into the whole. This results in a connection which is smooth and can’t hardly be seen if nothing is connected to it. On the Display side a hole is drilled into the bottom of the display case, the plug connected to the electronics (watch to the polarity) and glued into the bottom.

My 3D case contains a little sun shade. With this the OLED is perfectly readable under any light condition. It’s not too bright in the dark and also can be read with sunglasses in bright sun light.

The display shows the speed alone or in combination with other information. Therefore 9 screens are defined and with the buttons on the Signal or ODB unit the display can be switched between those screens. The screens are in a sequence and with one button it can be switched forward and with the other one backward in a loop. Screen 7,8,9 are for service and maintenance with one of the switches on the ODB unit those screens can be hided (if there is no ODB unit they can’t be hided). The screens are:

1: Only speed

2: Speed and altitude

3: Speed and direction

4: Speed and time since start

5: Speed and distance since start

6: Speed and time

7: distance since start measured with ODB and measured with the signal unit

8: Speed from the GPS, Speed from the ODB and ODB calibration factor

9: Speed from the GPS, Speed from the Signal unit and the signal unit calibration factor

When the car stops and the ignition is switched off, the display shows the time and distance since start for a while. As the display has no power any more when the ignition is switched off this last for about half a minute until the gold cap is empty. If the engine was switched on only very shortly the display shows this only for a few seconds as the gold cap require a bit of time to be charged completely.

Screen 2/3/6 (as well as 8 and 9) require a valid GPS to work. If there is no valid GPS signal no GPS unit available the calibration factor of the signal unit is shown or if there is no signal unit the calibration factor of the ODB unit is shown. As the GPS use a bit of time when switched on until it has a valid GPS fix, this calibration factor will be always displayed when the car is stared. Somehow this may sound a bit strange but is pretty important: The calibration factors (we come later to the details) are stored in the EEPROM. If they are wrong you will drive with the wrong speed and run the risk to collect a speed ticked. With the described mechanism you always will realize if there went something wrong with the memory of this factor. Not required? Yes and No: I had a cheap Arduino used in the beginning and this lost time by time part of his EEPROM content.

Step 3: Signal Unit

Most cars have somewhere a signal which is speed dependent. In my car is

such a signal used to disable the key pad of the Bluetooth hands free. They want to prevent that a telephone nr. is dialled while the car is moving. This signal is speed depending and can be used. The speed in km/h can be calculated with 1800/puls duration/ number of pulsed per kilometre. The InPulse function of Arduino can do that perfectly. Of course usually the number of pulses isn’t known therefore the signal unit has two buttons to adjust this “calibration factor”.

Signal unit

1 x Arduino pro mini 5V

1 x nRF24L01 module

1 x LM1117 based DC-DC converter board

2 x push buttons

1 x 8*8 mm switch

1 x 47kOhm resistor

The elements are connected as shown in the diagram. The 3D case used here makes with soldering pins in the back a kind of connector for easy disconnecting of the unit.

Calibration

The switch of this unit is off for normal operation. In this position it can be switched between the screens of the display. When the switch is on the unit can be calibrated and the display shows the speed by GPS, the speed of the signal unit and the “calibration factor” – which is the number of pulses the car generates per kilometre. (With a pulse length of about 20ms with a speed of 40km/h about 2500 pulses are generated per kilometre). Sounds complicated but is pretty simple:

· Switch in calibration mode

· Drive with a constant speed a straight road

· Adjust the value until the GPS and the signal speed shows the same value

· When they show the same value switch the calibration switch off and the value is stored

· If you have no GPS unit you can use an external GPS and if you need miles per hour simply adjust until the correct speed is shown in miles per hour.

Step 4: ODB II Unit

Since many years all cars have to have an ODB II interface. Which allows

to access the cars internal CAN bus (Usually close to the lever to open the engine hood). From this bus the speed information can be read as well. But also this information isn’t accurate either (It can’t be completely accurate as the speed measurement is influenced e.g. by the condition of the tires) and needs to be calibrated.

1 x ArduinoMini Pro 5V

1 x ODBII adaptor (Serial, USB or Bluetooth)

1 x nRF24L01 module

1 x LM1117 based DC-DC converter board

2 x 8*8 tactile switches

2 x 8*8 switch

The wiring diagram shows how the parts have to be connected. For the ODB II adapter any cheap USB, Serial or Bluetooth adapter can be used. All of them have a serial output which goes either to the USB, serial level or Bluetooth converter. The signal for the Arduino has to be connected there. To figure out where the input of this converter is the converter element can be searched in the internet or the following website shows some pictures about: http://www.konchatech.me/2014/02/obd-ii-arduino-car-information-display.html.

Attention: The ODB II has a connection to the battery but no 12V supply which is switched with the ignition. If the battery is used to supply the unit, it will drain the cars battery while the car doesn’t run. But the unit needs to be powered when the car is started otherwise problems with the car control system can result! (The method with the switch in the internet link is risky as the switch must always switched on before the car is started). Therefore a 12V supply, switched with the ignition, must be used to supply the unit (red connector in the picture).

The switches on the ODB II unit have the same function as on the signal unit and the calibration works also the same way. But this unit have one switch more than the signal unit. This addition switch is to hide the screens 7,8,9 when switched on.

Step 5: GPS Unit

1 x GPS module (Quectel L20 used here)

1x Arduino Nano

1 x nRF24L01 module

1 x LM1117 based DC-DC converter board

1 x 6*6 switch

The element needs to be connected according the wiring diagram. Instead of the Quectel L20 GPS module any other can be used as well but may require some adaptions of the initialisation sequence and baud rate in the software. The switch on this unit is to switch da light saving on and off. The 3D printed housing in the pictures and described in the STL-File has some spare space for an additional GPS tracker (trax) which could be added.

Step 6: Software

The Arduino software comes in two programs. One is for the display and

the other program is used for the Signal, ODB II and / or GPS unit. While the display program can be loaded to the display unit as it comes, the program used on the other units needs to be told in what unit it is loaded. Therefore it’s just required to uncomment the respective unit designation in line 15 to 18. The advantage of having only on program for all units is they run always with the same revision if you make any changes.

Libraries

ODB: http://freematics.com

nRF24: http://tmrh20.github.io/RF24/index.html

Ug8lib: https://code.google.com/p/u8glib/

Possible adaptations:

The time zone is defined with the const timeZoneOffset in line 83

If another GPS module is used the baud rate is defined in line 290 and the initial sequence in line 294 – 298

Material sourcing

All materials can be sourced from many places in the internet. I sourced all materials from AliExpress with the exception of the ODB II adapter which comes from DX (http://dx.com/p/v1-5-obd2-elm327-usb-can-bus-scanner-126938#.UwBI4PldWWY) and the Arduinos which are coming from my local Arduino dealer.

Arduino All The Things! Contest

Participated in the
Arduino All The Things! Contest