View Single Post
Old 04-03-2008, 09:07 PM   #1 (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
Opengauge/MPGuino development: Freeduino signal processing

Here is what I put together to simulate a working signal processor. It *SHOULD* be possible to hook your soundcard output to the freeduino and come up with similiar readings. Hope HEX is ok, should be quicker than decimal, but I can live with decimal too.

Code:
//program to send dummy data over the serial port for prototyping the gui(s).
void setup() 
{ 
  Serial.begin(9600); 
} 
 
int number = 0; // dummy injector high and low values parsed from http://planetchampions.org/diympggauge/i1.wav
unsigned long injHiMS[]={69002,117777,101972,138435,148117,174988,98775,164693,165873,176190,113628,148571,120702,58276,39501,37891,38435,37369,37006,37142,39433,62879,71179,71995,77074,95215,86281,75419};
unsigned long injCount[]={37,40,34,51,37,43,48,50,42,46,49,38,37,39,38,37,37,36,34,33,32,32,31,32,31,32,32,33};
unsigned long vssCount[]={0,2,6,10,13,15,18,20,22,25,25,27,28,29,28,28,28,26,26,25,24,23,24,23,24,24,24,24};
 
void loop() 
{ 
  Serial.print(injHiMS[number], HEX);    
  Serial.print(","); 
  Serial.print(injCount[number], HEX);    
  Serial.print(","); 
  Serial.println(vssCount[number], HEX);    
 
  if(number == 27) { 
    // loop forever 
    while(true) { 
      continue; 
    } 
  } 
  number++; 
  delay(1000); 
}
Here is the output from the Arduino monitor serial port function in the ide (one line prints out a second):
10D8A,25,0
1CC11,28,2
18E54,22,6
21CC3,33,A
24295,25,D
2AB8C,2B,F
181D7,30,12
28355,32,14
287F1,2A,16
2B03E,2E,19
1BBDC,31,19
2445B,26,1B
1D77E,25,1C
E3A4,27,1D
9A4D,26,1C
9403,25,1C
9623,25,1C
91F9,24,1A
908E,22,1A
9116,21,19
9A09,20,18
F59F,20,17
1160B,1F,18
1193B,20,17
12D12,1F,18
173EF,20,18
15109,20,18
1269B,21,18

__________________
WINDMILLS DO NOT WORK THAT WAY!!!
  Reply With Quote