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

Now available from EcoModder: ScanGauge II fuel economy gauge.  Click for details.  

Reply  Post New Thread
 
Submit Tools LinkBack Thread Tools
Old 11-07-2008, 05:35 PM   #261 (permalink)
MechE
 
Join Date: Dec 2007
Location: Bay Area
Posts: 1,151

The Miata - '01 Mazda MX-5 Miata
Thanks: 0
Thanked 17 Times in 14 Posts
Quote:
Originally Posted by Magister View Post
For OBD logging to a laptop, you'll have to enable the serial port and in the get_pid() function you'll have to do a serialWrite() with the info you want to export.
Excellent, just as simple as I was hoping

Quote:
Originally Posted by Magister View Post
The transistor is used to drive the brightness as some LCD LED can take 100mA and the pins only output 20mA so if you plug the pin directly on the LCD, you will burn the pin output.
Thanks, I'm sure I have a suitable transistor somewhere

__________________
Cars have not created a new problem. They merely made more urgent the necessity to solve existing ones.
  Reply With Quote
Old 11-07-2008, 11:15 PM   #262 (permalink)
MechE
 
Join Date: Dec 2007
Location: Bay Area
Posts: 1,151

The Miata - '01 Mazda MX-5 Miata
Thanks: 0
Thanked 17 Times in 14 Posts
I've got one more question before I solder my final bits



I'm using a thumbduino, so the power source is the 5V USB host... I don't have a 9V supply... Can I run from a regulated 12V supply? Already, I'm going to power the LCD from an external 5V regulator, I'm not sure if the USB host will support the thumbduino and the LCD (I don't think it will negotiate for more than 100mA).

That 9V is connected to both the 33920 and the OBD2 interface, so I don't want to screw that up
__________________
Cars have not created a new problem. They merely made more urgent the necessity to solve existing ones.
  Reply With Quote
Old 11-08-2008, 12:44 AM   #263 (permalink)
EcoModding Apprentice
 
cmags's Avatar
 
Join Date: Apr 2008
Location: Marietta, GA
Posts: 139

Scoob - '05 Subaru Impreza Outback Sport SE
90 day: 25.28 mpg (US)
Thanks: 0
Thanked 0 Times in 0 Posts
That pink line coming from Pin 9 on the DB-9 OBD input and going to the 33920 VBB and the Arduino 9V pin is the 12V line from the car. I don't know what a thumbduino is (maybe a stickduino?), but if you don't have a regulator onboard like the Arduino, that pin on the arduino is the unregulated 12V input going to the 7905 reg. That same 12V presumably is a direct input to the 33290, but I'm still need to look up that part's specs to be sure I hook it all up right, so someone correct me if I'm wrong.
  Reply With Quote
Old 11-08-2008, 01:55 AM   #264 (permalink)
MechE
 
Join Date: Dec 2007
Location: Bay Area
Posts: 1,151

The Miata - '01 Mazda MX-5 Miata
Thanks: 0
Thanked 17 Times in 14 Posts
doh! Stickduino That's not the first time I've made that mistake :X

So yes, after staring at it long enough, it hit me that the arduino needs power

I've gotta debug my setup, it's quite messy - and, buggy

It won't always initialize - and when it does, only one character row (bottom) is showing up, and it's displaying repetitive garbage - looks like the duino is resetting. I don't have it hooked up to the obd port just yet.

When it fails to initialize, the hd44780 chip gets hot. Which also happens if I remove my external 12V supply (arduino still powered on over laptop) - BUT, when I do so, I get random pixel flashes on both rows of the LCD o.0



It's late, but I'm thinking it doesn't like having two grounds - 1 being the PC ground to run the arduino and the other being the 12V battery ground. In fact, I'm not entirely sure how I'm getting anything to display - if the three grounds on the LCD are reference voltages, the digital pins from the arduino don't have a "nice" current loop....

Walking away now - I'll save round 2 for tomorrow...
__________________
Cars have not created a new problem. They merely made more urgent the necessity to solve existing ones.
  Reply With Quote
Old 11-08-2008, 12:34 PM   #265 (permalink)
MechE
 
Join Date: Dec 2007
Location: Bay Area
Posts: 1,151

The Miata - '01 Mazda MX-5 Miata
Thanks: 0
Thanked 17 Times in 14 Posts
Fixed - it was just as I suspected too.

Thou shalt make simple ground loops

It wasn't resetting, the indicator LED on the arduino blinks when it tries to init and when it fails.

Todo
*find a pnp transistor
*move the stickduino power "jumper" Or, make a power USB cable
* wire up the 33290 chip
* wire up an RJ45 socket
* button time

Does anyone know if the 33920 chip absolutely needs the ECU voltage on pin 1? Or if something around 12V will be fine? I can't seem to figure it out from the spec sheet...
__________________
Cars have not created a new problem. They merely made more urgent the necessity to solve existing ones.
  Reply With Quote
Old 11-08-2008, 06:37 PM   #266 (permalink)
MechE
 
Join Date: Dec 2007
Location: Bay Area
Posts: 1,151

The Miata - '01 Mazda MX-5 Miata
Thanks: 0
Thanked 17 Times in 14 Posts
For the interested, SG2 cable pinout


Code:
SG RJ45       OBD Connector
1----------- 4 Signal Ground
1------------5 Chasis Ground
2------------6 CAN High (J-2284)
3-----------14 CAN Low (J-2284)
4------------2 J1850 Bus+ 
5-----------10 J1850 Bus-
6------------7 ISO K Line (9141-2)
7-----------15 ISO L Line (9141-2)
8-----------16 Battery +
Still working out kinks... I can't seem to get it to initialize. Is the software tested for the 33290 chip? I'm just starting to go over the code now
__________________
Cars have not created a new problem. They merely made more urgent the necessity to solve existing ones.

Last edited by trebuchet03; 11-08-2008 at 06:57 PM..
  Reply With Quote
Old 11-09-2008, 07:19 PM   #267 (permalink)
OBDuino coder
 
Magister's Avatar
 
Join Date: Jun 2008
Location: Montréal, QC
Posts: 210

Titine - '07 Hyundai Elantra GL
Thanks: 3
Thanked 10 Times in 8 Posts
I was never able to test the ISO code as my car does not support it. AFAIK the code should work, if it initializes properly.
Schematic use the standars OBDII-DB9 cable so be careful to have the correct pinout too.
__________________
  Reply With Quote
Old 11-09-2008, 07:40 PM   #268 (permalink)
MechE
 
Join Date: Dec 2007
Location: Bay Area
Posts: 1,151

The Miata - '01 Mazda MX-5 Miata
Thanks: 0
Thanked 17 Times in 14 Posts
Quote:
Originally Posted by Magister View Post
I was never able to test the ISO code as my car does not support it. AFAIK the code should work, if it initializes properly.
Schematic use the standars OBDII-DB9 cable so be careful to have the correct pinout too.
Thanks Magister

I'm going to dig through older posts and look for standard on how to initialize, and make sure that's actually happening.

I read voltage changes on the tx/rx pins, so I'm going to assume my 33290 chip is working.

I've triple checked my double checked cable pinout... I guess I'll check again The only "interesting" thing about the cable is that the chasis ground and signal ground are common for the SG cable.
__________________
Cars have not created a new problem. They merely made more urgent the necessity to solve existing ones.
  Reply With Quote
Old 11-12-2008, 12:48 AM   #269 (permalink)
MechE
 
Join Date: Dec 2007
Location: Bay Area
Posts: 1,151

The Miata - '01 Mazda MX-5 Miata
Thanks: 0
Thanked 17 Times in 14 Posts
So I'm going over the code....

prj.perquin.com shows the slowinit sequence as:

Quote:
Code:
_________ S ___ 2 3 ___ 6 7 ___        ____        ____ 
         \_/0 1\___/4 5\___/P  \/\/\/\/    \/\/\/\/
 300ms  200 400 400 400 400 250 packet     response
1) Wait for 300ms with K line high.
2) send a byte 33 hex at 5 baud. 200ms per bit
startbit: 200ms low
databit0,1: 400ms high
databit2,3: 400ms low
databit4,5: 400ms high
databit6,7: 400ms low
stopbit+pause: 250ms high
4) init serial connection to 10400 baud, 8N1, 1=0Volt 0=12Volt, least significant bit first
5) send package c1 33 f1 81 66 33=dest, f1=our tester id, 81=start comms
6) wait for response 83 f1 01 c1 e9 8f ae 01=physical address, c1=response ok (7f=fail), e9=kb1, 8f=kb2

So everything in the obduino code seems good up until step 4/5.

The opengauge code does the 300ms thing, the 5 baud 0x33 stuff... But then it deviates significantly... Rather than sending data, it waits 60ms and then listens for a response. I don't fully understand what steps 4, 5 and 6 are/do, however.

It's also slightly different on the stopbit, it pulls K high for 200ms rather than 250. But, even with that change, I'm still no go.

Does anyone have a better source of documentation for the proper init sequences?


Referenced openguage function
Code:
/* ISO 9141 init */
byte iso_init()
{
  byte b;

 // drive K line high for 300ms
  digitalWrite(K_OUT, HIGH);
  delay(300);

  // send 0x33 at 5 bauds
  // start bit
  digitalWrite(K_OUT, LOW);
  delay(200);
  // data
  b=0x33;
  for (byte mask = 0x01; mask; mask <<= 1)
  {
    if (b & mask) // choose bit
      digitalWrite(K_OUT, HIGH); // send 1
    else
      digitalWrite(K_OUT, LOW); // send 0
    delay(200);
  }
  // stop bit
  digitalWrite(K_OUT, HIGH);
  delay(200);

  // pause between 60 ms and 300ms (from protocol spec)
  delay(60);

  // switch now to 10400 bauds

  // wait for 0x55 from the ECU
  b=iso_read_byte();
  if(b!=0x55)
    return -1;

  delay(5);

  // wait for 0x08 0x08
  b=iso_read_byte();
  if(b!=0x08)
    return -1;

  delay(20);

  b=iso_read_byte();
  if(b!=0x08)
    return -1;

  delay(25);

  // sent 0xF7 (which is ~0x08)
  iso_write_byte(0xF7);

  delay(25);

  // ECU answer by 0xCC
  b=iso_read_byte();
  if(b!=0xCC)
    return -1;

  // init OK!
  return 0;
}
__________________
Cars have not created a new problem. They merely made more urgent the necessity to solve existing ones.

Last edited by trebuchet03; 11-12-2008 at 12:55 AM..
  Reply With Quote
Old 11-12-2008, 09:57 AM   #270 (permalink)
OBDuino coder
 
Magister's Avatar
 
Join Date: Jun 2008
Location: Montréal, QC
Posts: 210

Titine - '07 Hyundai Elantra GL
Thanks: 3
Thanked 10 Times in 8 Posts
Step 5/6 is for KWP 2000 (ISO 14230-4), I put only ISO 9141-2 in the code

__________________
  Reply With Quote
Reply  Post New Thread

Tags
obd2

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
MPGuino release one workspace dcb OpenGauge / MPGuino FE computer 1052 06-04-2014 09:37 PM
Just some quick info on Scangauge vs. MPGuino NoCO2 OpenGauge / MPGuino FE computer 1 10-07-2009 06:35 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.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO 3.5.2
All content copyright EcoModder.com