Hello everyone,
I'm afraid this is going to be a long one so buckle up.
I'm working on my final project for my bachelor's degree automotive technology and I need to put a standalone ECU on a Audi A1 1.4TFSI. a student last year did the install and first configuration of the ECU and stumbled on a problem: the high pressure fuel pump has a normally closed spill valve instead of a normally open spill valve. A picture of the difference in signal is shown below (longest signal being normally closed):
This means that the ECU sends out the shortest signal.
The previous student had contact with the engineers at Link and they said it couldn’t be done. That’s where I and the Arduino come in to play. So I now need to finish this project and need to find a solution for the pump.
My idea is to take the crankshaft position signal and the pump control signal as my inputs. The crankshaft position signal counts the amount of teeth and resets the signal when TDC comes by so it can count again. This way I can count for example 1 and teeth to start the signal (the start of the signal is always constant in this type of signal). Then I use the pump control signal the end my signal. The pump control signal variates in function of desired pressure, so if I use this signal, the ECU can still calculate the desired fuel pressure and can correct the signal if the pressure is too high or too low.
I programmed the signals separately to test if they worked and they did. Bringing them together was a bit harder but I managed to make something out of it and you can find it down below:
//poorten
const byte Sensor = 2;
const byte Pulse = 7;
const byte End = 3;
//pulsduur
unsigned long delta_new;
unsigned long delta_old;
volatile bool state;
//BDP-trigger
unsigned long trigger;
const float treshhold = 1.9;
//tandentelling
int teller = 1;
//eindherkenning
unsigned long delta_end;
volatile bool eind;
bool signal;
void setup() {
pinMode(End, INPUT);
pinMode(Sensor, INPUT);
pinMode(Pulse, OUTPUT);
attachInterrupt(digitalPinToInterrupt(Sensor), crankPos, RISING);
attachInterrupt(digitalPinToInterrupt(End), end, FALLING);
Serial.begin(115200);
}
void loop()
{
BDP_herkenning();
eind_herkenning();
if(state == true){
delta_old = delta_new;
delta_new = pulseIn(Sensor, HIGH);
teller++;
state = false;
}
if(teller == 30 || teller == 15){
tone(Pulse, 14000);
signal = true;
}
}
void crankPos(){
state = true;
}
void end(){
eind = true;
}
void BDP_herkenning(){
trigger = delta_old * treshhold;
if(delta_new >= trigger && delta_old != 0){
Serial.println(teller);
teller = 1;
}
}
void eind_herkenning(){
if(eind == true){
delta_end = pulseIn(End, LOW, 400);
if(delta_end == 0 && signal == true){
noTone(Pulse);
signal = false;
delta_end = 1;
}
eind = false;
}
}
In short, the interrupt on pin 2 gets triggered by the crankshaft position signal and counts a tooth and measures the pulse duration to see if it’s 1.9 times longer than the previous one (there a 2 missing teeth on top dead center). For some reason, it only counts 30 teeth instead of the 58 but it does this consistently so I didn’t bother it. On tooth 30 (is actually the first one) and tooth 15.
Then, interrupt on pin 3 gets triggered by the signal and measures the duration of LOW with a timeout of 400µs. I did this because I want it to return 0 when it is measuring when the signal ends. This way it doesn’t take a long time where the program is just stuck to measure a pulse where I need like a 10th of the pulse to recognize that it needs to stop the signal. So when it returns 0 and the signal was started, it stops the signal.
I measured with a scope the signal and this is what i got:
In blue you can see the crankshaft position signal, in red the pump signal of a normally closed pump, in green the signal of the arduino.
On idle, this works great, but I am having problems on 3000rpm and when I take my foot of the gas because the signal stops briefly because the engine isn’t getting any fuel. In these 2 cases, the Arduino just seems to stop. When the engine is back to idle, it still doesn’t work. I need to manually reset the Arduino before it works again.
If anybody know a way to fix this, or a whole different approach for this project, I am happy to listen.
Sorry for the extremely long text but I wanted to be as complete as possible. Thank you for your time.