Go Down

Topic: Opel TID Display (Read 27 times) previous topic - next topic

Giovanni83

#90
Jun 20, 2014, 12:09 am Last Edit: Jun 20, 2014, 12:12 am by Giovanni83 Reason: 1

Just for info...
http://veramon.czweb.org/en_pp_astra_g.html


like Gillan sings in that Deep Purple song... " it's not the kill, It's the thrill of the chase"  :)


Quote
I'm not that experienced in programming so i would appreciate any suggestions for improvements or other features.

I'm not one either, but first i would try splitting your sketch in two separate sketches, one for RPM, the other for SPEED. Run the two independently and see if at least one has a decent update speed. Also increase the speed parameter in the MyTid.display_message calls
Quote
Thanks Giovanni83 for the library!
glad you find it useful  :)

Sepp1593

Quote
I'm not one either, but first i would try splitting your sketch in two separate sketches, one for RPM, the other for SPEED. Run the two independently and see if at least one has a decent update speed. Also increase the speed parameter in the MyTid.display_message calls


Thanks for the reply, i will try that.

foldax

Hi

If i connect arduino to SDA,SCL,MRQ lines and leave OEM radio also connected, will be there a some kind of "collision" ?
I know this protocol is similar to I2C so it should work, but i want to be sure that it won't break anything


Giovanni83


Hi

If i connect arduino to SDA,SCL,MRQ lines and leave OEM radio also connected, will be there a some kind of "collision" ?
I know this protocol is similar to I2C so it should work, but i want to be sure that it won't break anything




never really tried... i don't think you can break anything, but there will be probably some kind of collision between messages coming from the radio and the ones coming from arduino

Anon2014

As I had some major problems with the engine on my Corsa I had no time to try other methods regarding my TID.
I am still at the point, where I can´t send any data to the TID flawlessly.

Still didn´t try the previous versions of the library, as suggested here, although the latest library shuld be TID8 compatible, so I don´t see the problem there?

I would be happy to get a stable connection, as I am unable to go futher if this simple step fails.

So the problems are:


  • Unstable connection, If I let count a counter up per second, it leaves some numbers out. "Freezes" randomly or the number disappear completely for a short time.

  • "New Minute Problem" - The display clears itself at the beginning of a new minute of the TID´s own clock

 

Any help would be highly appreciated.

Anon2014

Any support on this topic?

I would really like to get it working.

foldax


"New Minute Problem" - The display clears itself at the beginning of a new minute of the TID´s own clock


this happens becouse you "didn't turn off" the clock
normally when you turn on the radio it turns of the clock, radio is the onlly device controlling tid
it works this way:
-radio puts +12v (or +5v don't remember)   on antenna pin ( pin 5 in iso ?? don't remember)
-tid stops displaying clock

your second problem could appear becouse of first, try to fix this and share results

@Giovanni83 thanks i'll try that

Anon2014

You mean the "date" display, which is off anyway, because it wouldn´t display any text only the date.

The time clock can´t be disabled.
see.
https://www.youtube.com/watch?v=Gck8UfNMQiw&feature=youtu.be

Anon2014

Any progress?

For the record, I am Using the following 8 char, TID: 90 437 127 (Opel Part number)
And following Arduino:
http://www.amazon.de/gp/product/B005X4PKR6/ref=oh_aui_detailpage_o06_s00?ie=UTF8&psc=1

I was using the newest library which should work with the 8 char TID. But encountered the described errors.

Maybe my Arduino is not the best version for this? Or I am doing something wrong. Maybe someone from you who got this working could send me the code so I have a clean start?

I would really like to get it working, Because If I am stuck at this point I cant move forward to implement some functions, if the simple function of displaying some text fails. Also I already bought all the stuff for assembling it together.

If everything fails, I am willing to donate the described unit to a skilled programmer here free of charge (including shipping cost) If he can dedicate some time to help.

Sepp1593

Hi!
I think i just post the latest version of my sketch which i am currently using in my car to display speed and the engine's rpm.
Except for the "new minute problem" and unsteady update speed it works fine.
The sketch could require some optimization, but at least it works, so who cares?  XD
My TID is the 8 digit one (also part number 90 437 127).

Code: [Select]
#include <TID12.h>

TID MyTid(7,5,6);

const int sdv = 8;
const int rpm = 9;

int sdvvalue;
int rpmvalue;

float sdvfloat;
float rpmfloat;

int sdvstate = 0;
int rpmstate = 0;
int sdvstateold = 0;
int rpmstateold = 0;
int rpmstatestart = 0;

int rpmstart = 0;
int sdvstart = 0;

int sdvhcount = 0;
float sdvhmax = 0;
int sdvhimax = 0;
int rpmhcount = 0;

int sdvbreak = 0;
int rpmbreak = 0;

int rpm2s = 0;
int rpm3s = 0;

int rpmh = 0;
int rpmh2 = 0;

int sdv2s = 0;

int sdvh = 0;

unsigned long time;
unsigned long timeold;
unsigned long timediff;
unsigned long timediff2;

char rpmdisp[4];
char sdvdisp[3];

void setup()
{
  MyTid.space1_init(0,3);
  MyTid.space2_init(5,7);
  pinMode(sdv, INPUT);
  pinMode(rpm, INPUT);
}

void loop()

{
  timeold = micros();
  while (rpmstart == LOW)
  {
    time = micros();                                      //Engines RPM
    timediff2 = time - timeold;
    if (timediff2 > 40000)
      rpmstart = 1;
    rpmstateold = rpmstate;
    rpmstate = digitalRead(rpm);
    delayMicroseconds(150);
    if (rpmstate == HIGH && rpmstateold == LOW)            //wait for rising edge
      rpmstart = 1;
  }



  timeold = micros();
  while(rpmhcount < 5)
  { 
    rpmstateold = rpmstate;
    rpmstate = digitalRead(rpm);
    delayMicroseconds(150);
    if (rpmstate == HIGH && rpmstateold == LOW)        //wait for rising edge of signal
      rpmhcount++;
    time = micros();                                    //caching old time value...
    timediff2 = time - timeold;                        //
    if (timediff2 > 187500)                            //--> RPM < 800/min
    {
      rpmbreak = 1;
      break;
    }           
  }
  time = micros();

  rpmstart = 0;

  rpmhcount = 0;

  timediff = time - timeold;

  rpmfloat = float(timediff);

  rpmfloat = (1 / (rpmfloat / 1000000)) * 150;          //calculate

  rpmvalue = int(rpmfloat);

  rpmh = rpmvalue / 1000;

  rpmh2 = rpmvalue / 100;

  rpm2s = rpmh2 - (rpmh * 10);

  rpm3s = (rpmvalue / 10) - (rpmh2 * 10);

  rpmdisp[0] = '0' + rpmh;
  rpmdisp[1] = '0' + rpm2s;
  rpmdisp[2] = '0' + rpm3s;
  rpmdisp[3] = '0' + (rpmvalue % 10);
  rpmdisp[4] = '\0';

  if (rpmbreak == HIGH)                                //display 0000 if rpm < 800
  {   
    rpmdisp[0] = '0';
    rpmdisp[1] = '0';
    rpmdisp[2] = '0';
    rpmdisp[3] = '0';
  }

  rpmbreak = 0;

  MyTid.display_message(rpmdisp,1,1);                 //send to display...


sdvhmax = (7 * sdvfloat) / 10;                        //calculate speed value based on previous measurement for increased accuaracy

sdvhimax = int(sdvhmax);                              //round...

sdvhmax = float(sdvhimax);

if (sdvhmax < 5)                                      //minimum speed is about 3 km/h
sdvhmax = 5;



  timeold = micros();                                  //start
  while (sdvstart == LOW)
  {
    time = micros();
    timediff2 = time - timeold;
    if (timediff2 > 26000)
      sdvstart = 1;
    sdvstateold = sdvstate;
    sdvstate = digitalRead(rpm);
    delayMicroseconds(150);
    if (sdvstate == HIGH && sdvstateold == LOW)        //wait for rising edge
      sdvstart = 1;
  }


  timeold = micros();
  while(sdvhcount < sdvhmax)
  { 
    sdvstateold = sdvstate;
    sdvstate = digitalRead(sdv);
    delayMicroseconds(150);
    if (sdvstate == HIGH && sdvstateold == LOW)
      sdvhcount++;
    //ab hier
    time = micros();                                  //cache old time
    timediff2 = time - timeold;
    if (timediff2 > 247500)                          //if car too slow --> 000
    {
      sdvbreak = 1;
      break;
    }
   
  }
  time = micros();

  sdvhcount = 0;

  sdvstart = 0;

  timediff = time - timeold;

  sdvfloat = float(timediff);

  sdvfloat = ((1 / (sdvfloat / 1000000)) * 1.96875) * (sdvhmax/10) * 1.05;      //(1.750 / 32) * 10 = 0.546875  ,    3.6*0.546875  ,  (* 1.05 to increase accuaracy)  , accuarate for 165/70 R13 tyre dimensions

    sdvvalue = int(sdvfloat);

  sdvh = sdvvalue / 100;

  sdv2s = (sdvvalue / 10) - sdvh * 10;

  sdvdisp[0] = '0' + sdvh;
  sdvdisp[1] = '0' + sdv2s;
  sdvdisp[2] = '0' + (sdvvalue % 10);
  sdvdisp[3] = '\0';

  if (sdvbreak == HIGH)                              //display 000 if car is too slow
  { 
    sdvdisp[0] = '0';
    sdvdisp[1] = '0';
    sdvdisp[2] = '0';
  }

  sdvbreak = 0;

  MyTid.display_message(sdvdisp,1,2);                //send to display...
}


I use this board: http://www.amazon.com/SainSmart-ATmega328P-Development-Compatible-Arduino/dp/B00E5WJSHK/ref=sr_1_1?ie=UTF8&qid=1408989001&sr=8-1&keywords=sainsmart+uno+r3.

Anon2014

@Sepp1593
It works. At least it displays "00000 000" . But things get first interesting when connected to input.

Could you describe how you connected it to your car?

And how to increase the refresh rate of the script?

Sepp1593


Could you describe how you connected it to your car?


Pin 5 on arduino = scl ,pin 9
Pin 6 on arduino = mrq ,pin 10
Pin 7 on arduino = sda ,pin 11

Pin 8 (= speed pin) on arduino is connected to pin 12 of the tid connector.
Pin 9  (= rpm pin) on arduino is connected to pin 9 on the tachometer plug behind the rev counter (the 4th pin on the left lower side of the connector, i think it's a green wire).

Both pins 8 and 9 use 22 KOhm resistors.

The arduino gets the supply voltage from pin 8 on the tid connector (--> Radio can switch arduino on and off).

Ground to pin 4.

all pins of the male plug are connected to the same pin of the female plug, except pins 9-11 on the male one, which are only connected to the arduino.

Picture for orientation as attachment  XD

Good luck  :)

Anon2014

Thanks for the info.

I would be more interested in things like, Oil Pressure, Oil Temperature and Fuel Consumption.
But this needs additional sensors on the engine.


As I am considering do some plasma and LED upgrade to the tachometer which should be "Arduino controlled" this RPM computing script will be useful for me.

Anon2014

@Sepp1593
I need a Rpm, Kmh calculating code for another car related project and opened a thread here referring to your code.

http://forum.arduino.cc/index.php?topic=265822.0

Hope thats OK, maybe you have some ideas too.

Go Up