08-07-2008, 10:55 AM
|
#11 (permalink)
|
EcoModder
Join Date: Jul 2008
Location: North Central Alabama
Posts: 572
Thanks: 110
Thanked 123 Times in 71 Posts
|
3D mapping
You can make 3D maps in code pretty easily (it's time consuming, but easy enough). You first have to have something to base your graphs on, like LOTS of data points. I attached a picture of a graph that I have done. I would give the code, but it was done for work, and i don't think it's exactly the kind of stuff we can release, but the picture should be fine. This graph took nearly 100 lines of code to get in place, and that doesn't include the skipped lines and the lines for comments. As you can see, quite complex, but this is a 3D curve with some pretty incredible fidelity, all originating from an old scanned image. If you could get me data points, or if you could get me a picture of the graph with actual numbers somewhere, I could produce you a series of curves in the same manner that I produced this curve (in code form even), and you would be responsible for getting it into the Arduino program (since I really haven't dealt with that before).
__________________
|
|
|
Today
|
|
|
Other popular topics in this forum...
|
|
|
08-27-2008, 06:35 PM
|
#12 (permalink)
|
EcoModding Apprentice
Join Date: Aug 2008
Location: UK
Posts: 104
Thanks: 3
Thanked 9 Times in 7 Posts
|
OK, so I've got my MPGuino working! It's a freeduino-based version.
After many attempts I think I now have the right connections for speed and injector.
I set the speed pulses to 16000 to get a correct mph. For the injector calibration I set it to a very large number, for now.
At a steady speed it displays a believable mpg. However if I accelerate mpg goes very high, and if I idle mpg drops. I reckon this is because the injection pressure is varying so much. So around town it's of limited use as it stands, but most of my miles are on open roads so we shall see!
This is the signal that the mpguino sees for the injector. Sign is reversed; positive on the scope was connected to ground on the arduino. Is this going to be OK,given that it does not return to zero volts, and there are effectively 2 "leading edges" per injection?
2.0HDi injector pulse at about 1900rpm (after 100k resistor)
Last edited by ecoxantia; 08-28-2008 at 05:15 AM..
|
|
|
08-27-2008, 09:46 PM
|
#13 (permalink)
|
needs more cowbell
Join Date: Feb 2008
Location: ÿ
Posts: 5,038
Thanks: 158
Thanked 269 Times in 212 Posts
|
That is sweet!!!
Question, does the spacing of the main pulses vary with rpm? The fuel pressure is supposedly RPM dependent, so you might be able to do it all in software from this point.
Edit: Let me change that, the pulse spacing had better change with RPM This ain't TBI.
__________________
WINDMILLS DO NOT WORK THAT WAY!!!
Last edited by dcb; 08-27-2008 at 10:03 PM..
|
|
|
08-27-2008, 10:51 PM
|
#14 (permalink)
|
needs more cowbell
Join Date: Feb 2008
Location: ÿ
Posts: 5,038
Thanks: 158
Thanked 269 Times in 212 Posts
|
I recon, one of the next tasks is to figure out the PSI to RPM Map. I don't suppose you have a 20,000 PSI pressure gauge? No? Ok, for now lets assume that 200 BAR is at idle, and 1350 BAR is redline, and that it is just a linear function.
I think the next step might be to figure out the RPM from the injector pulse, then figure out a "pressure multiplier" (linear function based on RPM) to combine with the usPerGallon figure, and I think you will be in the ballpark.
__________________
WINDMILLS DO NOT WORK THAT WAY!!!
|
|
|
08-28-2008, 05:14 AM
|
#15 (permalink)
|
EcoModding Apprentice
Join Date: Aug 2008
Location: UK
Posts: 104
Thanks: 3
Thanked 9 Times in 7 Posts
|
Thanks dcb.
This is the injectors at idle, 800rpm.
The picture in my previous post is at about 1900rpm.
So yes, you can see spacing varying with rpm.
The system does have a fuel pressure gauge! From the data I have it looks useful too - 0.5 volts at 100bar, 1.3 volts at 300 bar and assuming it's linear then 5 volts is about 1300bar, corresponding to max pressure.
I think this is the best solution since pressure is not quite linear with rpm, as there is a switchable 3rd piston in the injection pump. This is the "high presssure" piston. The idea is to only use highest pressures when necessary, so this 3rd piston is switched off in certain conditions. You can see why - 1300 bar don't come for free!!
So, next step - get the Arduino to grab the pressure. I have not even looked at the code so that's next...I seem to remember the memory is pretty full already, no?
|
|
|
08-28-2008, 07:17 AM
|
#16 (permalink)
|
needs more cowbell
Join Date: Feb 2008
Location: ÿ
Posts: 5,038
Thanks: 158
Thanked 269 Times in 212 Posts
|
Oh, a gauge, ok Can you confirm the voltage range of the pressure sensor @ 1350, and the correlation of voltage to displayed pressure?
It is just an analogRead to convert a 5 volt signal to a value from 0 to 1023. Recommend Analog Pin 2.
At the top of the loop, for a quick test anyway, you can do an
int press = analogRead(2) + 1;
then multiply the instant.injectorHiUS by press after copying it from temp but before updating the other trips.
Fudge microSecondsPerGallon to taste.
press *might* need an offset and a scaling factor, don't know yet.
__________________
WINDMILLS DO NOT WORK THAT WAY!!!
|
|
|
08-28-2008, 01:48 PM
|
#17 (permalink)
|
EcoModding Apprentice
Join Date: Aug 2008
Location: UK
Posts: 104
Thanks: 3
Thanked 9 Times in 7 Posts
|
According to some literature I've read (which was wrong on the connections for Vss but it's the best I have!!); yes it's a 0 to 5V signal, from a strain gage based sender. So that's good news.
Thanks a lot for the coding tips.
Do I need a resistor and diode in the circuit like the Vss and injector? I'd have thought as this is taking an analog value, it's unnecessary. Presumably the input impedance of the Arduino is high so I should not upset the voltage the car's ECU sees.
I'll try and implement! This is a lot of fun...
|
|
|
08-29-2008, 07:47 AM
|
#18 (permalink)
|
EcoModding Apprentice
Join Date: Aug 2008
Location: UK
Posts: 104
Thanks: 3
Thanked 9 Times in 7 Posts
|
So I've got the pressure input on pin2, and modified the code.
It doesn't work well! Instant mpg is zero, current is 999. What have I done wrong? CPU is at 500%...
This is part of the modified code, I've added 2 lines.
--------------------------------------------------------
#define looptime 1000000ul/loopsPerSecond //1/2 second
void loop (void){
if(newRun !=1)
initGuino();//go through the initialization screen
unsigned long lastActivity =microSeconds();
unsigned long tankHold; //state at point of last activity
while(true){
unsigned long loopStart=microSeconds();
int press = analogRead(2) + 1; //press is common rail pressure approx in bars
instant.reset(); //clear instant
cli();
instant.update(tmpTrip); //"copy" of tmpTrip in instant now
tmpTrip.reset(); //reset tmpTrip first so we don't lose too many interrupts
sei();
instant.injHius = press * instant.injHius; //correct injector for pressure variation
|
|
|
08-29-2008, 08:48 AM
|
#19 (permalink)
|
Master EcoModder
Join Date: Jun 2008
Location: Northwest Lower Michigan
Posts: 1,006
Thanks: 8
Thanked 17 Times in 16 Posts
|
Did you possibly get the VSS and INJ wires switched around? I did even after checking quite a few times. Others have too, seems like a common mistake.
__________________
Winter daily driver, parked most days right now
Summer daily driver
|
|
|
08-29-2008, 08:59 AM
|
#20 (permalink)
|
needs more cowbell
Join Date: Feb 2008
Location: ÿ
Posts: 5,038
Thanks: 158
Thanked 269 Times in 212 Posts
|
Can you declare press in global scope (right before loop) and modify:
void doDisplayInstantCurrent(){displayTripCombo('I','M' ,instant.mpg(),'S',instantmph(),'C','M',current.mp g(),'D',current.miles());}
to
void doDisplayInstantCurrent(){displayTripCombo('I','M' ,instant.mpg(),'S',instantmph(),'C','X',press,'D', current.miles());}
and see what you are getting for press in the lower left corner?
__________________
WINDMILLS DO NOT WORK THAT WAY!!!
|
|
|
|