05-11-2008, 04:03 PM
|
#41 (permalink)
|
FuelSipper
Join Date: Mar 2008
Location: Dallas, TX
Posts: 99
Thanks: 0
Thanked 8 Times in 3 Posts
|
My first test didn't go so well
I am not getting a readout of anything. All lines stayed 000.00. At least the power worked. I did a multimeter check on the INJ wire and VSS wire coming from my ECU splice. The VSS read fluctuated up to 3-4V as I went up and down the driveway. The INJ wire pretty much stayed solid at 13-15V as I stayed idle in my driveway.
Last edited by larrydag; 05-11-2008 at 05:40 PM..
|
|
|
Today
|
|
|
Other popular topics in this forum...
|
|
|
05-12-2008, 12:31 AM
|
#42 (permalink)
|
FuelSipper
Join Date: Mar 2008
Location: Dallas, TX
Posts: 99
Thanks: 0
Thanked 8 Times in 3 Posts
|
Quote:
Originally Posted by diesel_john
you need to be sure your on the ECU side of the injector
|
Let me know if I'm wrong but I spliced into the wire about 2 inches away from the connector going into the ECU.
Here are the wires I spliced into according to this ECU pinout which corresponds to the OBD1 ECU I have in my accord
http://www.superhonda.com/forum/f55/...inouts-217405/
VSS B10
Injector A1 (INJ #1)
Power A25
Ground A23
|
|
|
05-12-2008, 08:37 AM
|
#43 (permalink)
|
needs more cowbell
Join Date: Feb 2008
Location: ÿ
Posts: 5,038
Thanks: 158
Thanked 269 Times in 212 Posts
|
2 things:
1. (not related to the signal issue), is a25 battery power? You want the guino to stay on when the key is removed.
2. I didn't get much time this weekend, but the code below will display the low level vcc counts and the injector open time and the number of injector pulses received. It may help with troubleshooting.
(EDIT, this code is defunct, debug has been integrated into main codebase)
Code:
//CHANGE THESE VALUES FOR YOUR CAR/TASTE
boolean debug=true;
unsigned long vssPulsesPerMile=3200;
//double injectorGPH=20.0;
unsigned long microSecondsPerGallon = 180000000; //injector flow rate
int numberOfCylinders=4;
int numberOfInjectors=4;
int tankSize=13300; //in 1000ths of a gallon, this is 13.3 gallons
int brightness[]={0,85,170,255}; //left button cycles through these brightness settings
int brightnessIdx=2;
int contrast=15; //looks ok when looking down at the display
int currentTripResetTimeout=15; //minutes
int injectorSettleTime=15; //microseconds
//DONT CHANGE ANYTHING BELOW THIS LINE
//(well, change at your own risk anyway)
//unsigned long microSecondsPerGallon=1/injectorGPH * 60 * 60 * 100000 * numberOfInjectors;
//Vehicle Interface Pins
int InjectorOpenPin=2;
int InjectorClosedPin=3;
int VSSPin=14; //analog 0
//LCD Pins
int DIPin = 4; // register select RS
int DB4Pin=7;
int DB5Pin=8;
int DB6Pin=12;
int DB7Pin=13;
int ContrastPin=6;
int EnablePin = 5;
int BrightnessPin=9;
int PiezoPin=10; //trigger on the injector interrupts
int soundSource=0; //0 for mute, 1 for injector interrupts, 2 for vss interrupts
int lbuttonPin = 17; // Left Button, on analog 3,
int mbuttonPin = 18; // Middle Button, on analog 4
int rbuttonPin = 19; // Right Button, on analog 5
int vssBit = 1; // pin14 is a bitmask 8 on port C
int lbuttonBit = 8; // pin17 is a bitmask 8 on port C
int mbuttonBit = 16; // pin18 is a bitmask 16 on port C
int rbuttonBit = 32; // pin19 is a bitmask 32 on port C
int buttonState = lbuttonBit + mbuttonBit + rbuttonBit; // start with the buttons in the right state
//overflow counter used by millis()
extern volatile unsigned long timer0_overflow_count;
unsigned long microSeconds (void){
return ((timer0_overflow_count << 8) + TCNT0) * 4;
}
unsigned long elapsedMicroseconds(unsigned long startMicroSeconds ){
unsigned long msec = microSeconds();
if(msec >= startMicroSeconds)
return msec-startMicroSeconds;
return 4294967295 - (startMicroSeconds-msec);//someone check my work here
}
//Trip prototype
class Trip{
public:
unsigned long seconds; //how long has this trip been running
unsigned long injPulses; //rpm
unsigned long injHiSec;// seconds the injector has been open
unsigned long injHius;// microseconds, fractional part of the injectors open
unsigned long vssPulses;//from the speedo
//these functions actually return in thousandths
unsigned long miles();
unsigned long gallons();
unsigned long mpg();
unsigned long time(); //mmm:ss
void update(Trip t);
void reset();
Trip();
};
//LCD prototype
class LCD{
public:
LCD( ) ;
void gotoXY(int x, int y);
void print(char * string);
void init();
void tickleEnable();
void cmdWriteSet();
void LcdCommandWrite(int value);
void LcdDataWrite(int value);
int pushNibble(int value);
};
//main objects we will be working with:
unsigned long injHiStart; //for timing injector pulses
LCD lcd;
Trip tmpTrip;
Trip instant;
Trip current;
Trip tank;
void processInjOpen(void){
injHiStart = microSeconds();
if(soundSource==1)
digitalWrite(PiezoPin,HIGH);
}
void processInjClosed(void){
tmpTrip.injHius += elapsedMicroseconds(injHiStart);
tmpTrip.injPulses++;
if(soundSource==1)
digitalWrite(PiezoPin,LOW);
}
//attach the vss/buttons interrupt
int vsspinstate=0;
boolean piezoToggle = true;
ISR( PCINT1_vect ){
int p = PINC;//bypassing digitalRead for interrupt performance
if ((p & vssBit) != (vsspinstate & vssBit)){
tmpTrip.vssPulses++;
if(soundSource==2){
digitalWrite(PiezoPin,piezoToggle?HIGH:LOW);
piezoToggle!=piezoToggle;
}
}
vsspinstate = p;
buttonState &= p;
}
void setup (void){
pinMode(BrightnessPin,OUTPUT);
analogWrite(BrightnessPin,255-brightness[brightnessIdx]);
lcd.init();
lcd.print("OpenGauge ");
lcd.gotoXY(0,1);
lcd.print(" MPGuino");
pinMode(InjectorOpenPin, INPUT);
pinMode(InjectorClosedPin, INPUT);
pinMode(VSSPin, INPUT);
attachInterrupt(0, processInjOpen, FALLING);
attachInterrupt(1, processInjClosed, RISING);
pinMode( PiezoPin, OUTPUT);
pinMode( lbuttonPin, INPUT );
pinMode( mbuttonPin, INPUT );
pinMode( rbuttonPin, INPUT );
//"turn on" the internal pullup resistors
digitalWrite( lbuttonPin, HIGH);
digitalWrite( mbuttonPin, HIGH);
digitalWrite( rbuttonPin, HIGH);
digitalWrite( VSSPin, HIGH);
//low level interrupt enable stuff
PCICR |= (1 << PCIE1);
PCMSK1 |= (1 << PCINT8);
PCMSK1 |= (1 << PCINT11);
PCMSK1 |= (1 << PCINT12);
PCMSK1 |= (1 << PCINT13);
if (debug) Serial.begin(9600);
delay(1500);
}
unsigned long looptime=1000000; //one second
void loop (void){
unsigned long loopStart=microSeconds();
instant.reset(); //clear instant
instant.update(tmpTrip); //"copy" of tmpTrip in instant now
tmpTrip.reset(); //reset tmpTrip so we don't lose too many interrupts
current.update(instant); //use instant to update current
tank.update(instant); //use instant to update tank
updateDisplay();
//see if any buttons were pressed
if(!(buttonState&lbuttonBit)){
brightnessIdx = (brightnessIdx + 1) % 4;
analogWrite(BrightnessPin,255-brightness[brightnessIdx]);
}
buttonState=lbuttonBit + mbuttonBit + rbuttonBit;//reset the buttons
while (elapsedMicroseconds(loopStart) < (looptime));//
}
char fBuff[7];//used by format
//format a number into NNN.NN the number should already be representing thousandths
char * format(unsigned long num){
unsigned long d = 10000;
long t;
int dp=3;
int l=6;
//123456 = 123.46
if(num>9999999){
d=100000;
dp=99;
num/=100;
}else if(num>999999){
dp=4;
num/=10;
}
unsigned long val = num/10;
if ((num - (val * 10)) >= 5) //will the first unprinted digit be greater than 4?
val += 1; //round up val
for(int x = 0; x < l; x++){
if(x==dp) //time to poke in the decimal point?
fBuff[x]='.';
else{
t = val/d;
fBuff[x]= '0' + t%10;//poke the ascii character for the digit.
val-= t*d;
d/=10;
}
}
fBuff[6]= 0; //good old zero terminated strings
return fBuff;
}
void updateDisplay() {
lcd.gotoXY(0,0);lcd.print("%D");lcd.print(format(instant.injHius*1000));lcd.print(" C");lcd.print(format(instant.injPulses*1000));
lcd.gotoXY(0,1);lcd.print("VC");lcd.print(format(instant.vssPulses*1000));lcd.print(" T");lcd.print(format(tank.time()));
// lcd.gotoXY(0,2);lcd.print("TC");lcd.print(format(tank.vssPulses*1000));lcd.print(" G");lcd.print(format(tank.gallons()));
}
void updateDisplay2() {
lcd.gotoXY(0,0);
lcd.LcdDataWrite(7); //special IN character
// lcd.print(format(instant.miles()));
lcd.print(format(123456));
lcd.LcdDataWrite(0); //half of the M/G symbol
lcd.LcdDataWrite(1); //other half of the M/G symbol
// lcd.print(format(current.mpg()));
lcd.print(format(tank.time()));
lcd.LcdDataWrite(6); //special CU character
lcd.gotoXY(0,1);
lcd.LcdDataWrite(5); //special MI character
// lcd.print(format(tank.miles()));
lcd.print(format(1234567));
lcd.LcdDataWrite(2); //half of the TK symbol
lcd.LcdDataWrite(3); //other half of the TK symbol
//lcd.print(format(memoryTest()));
// lcd.print(format(tank.gallons()));
lcd.print(format(12345678));
lcd.LcdDataWrite(4); //special GA character
}
Trip::Trip(){
}
unsigned long Trip::miles(){
return (vssPulses*1000)/vssPulsesPerMile;
}
unsigned long Trip::gallons(){
return (injHius*1000)/microSecondsPerGallon;
}
unsigned long Trip::mpg(){
unsigned long mi=miles();
unsigned long gal=gallons();
if (gal==0) gal=1;//default to a thousandth of a gallon so not division by zero
return mi*1000/gal;
}
//return the seconds as a time mmm.ss, eventually hhh:mm too
unsigned long Trip::time(){
// return seconds*1000;
int d = 60;
// if(seconds/60 > 999) d = 3600; //scale up to hours.minutes if we get past 999 minutes
return ((seconds/d)*1000) + ((seconds%d) * 10);
}
void Trip::update(Trip t){
seconds++; //we call update once a second
injPulses+=t.injPulses;
vssPulses+=t.vssPulses;
injHius+=t.injHius;
if (injHius>=1000000){ //rollover into the injHiSec counter
injHiSec++;
injHius=1000000-injHius;
}
}
void Trip::reset(){
seconds=0;
injPulses=0;
injHius=0;
injHiSec=0;
vssPulses=0;
}
//LCD functions
LCD::LCD(){
}
//x=0..16, y= 0..1
void LCD::gotoXY(int x, int y){
if (debug) Serial.println("");
int dr=x+0x80;
if (y==1)
dr += 0x40;
if (y==2)
dr += 0x14;
if (y==3)
dr += 0x54;
lcd.LcdCommandWrite(dr);
}
void LCD::print(char * string){
if (debug) Serial.print(string);
int x = 0;
char c = string[x];
while(c != 0){
lcd.LcdDataWrite(c);
x++;
c = string[x];
}
}
//do the lcd initialization voodoo
void LCD::init(){
pinMode(EnablePin,OUTPUT);
pinMode(DIPin,OUTPUT);
pinMode(DB4Pin,OUTPUT);
pinMode(DB5Pin,OUTPUT);
pinMode(DB6Pin,OUTPUT);
pinMode(DB7Pin,OUTPUT);
delay(500);
LcdCommandWrite(0b0010); // 4 bit operation
LcdCommandWrite(0b00101000);// 4-bit interface, 2 display lines, 5x8 font
LcdCommandWrite(0b00001100); // display control:
LcdCommandWrite(0b00000110); // entry mode set: increment automatically, no display shift
LcdCommandWrite(0b01000000); // set cgram
//create some custom characters
byte chars[]={//if you squint, you can kind of see the characters below. see the 'N' in the lower right?
// M/,G T,K GA MI CU IN
0b00101,0b00000,0b00000,0b00000,0b01100,0b10100,0b01100,0b11100,
0b00111,0b00100,0b00000,0b00000,0b10000,0b11100,0b10000,0b01000,
0b00101,0b01000,0b00111,0b10100,0b10100,0b10100,0b10000,0b01000,
0b00101,0b10000,0b00010,0b11000,0b01100,0b10100,0b01100,0b11100,
0b00000,0b01100,0b00010,0b10100,0b00010,0b00111,0b00101,0b01001,
0b00001,0b10000,0b00010,0b10100,0b00101,0b00010,0b00101,0b01101,
0b00010,0b10100,0b00000,0b00000,0b00111,0b00010,0b00101,0b01011,
0b00100,0b01100,0b00000,0b00000,0b00101,0b00111,0b00111,0b01001};
for(int x=0;x<8;x++)
for(int y=0;y<8;y++)
//LcdDataWrite(chars[y*8+x]); //write the character data to the character generator ram
LcdCommandWrite(0x00000001); // clear display, set cursor position to zero
LcdCommandWrite(0x10000000); // set dram to zero
analogWrite(ContrastPin,contrast);
}
void LCD::tickleEnable(){
// send a pulse to enable
digitalWrite(EnablePin,HIGH);
delayMicroseconds(1); // pause 1 ms according to datasheet
digitalWrite(EnablePin,LOW);
delayMicroseconds(1); // pause 1 ms according to datasheet
}
void LCD::cmdWriteSet(){
digitalWrite(EnablePin,LOW);
delayMicroseconds(1); // pause 1 ms according to datasheet
digitalWrite(DIPin,0);
}
int LCD::pushNibble(int value){
digitalWrite(DB7Pin, value & 128);
value <<= 1;
digitalWrite(DB6Pin, value & 128);
value <<= 1;
digitalWrite(DB5Pin, value & 128);
value <<= 1;
digitalWrite(DB4Pin, value & 128);
value <<= 1;
return value;
}
void LCD::LcdCommandWrite(int value){
value=pushNibble(value);
cmdWriteSet();
tickleEnable();
value=pushNibble(value);
cmdWriteSet();
tickleEnable();
delay(2);
}
void LCD::LcdDataWrite(int value){
digitalWrite(DIPin, HIGH);
value=pushNibble(value);
tickleEnable();
value=pushNibble(value);
tickleEnable();
delay(2);
}
// this function will return the number of bytes currently free in RAM
int memoryTest() {
int byteCounter = 0; // initialize a counter
byte *byteArray; // create a pointer to a byte array
while ( (byteArray = (byte*) malloc (byteCounter * sizeof(byte))) != NULL ) {
byteCounter++; // if allocation was successful, then up the count for the next try
free(byteArray); // free memory after allocating it
}
free(byteArray); // also free memory after the function finishes
return byteCounter; // send back the highest number of bytes successfully allocated
}
__________________
WINDMILLS DO NOT WORK THAT WAY!!!
Last edited by dcb; 05-20-2008 at 02:55 AM..
|
|
|
05-12-2008, 09:53 AM
|
#44 (permalink)
|
FuelSipper
Join Date: Mar 2008
Location: Dallas, TX
Posts: 99
Thanks: 0
Thanked 8 Times in 3 Posts
|
Quote:
Originally Posted by dcb
2 things:
1. (not related to the signal issue), is a25 battery power? You want the guino to stay on when the key is removed.
|
Yea, it turns off when I remove the key. I guess I need another power source.
Quote:
Originally Posted by dcb
2. I didn't get much time this weekend, but the code below will display the low level vcc counts and the injector open time and the number of injector pulses received. It may help with troubleshooting.
|
That's exactly what I need to troubleshoot. Thanks for that, dcb.
|
|
|
05-12-2008, 12:46 PM
|
#45 (permalink)
|
EcoModding Apprentice
Join Date: Feb 2008
Location: Streamwood, IL
Posts: 105
Dakota - '00 Dodge Dakota Club Cab, Sport 90 day: 18.57 mpg (US) Jeep - '01 Jeep Wrangler TJ Sport 90 day: 18.46 mpg (US)
Thanks: 0
Thanked 1 Time in 1 Post
|
FWIW, I spotted a minor flaw in your LCD::init() function
Code:
for(int x=0;x<8;x++)
for(int y=0;y<8;y++)
//LcdDataWrite(chars[y*8+x]); //write the character data to the character generator ram
LcdCommandWrite(0x00000001); // clear display, set cursor position to zero
The statement LcdDataWrite(...) function is commented out, so the next executable statement for the for(...) is the LcdCommandWrite(). It's in the init, so it may not matter that it happens 64 times.
Just thought you'd like to know. You may have others, this one just jumped out at me.
Anthony
__________________
|
|
|
05-12-2008, 08:03 PM
|
#46 (permalink)
|
needs more cowbell
Join Date: Feb 2008
Location: ÿ
Posts: 5,038
Thanks: 158
Thanked 269 Times in 212 Posts
|
Quote:
Originally Posted by awillard69
FWIW, I spotted a minor flaw in your LCD::init()
Anthony
|
Wow, nice catch Yah, it won't hurt it to clear the screen 64 times, but was not intentional.
__________________
WINDMILLS DO NOT WORK THAT WAY!!!
|
|
|
05-12-2008, 09:33 PM
|
#47 (permalink)
|
needs more cowbell
Join Date: Feb 2008
Location: ÿ
Posts: 5,038
Thanks: 158
Thanked 269 Times in 212 Posts
|
FYI, I moved my tap to the injector lead itself. What I thought should be an injector lead on the ecu wasn't panning out?!?
Also, I'm not convinced this input circuit is doing anything. I don't have an oscilloscope unfortunately, but I probed around with a piezo and could hear the injector signal with it connected to the injector lead, and also could hear it across the 100k resistor, but cannot hear any ticks getting to pins 2 or 3, with the other end of the piezo grounded, or hooked to positive. Will try again on the breadboard version. Might need more thinkin, I will probably try just a 100k and some zeners next.
So I'm at a loss to explain the first trips readings...
__________________
WINDMILLS DO NOT WORK THAT WAY!!!
|
|
|
05-12-2008, 10:13 PM
|
#48 (permalink)
|
needs more cowbell
Join Date: Feb 2008
Location: ÿ
Posts: 5,038
Thanks: 158
Thanked 269 Times in 212 Posts
|
Ok, tried this on the injector line, it seems pretty solid, and was way easy to hook up (the shack had the zeners):
Unless someone can troubleshoot the transistor version, I'll update the diagrams accordingly.
It was giving me about 3.1% duty cycle at idle on the one injector (guessing that = .3gph), and would jump up when I gunned it, and about 18 pulses/secnd at 2000rpm, v.s. 9 at 1000rpm which is pretty close for a mpfi 4 cylinder. Using the debug code a couple posts ago.
Will probably do something similiar to the vss signal if I can't get that working better.
__________________
WINDMILLS DO NOT WORK THAT WAY!!!
Last edited by dcb; 05-12-2008 at 11:43 PM..
|
|
|
05-13-2008, 03:59 PM
|
#49 (permalink)
|
EcoModding Lurker
Join Date: Jan 2008
Location: us
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
|
dcb:
What method did you use to calculate your microseconds per gallon?
For a DOHC Saturn, with 21lb/hr injectors I get
Code:
21.00 lbs/hr
6.25 lbs/gal gas (~72 deg F gas)
3.36 gal/hr
17.86 minutes/gal
1,071.43 seconds/gal
1,071,428,571.43 microseconds/gal per injector
267,857,142.86 microseconds/gal with 4 injectors?
Fuel temperature will have a big impact on the calculation, I wonder how scanguage or oem systems handle this (ignore it?).
I just put in my order, and hope to get it running on my non-obdii SL1 pretty soon..
Last edited by mosier; 05-13-2008 at 04:14 PM..
|
|
|
05-13-2008, 07:12 PM
|
#50 (permalink)
|
needs more cowbell
Join Date: Feb 2008
Location: ÿ
Posts: 5,038
Thanks: 158
Thanked 269 Times in 212 Posts
|
The math looks right for 21lb injectors. FYI, there is another fly in the saturn ointment, it looks like the fuel pressure is regulated by manifold pressure. Still it should be a useful tool even without measuring fuel temp or manifold pressure. Of course the fuel composition plays a role too.
__________________
WINDMILLS DO NOT WORK THAT WAY!!!
|
|
|
|