Go Back   EcoModder Forum > EcoModding > Instrumentation > OpenGauge / MPGuino FE computer
Register Now
 Register Now
 

Reply  Post New Thread
 
Submit Tools LinkBack Thread Tools
Old 09-12-2008, 03:19 PM   #201 (permalink)
dcb
needs more cowbell
 
dcb's Avatar
 
Join Date: Feb 2008
Location: ÿ
Posts: 5,038

pimp mobile - '81 suzuki gs 250 t
90 day: 96.29 mpg (US)

schnitzel - '01 Volkswagen Golf TDI
90 day: 53.56 mpg (US)
Thanks: 158
Thanked 269 Times in 212 Posts
Quote:
Originally Posted by Magister View Post
I can see the RPM on my display, pretty cool, but *argh* VSS is not supported by my ECU it seems?!!??!...
Good to know anyway, sucks, but good to know Definately let us know if you find a speed signal on another pid or something.

__________________
WINDMILLS DO NOT WORK THAT WAY!!!
  Reply With Quote
Alt Today
Popular topics

Other popular topics in this forum...

   
Old 09-12-2008, 04:28 PM   #202 (permalink)
OBDuino coder
 
Magister's Avatar
 
Join Date: Jun 2008
Location: Montréal, QC
Posts: 212

Titine - '13 Hyundai Sonata Hybrid
Thanks: 3
Thanked 10 Times in 8 Posts
Maybe it comes from my bad init where I check the supported PIDs, I will fake it to see.

If I have time I will take pictures this w-e!
__________________
2013 Hyundai Sonata Hybrid
  Reply With Quote
Old 09-12-2008, 10:43 PM   #203 (permalink)
Civic 4 Life
 
KJSatz's Avatar
 
Join Date: Jun 2008
Location: USA
Posts: 229

Civics Lesson - '08 Honda Civic LX
Team Honda
90 day: 40.53 mpg (US)
Thanks: 0
Thanked 2 Times in 1 Post
Hey guys, I'm pretty clueless, but keep up the good work!!!
__________________
  Reply With Quote
Old 09-14-2008, 05:58 PM   #204 (permalink)
EcoModding Lurker
 
Join Date: Sep 2008
Location: Sweden
Posts: 8
Thanks: 0
Thanked 2 Times in 2 Posts
First post here, was reading this thread a month ago or something.
My thoughts on the combination of a arduino and a ELM 327 where no where to be found at that time so i started my own project.
So finally this week i ended up completing the whole ELM 327 OBD board and connected it to the arduino in a box using a graphical Lcd.
Check pictures below:
Photo: DSC08622 | KS0108 album | HULK77 | Fotki.com

Library and connection setup:
Arduino playground - GLCDks0108

The lcd libary is big but provides me the possibillity of displaying things in a more graphical way.

I did had som problems with my code, no problem sending commands but can not really manage to read the reply and display it.
I have seen that the communication is there and right things are popping back to the arduino, used a terminal software connecting the ELM 327 to the com 1.
With the terminal software i can see what is being send back forward from the ELM327 in a simple way.
Some communication:
Photo: DSC08619 | KS0108 album | HULK77 | Fotki.com

Have noticed that a simple question of the RPM takes at least 1200 milli seconds, find that to be a slow update rate, but again my coding may be improved.
I have switched of the spaces between the hexa numbers and some others things to speed up the ELM 327.
Any ideas?

So i find my self beeing out of ideas and did use google and found this thread again, i have to say i am happy things here are going my way =)
I maybe just should wait for your code and see what could be improved.

Buy the way, if you try to upload a new code to the arduino while you are connected to the ELM327 you need to break there serial connection otherwise the upload will fail.

Last edited by HULK; 09-14-2008 at 06:08 PM..
  Reply With Quote
The Following User Says Thank You to HULK For This Useful Post:
ebiolom (03-16-2018)
Old 09-14-2008, 10:17 PM   #205 (permalink)
OBDuino coder
 
Magister's Avatar
 
Join Date: Jun 2008
Location: Montréal, QC
Posts: 212

Titine - '13 Hyundai Sonata Hybrid
Thanks: 3
Thanked 10 Times in 8 Posts
Guys, everything is working fine, I did some video, I'll post link tomorrow!!!
__________________
2013 Hyundai Sonata Hybrid
  Reply With Quote
Old 09-15-2008, 04:10 PM   #206 (permalink)
OBDuino coder
 
Magister's Avatar
 
Join Date: Jun 2008
Location: Montréal, QC
Posts: 212

Titine - '13 Hyundai Sonata Hybrid
Thanks: 3
Thanked 10 Times in 8 Posts
HULK: welcome aboard
Take a look at the last code, it works fine with my Arduino, I'm very happy it works!!
I'll take a look at your code too, and if you want to contribute something, do it

EDIT: take a look at another thread saying "OBDuino working"
__________________
2013 Hyundai Sonata Hybrid
  Reply With Quote
Old 09-16-2008, 01:22 PM   #207 (permalink)
EcoModding Lurker
 
Join Date: Sep 2008
Location: Sweden
Posts: 8
Thanks: 0
Thanked 2 Times in 2 Posts
Quote:
Originally Posted by Magister View Post
HULK: welcome aboard
Take a look at the last code, it works fine with my Arduino, I'm very happy it works!!
I'll take a look at your code too, and if you want to contribute something, do it

EDIT: take a look at another thread saying "OBDuino working"
Thanks Magister,

I have checked your last code that i find in the start of this thread but that one is not suited for the ELM327.
When i read your post number 200 of this thread you state that you have made some changes to your arduino code so it will run with the ELM327.
Is it possible to get a view of that code, i am stuck on reading the value send back from ELM327 and the convertion from hex to a decimal number as well how to pick out the last 4 bytes of the 8 byte value that ELM gives you in reply.

Checked the other thread you posted, great work.
I hope to be able of posting my results there as soon as i figure out this last piece.
Noticed your uodate speed in the video is faster than mine, nice.
Maybe you just use Serial.println() empty once you have printed the request of Serial.println(01 C1 1) and then the reply is faster?
At this point i need to run a delay of 1200 ms before asking for the same value again otherwise it will not manage to give me the reply.
What protocol are you using, 4, 6 or other?


Thanks

Last edited by HULK; 09-16-2008 at 01:39 PM..
  Reply With Quote
Old 09-16-2008, 02:13 PM   #208 (permalink)
OBDuino coder
 
Magister's Avatar
 
Join Date: Jun 2008
Location: Montréal, QC
Posts: 212

Titine - '13 Hyundai Sonata Hybrid
Thanks: 3
Thanked 10 Times in 8 Posts
Code is in the "trunk" on the google project webpage, enjoy
opengauge - Google Code

My car seems to use protocol 6, CAN 11 bit 500KBaud.

For your speed problem I don't know, by default the timeout on the ELM is 20 seconds or something like this and it sends a '?'.

I use a string like "0101\r" and send it in a while() loop and serialWrite(), take a look at the code. There is no tricky part, I don't use timers, I just read/write in the serial port.

BTW I did all the programmation of the ELM327 using their spec available in the ELM327DS.pdf file.

EDIT: to convert the hex in num, I use strtoul(). Also I kept the ELM at 9600 bauds, I don't want to flood my CAN bus, and I don't need to get more than 10 PIDs per second anyway.
__________________
2013 Hyundai Sonata Hybrid
  Reply With Quote
Old 09-17-2008, 04:48 PM   #209 (permalink)
EcoModding Lurker
 
Join Date: Sep 2008
Location: Sweden
Posts: 8
Thanks: 0
Thanked 2 Times in 2 Posts
Thanks Magister,

Well i have to say this was a high tech code for my rookie knowledge.
I can see it contains a high amount of functions as a fault code reader and other functions recording diffrent values,

I will check the speed issue, have been using 38400 bauds without problems.
Did find that command ATS0 speeds up things, it removes the spaces in the hexa reply. Maybe you are using it allready.

As i am running a regular arduino with a big graphical library i have to make my code way smaller then yours.
So according to my knowledge the code below will pick out the last four bytes and convert them to a decimal number.
But in what way can i get a simple reply in a decimal form?
If you have a possibillity of checking my simple rookie code below you are welcome any pointers will do fine...
Hope i am not doing anything wrong by using your code and showing it here?

Code:
  #include <Arial14.h>
  #include <ks0108.h>
  #include <avr/sleep.h>

  #define rxPin 0 //arduino pin for rx
  #define txPin 1 //arduino pin for tx
   
  #define STRLEN  40
  #define NUL     '\0'
  #define CR      '\r'  // carriage return = 0x0d = 13
  #define PROMPT  '>'
  #define DATA    1  // data with no cr/prompt
  
  
/* This code used to pick out the correct bytes and to cnvert them to decimal */
byte elm_read(char *str, byte size)
{
  int b;
  byte i;
  byte *pos;

  // wait for something on com port
  i=0;
  while((b=serialRead())!=PROMPT && i<size)
  {
    if(/*b!=-1 &&*/ b>=' ')
      str[i++]=b;
    sleep_mode();  // macro that enable/sleep/disable
  }

  if(i!=size)  // we got a prompt
  {
    str[i]=NUL;  // replace CR by NUL
    return PROMPT;
  }
  else
  {
    return DATA;
  }
}

// buf must be ASCIIZ
void elm_write(char *str)
{
  while(*str!=NUL)
    serialWrite(*str++);
}

// check header byte
byte elm_check_response(byte *cmd, char *str)
{
  // cmd is something like "010D"
  // str should be "41 0D blabla"
#if 0  
  if(cmd[0]+4 != str[0]
    || cmd[1]!=str[1]
    || cmd[2]!=str[3]
    || cmd[3]!=str[4])
    return 1;
#endif  
  return 0;  // no error
}

byte elm_compact_response(byte *buf, char *str)
{
  byte i;

  // start at 6 which is the first hex byte after header
  // ex: "41 0C 1A F8"
  // return buf: 0x1AF8

  i=0;
  str+=6;
  while(*str!=NUL)
    buf[i++]=strtol(str, &str, 16);

  return i;
}


 void setup(){
   
  byte r;
  char str[16];
   
  pinMode(rxPin, INPUT); //set rx pin
  pinMode(txPin, OUTPUT); //set tx pin
  Serial.begin(38400); //set baud rate
  Serial.println(); //execute any data garbage 
  delay(1000);
  Serial.println("ATWS"); //reset
  delay(1000); //wait for reset
  Serial.println("ATS0"); //remove space characters from reply of ELM
  delay(1000);
  Serial.println("ATE0"); // turn off command echo
  delay(1000);
  Serial.println("ATSP0"); //set protocol
 }


 void  loop(){
 
 Serialwrite(01 C1); //rpm request
 GLCD.GotoXY(98,30); 
 GLCD.PrintNumber(char str[16]);  //example on how to display reply on a lcd
 delay(500);
 
 }

Last edited by HULK; 09-17-2008 at 05:00 PM..
  Reply With Quote
Old 09-17-2008, 05:17 PM   #210 (permalink)
EcoModding Lurker
 
Join Date: Sep 2008
Location: Sweden
Posts: 8
Thanks: 0
Thanked 2 Times in 2 Posts
By the way, what type of Arduino board are you using for the extra size of memory your code needs?
Could use that Arduino board and just convert the code to suite the graphical LCD, think that should be easy compared to resizing the code so it will run with my limitid memory size.
A graphical lcd and this code would give nice features

  Reply With Quote
Reply  Post New Thread


Tags
obd2



Similar Threads
Thread Thread Starter Forum Replies Last Post
MPGuino release one workspace dcb OpenGauge / MPGuino FE computer 1061 01-17-2020 02:37 AM
Just some quick info on Scangauge vs. MPGuino NoCO2 OpenGauge / MPGuino FE computer 4 06-01-2015 05:58 PM
All New Nissan Models to Feature Fuel Efficiency Gauge MetroMPG General Efficiency Discussion 6 11-18-2008 05:57 PM
Vacuum gauge problems :( DifferentPointofView Instrumentation 3 05-15-2008 12:04 AM
Will Scan Gauge work on mine? bennelson Instrumentation 9 02-19-2008 11:04 PM



Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Content Relevant URLs by vBSEO 3.5.2
All content copyright EcoModder.com