s2000 cluster project

orthello

The Dutch Guy
Just today i got the ECT conversion working too. So i will only be a matter of time before an all in one is done.
Well... first of all... respect for the work!! I just found out now what you were doing.
I was investigating the S2000 cauge also from time to time. I also found out the VSS specs and wrote some first software in my microcontroler to have the VSS working.

Well.. it does... on the bench and in the car while the ECU is off. If ECU is alive readings are fine up to 70km/h. Above it will go bogus... until I swich the key off (well turn it one click back... to I). Then readings go all fine again up to more then 130 km/h. Alternator noise is not the cause. Kept the engine 'running' with help of the cars momentum. ;) Readings were fine. It's really the ECU (or coil) screwing things up.

Yesterday I started playing with with the ECT readings. I tested a 60 ~ 5 kHz 5V pulse, but for some reason... or a full bar, or an empty bar, but nothing in between. So I was wondering.... what were the exact specs you found for the ECT to work? How did you connect it to the microcontroller?

The VSS is connected straight to the microcontroller PORTB.1 and works, at least on the bench.
Did the same with the ECT, with the well known results.... What's going on?

Does it help when I draw my schematics?
How about exchanging and peer reviewing some code?
I wrote everything in PicBasic and used a 16F877A

I'm looking for an S2000 in my region to do some scope measurments on the ECT signal.
But till now... nothing found. Next friday I go to the Honda dealer the ask what they know, and to see if there is an S2000 which I can use to do measurments.


BTW... I'm very willing to help with a DIY write-up.
English isn't my native, but I can make myself quite clear.
And I can create schema's and/or PCB designs.
 
Last edited:

konerri

New Member
Well... first of all... respect for the work!! I just found out now what you were doing.
I was investigating the S2000 cauge also from time to time. I also found out the VSS specs and wrote some first software in my microcontroler to have the VSS working.

Well.. it does... on the bench and in the car while the ECU is off. If ECU is alive readings are fine up to 70km/h. Above it will go bogus... until I swich the key off (well turn it one click back... to I). Then readings go all fine again up to more then 130 km/h. Alternator noise is not the cause. Kept the engine 'running' with help of the cars momentum. ;) Readings were fine. It's really the ECU (or coil) screwing things up.

Yesterday I started playing with with the ECT readings. I tested a 60 ~ 5 kHz 5V pulse, but for some reason... or a full bar, or an empty bar, but nothing in between. So I was wondering.... what were the exact specs you found for the ECT to work? How did you connect it to the microcontroller?

The VSS is connected straight to the microcontroller PORTB.1 and works, at least on the bench.
Did the same with the ECT, with the well known results.... What's going on?

Does it help when I draw my schematics?
How about exchanging and peer reviewing some code?
I wrote everything in PicBasic and used a 16F877A

I'm looking for an S2000 in my region to do some scope measurments on the ECT signal.
But till now... nothing found. Next friday I go to the Honda dealer the ask what they know, and to see if there is an S2000 which I can use to do measurments.


BTW... I'm very willing to help with a DIY write-up.
English isn't my native, but I can make myself quite clear.
And I can create schema's and/or PCB designs.


about time someone chimes in with some news. Whats your background and where are you from?

PortB.1 with 12v going straight in to it? not very safe that's a TTL input pin, it can only handle 5v. unless if your CRX doesn't give a 12v square signal like my integra. As for the ECT specs i used a formula that i derived in the previous pages. As for the cluster going crazy after a certain speed, that is because your signal is not clean enough. I have that problem too in the beginning. Had to upgrade to more faster opto-couplers.

As for writing code and exchanging...maybe. but my code is written in PICC. not PICBasic. schematics? Well you already have mine. It's quite simple.

so please post up what you have and maybe can finish this project.
 

orthello

The Dutch Guy
Well, I'm a software engineer (java, c#) with basic elektronics skills.
I'm from Holland and driving CRX for more the 6 years now.
Software is my profession/occupation, elektronics is just a hobby.

Let me explain my path so far....

I wanted to have the S2000 cluster in my car and I wanted to do it al by myself. Just buying a converter was TO simple and not challanging. So I started investigating signal specs. And found out that the VSS signal was about 36 times faster than the 'traditional' vss signal. So I started thinking about how to multiply the signal.

There were some different possibilities.
1) f/v -> v/f converter with some pot-meter to set the 'multiplier'
2) PLL and divide the feedback by 36 (using some counter IC)
3) MicroControler

Because I wanted to learn how to use a microcontroller, I decided to choose that track.
PicBasic was a very easy language to start with and to get a first understanding.
So I started with PicBasic and a simulator just to get a first impression. Started with some blink LEDs (the "hello world" for MicroControlers) but when time passes, I went further and further. Playing with interrupts, LCD and the on-board 10bit ADC.

I started with the philosophy of 1 pulse in, 36 pulses out. I recognized that there were two ways to do this. In 7k5 Hz (so Vmax is 300km/h) bursts or with some sort of pulse-width calculation. First I created the one working in bursts.
When a rising-edge is detected on RB0 (INT) this will cause an interrupt and going into the ISR.
During the ISR I add 36 to variable 'pp' (pending pulses)
When not in the ISR I loop through some 'led blinking code'
Code:
WHILE 1=1                      ; stay in the program. Don't make it stop (it's not a one shot solution)
    WHILE pp > 0
        PORTB.1 = 1
        DELAYUS 67           ; (1 / 7500  = 133us) and we wait just half a pulse width as we do the same waiting twice.
        PORTB.1 = 0
        DELAYUS 67
        pp = pp - 1          ; done a pulse, so one pending pulse less.
    WEND
WEND
After that I dicided to play around with the timer to measure the incoming pulse width and store it to variable 'ipw' (input pulse width).
I used this to determine how much time I have to generate the 36 outgoing pulses. I also realised that this measurment needs room because when accelerating the time left is shorter then measured!!
To prevent getting behind to much, was pretty easy. Because I was using the pp variable I was always aware of how many pulses were pending. I was also more or less aware of the pulse width to be expected. I introduced a simple calculation for this. opw = ipw / pp (opw = ouput pulse width)
In the simulator this turned out to be a very nice solution. There was a chance to get behind 36 pulses at most.

So I build a first version of my elektronics on a breadboard (with 2 LED's to check input and output signal), programmed the microcontroller with the software which takes the pulse width in consideration and did a first test on the bench. First thing that surprised me was that (for the human eye) the input and output led were flashing at the same speed. I checked the reading on the S2000 gauge. FINE?!?! WTF?!?!?!? That the reading on the S2000 gauge was fine, was to be expected as per my theory of 1 pulse in, 36 pulses out, but the output led should be constantly on (as per the human eye)
(As you can see in my YouTube account a did this first bench test on january 15th, 2008 )

But why were the input and output leds were blinking the same way, and how come the s2000 gauge still did what I expected it to do?
Well... what I didn't realised up to this point, and which is a beginners mistake, the 16 bit timer of a microcontroler roles over every 65,535 clock ticks. Because I'm working with a 4MHz X, this turns out to be every 16ms. And because of this, the opw is more or less random from 0 to 440us (16ms / 36 pulses). So the PIC is pulsing in bursts with some random pulse width. But... because the S2000 readings were fine, this proves that pulse bursts arn't an issue for the gauge.
I took everything (with the pw calculating software version) into the car and went for a spin. Readings where fine... up to about 70km/h. At that point ipw = 20ms so the timer is still rolling over, causing burst output behaviour. So this can't be the issue.
Then at some point I desided to speed up the car to 130km/h and turn the engine off while letting the car roll in neutral. Damn.... readings on the gauge were perfect again (see spy movie) so the software also proved itself on higher speeds. 130km/h is 80 MPH.

This is the point where I am now. There most be noise of some sort on the input or the output of the PIC.

The past few days I did a lot of thinking about the way I wrote my software. (not that it is causing trouble though) I realised I have concentrated to much on the 1 pulse in X pulse out theory. I did some playing around with pulse witdh, which turned out not to work as intended. So at the end... nothing was done with pulse widths. I didn't concentrate on straight forward pulse width calculations and forget about numbers of pulses. I was too much focused on losing or adding pulses to the output, being scared the ODO / trip counters would not do what I want. Now I know better. This is what is called... Tunnel vision. And also probably a beginners mistake?
Ok.. in the next software version I want to do it that way. But because my timer roles over every 16ms I need to slow it down or need to write additional code to extend the timer from 16bits to say 32 bits. At least it should be able to measure 1.4 seconds as that is the input pulse width when driving 1km/h (less then 1MPH)
But it shouldn't be slowed down to much, because that potentially can cause problems when driving faster. *does some calculations*
Ok... I want at least one tick every 5ms (So that I'm able to measure 180MPH) and a rollover time of atleast 1400ms.
When slowing down the timer 128 times, it will be within this limits. It will rollover every 2.1 seconds and will tick 256 times in 5ms.
I also need to think about freeing up some processor time, as the DELAYUS function just freezes the programe for that amount of time, while I also want to do an ADC measurment for the ECT :D Let me think about that one too....


My CRX has a reed switch type VSS which connects to ground. So the input (RB0 used as INT) is connected to the VSS with a pull-up resistor to +5V. So for me there was no need to use an opto-coupler. Although it would be way more elegant!

The output to the S2000 gauge is straight to RB1. On the bench this works fine up to 300km/h (180MPH).
In the car it also works fine, as long as the ECU is turned off. But no ECU means no power. GRrrrrr
It's for sure that there is noise of some sort at the input or output. (input most likely I think)
Possible suspects... Alternator, distibutor/coil, ECU
Past few days I did some playing around to find the cause of the noise.
When driving 130 turned the engine off while in neutral. Result: readings were fine!
When driving 130 turned the engine off while in 5th gear(keeping the engine and thus the alternator rotating) Result: readings were fine!
Conclusion so far... Alternator isn't the problem. ECU and distributor/coil remain suspect.

I planned to do some scope measurments tonight on the input as well as on the ouput. Hopefully I'm able to find something.

But about the ECT stuff.
I had my function generator setup to produce a 50% squarewave from 0 to 5V. Started with 60Hz. Noting. After 1 minute (gauge refreshes every 30 seconds) I went to 100Hz. Nothing. 500Hz... nothing... and so on (500Hz steps). Up to 4000Hz. Then suddenly I got a full scale reading. But nothing in between.
I have to admit that I don't have put to much effort in the ECT thing yet. I want to solve the VSS converter first.

So this is my story so far.
 


Last edited:

konerri

New Member
About time another software engineer gets on this site. I am an engineering myself. Java, C, PICC, Assembly, etc.... mainly focused on embedded systems.

i think your problem is still timing of the out pulses correctly. In my while statement all there is is just the
ect temp code. Everything else is done with time interrupts. Incoming VSS triggers external interrupt on
RB0, thus calculating the time difference between pulses(period). with this time you can then calculated a new output frequency 36 times shorter in time. example: 36 microsec incoming then you should output a 1 msec output to s2000 cluster. Doing this type of calculating and outputting inside the main while loop is not accurate enough when you reach really high rates.

I believe i know why your clusters is not working at higher speed while driving. NOISE PROBLEM. The signals are distorted from combustion firing. this is one of the most worst problem electronics will face in the car world. i used opto to separate my micro controller from this noise. hope this helps little.

i am on vacation this week so i will not be working on my project right now but i will next week.
 

orthello

The Dutch Guy
Ok... I rewrote the software to use the internal PWM generator which is capable of producing every possible frequency up to 35kHz, without using CPU time. (I set DC at 50% for al frequencies) Software works fine and is way shorter! (as in less lines of code)

Trouble with noise on the input is now point of attention. Yesterday I played around with a Schmitt trigger. Vt+ is 2v and Vt- is 1 volt. It made the gauge work on higher speeds without the need of turning engine of.
It still behavious nervous, but it is way more accurate (with running engine!!) then before.
The gauge jumps from 120 to 140 and everithing in between, when driving 130. When driving 100 it jumps from 90 to 110, and so on. But... everything with a running engine. (even when revs are high) It's not spot on yet, but atleast there is a certain awarness/indication of speed now.
Don't forget that previous tests were done with the engine turned of, while the latest test are al done with the engine running, so all possible noise was introduced to the converter.

Nervous behaviour will have to do with .... noise. All noise from 1 to 2v is filtered out. But there can still be noise between 2v and 5 volt. Therefore I think 2 volt is to low for Vt+ I'm going to try to get it up to say 4 volt.
This way the schmitt trigger will 'filter' all the noise from 1v to 4v. Hopefully the gauge will get stable that way.
 
Last edited:

DailyDB8

>>>Honda Enthusiast<<<
wow, you guys are tearing it up.

<--- made a lilttle progress with the bracket and bezel... will post pictures soon. :thumbup:
 


heykosal

Angkorian
I'd do if IF I could get my hands on an S2K cluster cheap...and I mean like a super steal..

But wait..I need a teg first...
 

orthello

The Dutch Guy
Yesterday evening I created a schmitt trigger 'filter' to eliminate all the noise below 3v.
This morning I did a road test, while driving to my work, which is a 50km (30Mile) trip.
The first part (30km / 20mile) went PERFECT. Only two noise spikes (with a jump in the speed reading as a result) but that was it. I was like... YEEEEHAAHAHAHAAAAAA

But.. NEVER BE HAPPY TO SOON!!!!!!

Last part of the trip (20km/10mile) the readings started to jump more and more.
I'm almost sure this has something to do with the environment temperature. The warmer copper wires get, the better they it conducts electricity (and alectric noise!)
Vt+ (the upper noise level threshold) is now set to 3v.
Somewhere next week I want to get Vt+ to set to 4v.

Getting sooooooo close now!!!!!

Oh.. and because of the very acurate readings during the first part of the trip, I was able to have a first indication of the mismatch with my original speedreading. With a 36 multiplier (calculated from original Honda documentation), the S2000 gauge reads 10% less then it should. So this confirms the 39 multiplier konerri found after measuring the signals.

to measure is to know :D
 

orthello

The Dutch Guy
DAMN.... it continues......
The way home.... Gauge was nerveus again for the first 10 minutes.
The last 30 minutes the gauge was showing a very very stable speed again without any glitch, spike or whatever! BUT.... at twice the speed as it should!!!

Something what caught my attention... when the environment was cold, everything did what it is expected to do. When it gets warmer, things get nervous. And when warmer then xx degrees, gauge shows double the speed.

The nervous part maybe is the part where everything transitionsto 'double'.

I don't think this can be any form of noise. If this is noise at the input it's a F@$# nice, constant noise. Got my point?

Need to think about this more, and do measurments again in car while driving.

WEIRD!!!!

If the gauge/converter shows the exact same behaviour next monday morning... I'm going to get "Freeze 75" and cool the converter component by component. This way I can detect which one is the suspect!
 

orthello

The Dutch Guy
TADAAA.... my first design. This is how it's build now. Stablized +5V and ground are taken from the +5v supplie from the S2000 gauge. This is a very very stable +5v (5.04 volt)

Input is with the old school 'reed style' VSS sensor. (Which is in my 1990 CRX VTEC)

74HCT132 is used as Schmitt trigger. It inverses the signal, but that doesn't matter.

The LED's are just for checking port status

I'm missing a lot of capacitors. So the entire design can be improved SOOOO much more!

Click image for full size


For those who want to see some first alpha source code....
 
Last edited:
Top