Car digital speedometer on PIC. Diagrams and materials Description of the digital speedometer

CONTEST

This article presents a device that is installed in the dashboard of a car and partly replaces the on-board computer.

I'll start with the background.
Once I put a torpedo from a foreign car in the car and realized that the speedometer terribly does not coincide with the real speed indicators. It was decided to install an on-board computer. No sooner said than done. Many functions, etc., over time he refused, and had to do it myself.

From all the functions, I realized that I really only need a few basic ones, so I did.

On the Internet, I spied something separately and brought it all into the finished device presented below.
From the required readings, I chose: a voltmeter of the on-board network, a speedometer and an odometer (total mileage is not resettable, and daily, resettable).
Also, in my panel I did not show the standard indicator of the fuel level in the tank, I put a switch for the voltmeter readings, it shows either the voltage of the on-board network or the voltage drop across the tank sensor. The readings, of course, are not in liters, but in some numbers, so I remembered the readings of an empty tank, a quarter, a half, 0.75 tank, and a full one. And according to the readings, I can be guided by the amount of fuel in the tank.

Now about the scheme.

The voltmeter is assembled on a pic16f676 microcontroller, I used PNP transistors
Indicator with a common anode, with dynamic indication for three digits.
The speedometer-odometer uses a pic16f873a microprocessor, transistors operating on anodes, reverse conduction, an indicator for a three-digit speedometer with dynamic indication with a common anode, I took two indicators with OA with dynamics for the odometer.

Sensor Description :

The work algorithm is as follows:
The voltage of 12 volts from the battery is always supplied to the circuit, but from the leg of the ignition lock 15/1 it is supplied to the circuit as power, and to the leg 21 MK, and when the ignition is turned off, the circuit does not immediately de-energize, but data on the mileage is recorded in EEPROM of the controller, when the recording was successful, the microcontroller gives a command to the keys that remove the supply voltage of the entire circuit. During recording, the odometer indicator lights up the inscription "record"
The printed circuit board has a switch that either supplies power directly to the anodes of the speedometer, or runs through a resistor, which, in turn, at night, "mutes" the brightness of the glow, so as not to dazzle, but who does not need, you can put a jumper on the board. (which I did at home)
When you turn the ignition key, the voltmeter, speedometer and total mileage readings light up, to switch to the daily mileage, you must briefly press the reset button, And to reset the daily mileage, you must hold the same button for a long time, and the word "reset" will appear on the indicator
The circuit works on my machine, and already on a friend's machine. So the circuit is fully operational and tested in the field.
And yet, in the voltmeter, instead of a trimming resistor, I put a constant 13 kOhm (in my case) so that the readings do not get lost under the influence of vibration.
And yet, the photo shows the board from the first experiment, the tracks are not completed there, but you are presented with a completely finished board, with all the changes.

Photo of the finished device

REFERENCE! This speedometer-odometer has nothing in common, except for the principle of operation and some functions, with the speedometer-odometer of Dear MAMEDA. The device was created in 2004 and went around the Internet a little with a tachometer, and did not find support at that time, apparently due to the shortage and price of the microcontroller. Draw your own conclusions!

The device measures the speed in the range of 0-999 km per hour, and also has 2 mileage counters - this is the total and daily mileage. The daily odometer counts not only hundreds, but also tens of meters, as well as thousands of kilometers, which can be called a feature of the device. All functions are controlled by one single button. The indication is made on 7-segment LED indicators: 3-digit without a dot for speed, and two 3-digit (or 6-digit) with a dot for mileage counters. The device is calibrated for a 6-pulse speed sensor and a mileage ratio of 6 pulses per 1 meter.

More about the operation of the device: When the ignition is off, the indicators are off and the current consumption is negligible. If you turn on the ignition, the device turns on all segments of the indicators for self-diagnosis (it will be immediately visible if which segment is faulty). Then, after a couple of seconds, the device starts displaying the speed and the previously selected mileage, by briefly pressing the button, the display mode of the daily or total mileage is switched. When the display shows the daily mileage, a long press (more than 2 sec) will reset the daily mileage counter. After turning off the ignition, the device displays the word "RECORD" for a few seconds and all odometer values ​​are recorded in the non-volatile EEPROM memory, so even disconnecting the battery will not reset the odometer.

Each counter has its own format:
General odometer XXXXXX (least significant digit 1 kilometer) 6 digits, no dot.
Daily odometer XXXX.XX (least significant digit 10 meters), 6 digits, 4th point is lit

This device is calibrated for a sensor that has 6 pulses per meter, or 1 meter per revolution. This formula is suitable for most vehicles. (For example! The speedometer is made for a Japanese car, in which 0.62 revolutions is equal to 1 meter (or 1 revolution of 1 mile), and in order not to violate the formula, there is a sensor of 10 pulses per 1 meter (0.62 revolutions = 1 meter = 6 pulses, or 1 revolution = 1 mile = 10 pulses).
The instrument can also be calibrated to work with virtually any sensor and travel-to-pulse ratio. This can be done by editing the source text.
Copy the source code into the "MPLAB IDE" program, edit and compile the new corrected HEX file.

IMPORTANT!!!
It is better to put quartz, KX-3HT 10.0 MHz. This is a thermostable resonator operating temperature: from -40 to 85 ° C, it is several times more expensive.
On LEDs for uniform illumination of inscriptions, cut off the lenses and mat the surface in any way available to you.

The car digital speedometer offered below is intended for installation in cars with standard analog speedometers, controlled by electrical impulses coming from the installed speed sensors. It is also possible to use such a device in the case of self-installation of such sensors on a car.

The speedometer is based on the widely used PIC16F84A-04I / P microcontroller from MICROCHIP. SC10-21YWA LED indicators (sign height 25.4 mm, yellow light, common cathode) from "Kingbrihgt" were used as information display devices.
The device is connected to the signal contact of the standard analog speedometer. By pressing the button (duplicated by sound), you can change the brightness of the indicators "in a circle". If desired, you can additionally install a latching button to turn off the speedometer power (not shown in the diagram).
When the car door is not tightly closed (low level signal relative to the body) and the speed is more than 9 km per hour, an intermittent signal is heard, and the speed reading on the indicator is replaced by the abbreviation "dor" (abbreviated from the English "door" - door) switched on at full brightness ...
Power to the speedometer is taken from the ignition switch (contact - "ignition"). Each time it is turned on, the brightness of the indicators is set to what it was previously set by the user. All insignificant zeros on the indicator except for the least significant digit are disabled. When using other similar indicators, it may be necessary to select a selection of current-limiting resistors in the anode circuit of their segments. The sound emitter with a built-in HA1 generator can be replaced with any home-made sound generator with a frequency of 1000-1500 Hz, capable of operating from a 5 volt power source. Drawings of the printed circuit board in the appendix.
Source codes of the program and HEX files for the microcontroller for:

  • Japanese standard (2500 impulses per one km of track)
  • international standard (6000 impulses per one km of track)
  • standard 10,000 impulses per kilometer

are in the appendix.

It should be noted that in the first version, the measurement time and then the display time is 1.44 seconds (for convenience, the software is reduced to 0.72 seconds). In the second version, 0.6 seconds, and in the third version, 0.36 seconds. To set the measurement time of impulses from the speed sensor with an accuracy of 1 km per hour, it is necessary to divide 3600 by the number of impulses from the speed sensor per 1 km of the distance traveled. The obtained value of the measurement time (in seconds) must be entered into the program. For example, 3600/2500 = 1.44 sec. The display time and the change in the indicator readings while driving is quite readable in all the cases presented.

The automobile given in this article digital speedometer can be installed in the car instead of the factory analog speedometer that processes signals from a standard speed sensor.

Description of digital speedometer operation

The device is designed based on the well-known PIC16F628A microcontroller. To display the measured speed, an LED indicator with a sign height of 25.4 mm with a common cathode is used (SC1021YWA - the glow color is yellow). This digital speedometer connects to the same connector as the standard analog speedometer.

By pressing the SA2 button, it is possible to change the degree of illumination of the digital indicator, each press on SA2 is accompanied by an acoustic signal. If the car door is not fully closed, a low voltage level is applied to input 2 of the PIC16F84A. When the vehicle is moving at more than nine kilometers per hour, an intermittent acoustic signal sounds and the display shows “dor” at full brightness.

The digital automotive speedometer circuit is powered directly from the ignition switch terminal. The indication circuit is constructed so that the insignificant zeros go out. The circuit uses a sound emitter with a built-in generator, which has a sound frequency in the region of 1400 Hz. and designed to operate from 5 volts.

There are several types of speed sensors, all of them differ from each other in the number of pulses per 1 kilometer of the vehicle's run. The firmware, which needs to be written into the PIC16F84A memory by means of, processes the input signal of 5 types of sensors, producing 2500, 4000, 6000, 8000 and 10000 pulses per 1 kilometer of run.

To activate the required mode, you need to set the SA1 jumper. Turn on the power and press for 2 sec. the SA2 button. Each press will correspond to: from 1 (2500) to 5 (10000) and then in a circle. If more than 3 seconds have passed since the last pressing, the speedometer will beep, indicating that the selected mode has been written into the microcontroller's memory. After that, you need to remove the SA1 jumper and now you can use the speedometer.

Did you like the article? To share with friends: