Skip to content
Pablo edited this page Sep 7, 2013 · 37 revisions

ok, this is something that I've been working for some time.

What I will explain here is how to make work the temperature and speed gauges on the s2000 cluster when we retrofit it to a civic/integra/del sol etc... As we all know, this two gauges are the only from the s2000 cluster that didn't work as all the other elements that are almost “plug and play” soldering wires.

Why temperature gauge doesn't work?


S2000 uses a different temperature sensor, I am not sure about what i'm going to say now but I think that s2000 sensor it's in some way analog like our civics but this sensor is wired straigth to the s2000 ecu, where that ecu convert the analog signal to a 0-5v digital signal that goes to the cluster. So the important part of this is that in our civic we have an analog sensor and the cluster is waiting for a digital signal, here is the problem. How to fix this? Easy, we need to convert an analog reading to a digital pulse knowing it's correspondence.

Why speedometer gauge doesn't work?


First of all we need to understand what is the VSS. VSS stands for Vehicle Speed Sensor, it's a simply axis attached to the gearbox, this axis have a electric-magnetic sensor at the end, so, when the axis spins a rotation we capture 5v during some microseconds, all the rest of the rotation we capture 0v. That 0-5v “digitalish” signal is faster when the car is going fast and more slower when the car is going slow. The problem why we can't wire our civic vss direct to the s2000 cluster is because s2000 vss is faster than civic one (gears and ratio issues from so different gearboxes) so the cluster is wating for around 37 times faster pulses than expected, for the cluster, that digital pulses that output the civic vss are as slow as 0 mph :( We need to capture the output of the civic vss and basically divide the time of the pulse by 37 to get it more faster, so we equal it to same pulse that s2000 vss will output on the same speed, it's like if we were emultaing the s2000 vss using the civic vss.

Ok, the goal is to make that electronic things without using the famous combo of speedohaler and modrifry ect converter, using cheap electronics. In my case I will use the microcontroller Atmega328P-PU, why? Because it's the brain of the arduino board, a very easy learing open-source electronic platafrom coded in C++ with TONS of info on the net, you can do this with other components like pic's but I don't have/like too much the way are coded this things, you need some level of knowledge on pics and it's infinite more difficult than do this on arduino (at least for me). Summarizing, the arduino allow us to input/output analog/digital signals and treating them like we want.

PWM


Once we are here we need to meet with Mr. Pulse Width Modulation a.k.a PWM. PWM is a digital way to create a square wave, a signal switched between on and off (0-5v in our case) in most cases is used to simulate a custom steady voltage, but for now forget this last. The duration of "on time" is called the pulse width. The period of the PWM is the duration of a full cycle, in the picture the period is 2ms beacuse the time between a pair of green lines are 2ms. The duty cycle is a unit of measure that measure the duration of the “on” period in a determinated scale, in arduino case, we have the function analogWrite(x) to get PWM. The x factor needs to be a number between 0 and 255 were 0 is 0% of duty cycle (always off 0v), 255 is 100% of duty cycle (always on 5v) and 127 is 50% duty cycle.

pwm

As I said arduino have the analogWrite function to make PWM easier but have a problem, it doesn't let to set a custom period, it's a fixed value and we can't do nothing, that is a big problem because as we will see now the cluster needs digital signals with diferent duty cycles and different period. We can do custom PWM signals without the analogWrite function, the key is to know that we can set a pin on arduino outputing 5v, later use the the delay functions with the time we want to hold the 5v and later output 0v. That way is ultra custom but has a big problem, we need to read the vss pulse and later do that stuff, the problem is that when we are reading the pulse we are not outputing nothing to the cluster, so it will load 0 mph during the proces of reading, we can't read the vss and do the code for output the digital signal at the same time (seems that arduino and threads are not friends or atleast I don't find the way). We need to find something that allow to pwm independent (like analogWrite) and with custom period (like last way).

The solution is to use an external library for arduino called TimerOne wich lets to do PWM signals with custom period and duty cyle, so really pleased with the guys that done that because without it I don't know how the f uck would done that (http://arduino.cc/playground/Code/Timer1).

Ok, now we can send digital signals to the cluster without any problem, now we need to know what exactly we want to send for the cluster understand us.

Temperature gauge details


This gauge has 7 segments, the first one is always on.

1 segment = 150ms low 30ms high (always on in fact)
2 segments = 220ms low 30ms high
3 segments = 300ms low 30ms high
4 segments = 400ms low 30ms high
5 segments = 700ms low 30ms high
6 segments = 1100ms low 30ms high
7 segments = 1500ms low 30ms high

civic sensor is analog, we will read the voltage and match this voltage to x segments sending the correct pwm signal. When we want to read a voltage, in electronics that means using an adc (analog to digital converter), arduino UNO has a 10 bit resolution adc, so that means when we use the analogRead() function will return us a vale between 0 and 1023 where 0 is 0v an 1023 is 5v.

Matching adc value (10 bits) with temperature:

ADC    celsius
71       113º
87       104º
106      96º
131      88º
200      79º
1024     71º

In our case we are going to update the ect value reading the sensor only every 5 seconds.

Speedometer gauge details


As we commented before, civic vss is 37 times slower than s2000 vss, so using the function pulseIn() of arduino will read the pulse and get the duration of it, we will divide that time by 37 to get it more fast, once we got our new time we calulate the signal period factor and launch the new pulse. This procedure is done as fast as arduino can.

Code


before, I need to said something, we cannot do this with only one arduino, that's why we need to get speedometer refresh as fast as possible, so that means, if in the middle of our process of reading the vss and launching the new pulse to the cluster we do all the stuff to get the engine coolant temperature (ect) too means that speed display will have “lag”, and trust me because speed goes crazy going to near 0 and returning to the correct value all the time. So, we need 2 arduinos, I mean, 2 Atmega microcontroller to get them do only one task (speed or temp).

Setup


I won't be using arduino as they are, arduino is only a platform, we can save our arduinos soldering the atmegas onto a breadboard, the atmegas are around $5 each and the other components are cheap. You only need the arduino to load the code on the atmegas. I setup all in a plastic box.

setup

The pinout of the cluster are on the net, it's not difficult. Note: I don't know why but you can't get the ect from the cluster plugs (at least on a civic eg), you need to get it from the ecu wire (red/white wire on a p30).

Any questions are welcome.

Links:

Special thanks to Orthello, this guy has posted very nice info in some forums about this stuff, total respect.

Clone this wiki locally