Tuesday, 6-August-2013

Trip computer v.3.0 - and dynamic backlight - Xantia

На български

Here I`ll try to explain what was/is my idea for “home made” trip computer.There is quite many similar ready devices on the market that you can find/buy but unfortunately most of them are developed for OBDII type of cars, what Xantia is not.
Also, you can find few topics over the internet,dedicated on transfer peugeot 406 oem trip computer into Xantia. In my case all began from scratch, based on arduino board.
With little knowledge about arduino board, I found quite interesting topics that people has used Nokia 5110 B&W LCD monitor as screen for some home made devices. And also there are plenty cheap and project-ready ones as module in ebay. And.. i decide to try.

The beginning was bad, and full with lot of troubles of finding proper information.Here are few shots from the process:

project1.jpg project2.jpg project3.jpg
project4.jpg project5.jpg

Then in few months of test,swearing and learning 049.gif i finally get my result.
Same story with replacing the backlight with something more suitable with all green on the dash.

diode-replace.jpg oldscr.jpg newscr.jpg

My car is Xantia MkII 1.8 16V . For it i found few diagrams with wire info, also bought lexia clone to be able to see what approximately injector time I have and for diagnostic also. For that engine, that time was about 1.8ms to 8.3ms depending the load, rpm, and all that crap what the car ECU calculate.
The next step was to get what flow that injectors have. Here I drop on the exell file with some production numbers and info.If you gig the internet for bosch injectors i`m sure it will appear.
It seems that for XU7JP4 engine the fuel flow was max 181ml/min. With that info i start little calculation:
181ml/min -> 181 / 60 -> 3.01666666 -> 3.012ml / sec -> /1000 -> 0.003012ml / ms . If the car have average low rpm pulse about 2.1ms for example then should be -> 0.003012 x 2.1 -> 0.0063252ml / pulse
Because of the nature of that engine, injectors work in groups of two(2×2) -> or single injector inject every engine rotation.

Another example: 900rpm or 900 turns per minute / 60 give 15 rotation per second(15Hz) or 15 injections per second per injector 15 x 2.1ms -> 31.5ms fuel time -> x 0.003012ml / ms -> 0.094878ml x 4 cylinder -> 0.379512 x 3600s -> 1366.24ml / h -> /1000 -> 1.366l / h or that related to vehicle speed will return what we know as L / 100km
I get the start point - liters / hour. All that will “change” value in that equation in any working condition will be RPM and Injector pulse length.

Example - In my case: 14.6hz(850rpm) - 105hz(6300rpm) and injector pulses 1.2ms - 8.5ms(about, depend load , ecu and so on)
or (0.003012ml/ms x 4 injectors work in 1Hour x 3600sec in 1H ) / 1000(1000ml =1L) => 0.0433728
as constant -> 0.0434(constant) x Hz x inject pulse => return car consumption as L/H .

Now i need to check on the injector time - I “steal” signal from 1320A cable responsible for control injectors 1&4. Well, just put wire from there to the dash. The used function was count pulse length with arduino command. Low part of the pulse is my injector time, High is the time between pulses , Low+High for 1 sec give me Hz`s or RPM.. Of course if you wish can be used other ways.. i choose that one as enough accurate. Also,as you can see from the diagram

trip-v3-UNO.jpg

there is also impulses taken from the rpm signal. The reason is to get 0.00L on the display when the engine is used in break mode. That appear when you go downhill on gear and engine rpm rise over 2000. Then the injectors are cut out. The normal state is resumed right after that by pressing the acceleration.

Next signal was for fuel level - that was little problem. Why? Let me to start with the info that resistor attached to floated probe in the tank give ~300ohms when tank is almost empty and ~50 when full. That force me to add little more extra calculation to get the right thing. Why they do not make it 300 for full and 50 fro empty.. i have no clue, but also I`m not so good to electronics so let`s continue.
The next problem that I crash into was the fuel measure itself. For the dash arrow unit has been used some kind of logic to move based on start measure fuel level when the car is just started. Later on, based on(I guess) - vss, rpm, engine temp the arrow move down. So i decide to make something similar. The start fuel value is taken when you start the car from the same signal used for the dash meter. After on, it take every 10sec the current fuel consumption and speed to find average consumption. That is reduced from the start value. The result is shown on the screen as rest fuel level and used to give approximate range of car use.

VSS signal - that is needed for the km/h to be shown or to be calculated L/100 consumption. I have already cable 162B which is VSS signal that goes in the dash.

First the sensor - thanks to mate, I get the info that it has 8 pulses for 1 rotation. From citroen service website i found that sensor gear have 18 teeth , and the shaft gear 22. Or that make 22:18 -> 1.222:1 ratio.
My car is fit with OEM size tires 185/65/15 -> (185×0.65)x2 + 15×25.4 -> 621.5mm -> 0.6215m x 3.1416 -> that give me 1.9525m for 1 rotation. If VSS make 8 pulses for 1 rotation so > 1.9525m / 1.222:1 > 1.5975m for 1 sensor rotation or 1.5975m / 8 pulses > 0.19969m for 1 pulse or if we round - 0.2m/per pulse. Well, that is good. Then one other mate help me with the idea that the car dash is set to use as length of a circular tire arc length - 1.9m not what is in my case 1.95m.
Why? I presume, because when is with load the measured radius from the axis center to the ground will not be 0.6215m / 2 -> 0.31075m but less so the if i take 1.9m as tire length -> 1.9 / 1.222 -> 1.5545 -> 1.5545 / 8 -> 0.19432 m/per pulse -> x 3.6 to go to m/s -> 0.69955 -> 0.6996 < that is my variable or if i have 100hz signal as pulses x 0.6996 -> give around 69.96 km/h If you wish to try, take the VSS signal to some suitable frequency measure device and make 70km/h on dash and then check if you have ~100Hz signal..

With that 0.6996 as constant for calculation and straight hardware frequency counter what arduino have on pin 5, if i make 50, 60,or 70km/h on dash that is what i see on my test menu in that car trip project computer.

Also, by using thermistor positioned right to the original one for A/C control, right of the clock i can show the cabin temperature.

On later state i develop another small board with Atmel Tiny 85 which is perfect chip for that purpose. The idea behind was to have dynamic back light on my rpm counter. I have been little disappointed of that feature missing. Unfortunately for me, the car dashboard have only green foil and any different color range was in calculation => color+green. So i use SMD5050 leds embed in normal bulb socket and controlled from that chip. You can see from the video that i have choose only few combination. The power for that PCB i take right from close positioned bulb socket. On normal bulb for backlight socket i attach cables and use that 12 volts. If you have lights on - that also work. Lights off(dash off) - that also off.

rgb-backlight-only.jpg

That can bi set to any car, and in case of car with normal backlight without any foil you can use 3 channel PWM contorl and to produce any color what you wish. What is quite cool, but for 3 channel PWM you`ll need 328P-AU chip because there are 6 PWM outputs instead 2 as in that chip. Or you can use PIC(for them i have no clue how it will work)

And something as end topic - In my car there are OEM DRL lights. Citroen`s idea with 2 relays.That come to explain that car`s instrument cluster back-light is constant on, unless the ignition key is in position one. Even then my trip comp LCD screen backlight is ON. So, in case you decide to use that “blueprints” add one backlight control attached to the lamp socket to get it ON-OFF with other lamps simultaneously. Good luck!

Files for download:
project files and diagrams
Arduino and libraries needed
(Java is not included you need to install it by yourself)