Go Down

Topic: advice needed for arduino as diesel injection brain... (Read 16892 times) previous topic - next topic


Hi cyclegadget,

The timer libs came from the playground: http://playground.arduino.cc/code/timer1

I know about the serial port speed but I have an arduino data logger spitting out it's reading true the serial port to my FriendlyARM dashboard.
The arm reads the serial port with a bash script (simple cat) and writes the data on the screen, when using 115200 I ran into problems on that so I stepped back in speed and somehow kept that for other projects...

If all works out well I remove the serial stuff completely...


Hello there, got the basic timer code working:
Code: [Select]

#include "TimerOne.h"
#include "TimerThree.h"

int ledPin = 13;
volatile int state = LOW;
volatile int InjectionCycle1  = false;

void setup()
  pinMode(ledPin, OUTPUT);
  attachInterrupt(0, Inject1, RISING); // interrupt 0 = pin 2
  Timer1.stop(); //stop the counter
  Timer1.disablePwm(9); // disables PWM on pin 9
  Timer1.disablePwm(10); // disables PWM on pin 10

void loop()

void Inject1()
  if (InjectionCycle1 == false)
    Serial.print("start injection cycle: ");
    Serial.println (millis());
    InjectionCycle1 = true;

void OpenInjector1()
  if (InjectionCycle1 == true)
    Serial.print("open injector: ");
    Serial.println (millis());
    digitalWrite(ledPin, HIGH);

void CloseInjector1()
  if (InjectionCycle1 == true)
    Serial.print("close injector: ");
    Serial.println (millis());
    Serial.println ("");
    digitalWrite(ledPin, LOW);
    InjectionCycle1 = false;

Tested this and it works as expected, next step integrate all other stuff, will port when I have it complete.
In this setup the timer replace delay. (and is not stalling the loop like delay)

edited since in first instance I used Timer1 and Timer3 both for both delays:
Using one timer for the cycle works also good so I can use Timer1 for cylinders 1 and 4 and Timer3 for cylinders 2 and 3.
Since the firing order is 1-3-4-2 there is 180 crank degree extra time between interrupt firing cycles, better would be a per cylinder dedicated timer but rewriting the Timer1 code for the extra timers on the mega is out off my league...

When I want to run this, I get: Timer1 was not declared in this scope.
I'm very new to arduino and elektronics, sorry.

And Japie I found more stuf injectors and pump. I even have a pump and four of the six injectors, aextra Uno an a Mega to start with.



Hello Panther, did you install the timer libs?

For this project you need a mega and lucky you it seem to have 6 hardware interrupts so you should be good.
Must say that I am not sure at all it will work, currently I finished my output dirver board (the 4 injector drivers and 1 PWM output for the pump pressure) but the PWM doesn't work. (the arduino does drive PWM but I made an error on the PCB)

Got my tiny automotive pump connected to an 0,75Kw motor but when making pressure it stalls (so the pump will ask for over 2HP I think) I will set it up in my lathe which should be powerfull enough.
Since the PWM doesn't work I use a car battery and some big fat resistors to control pump pressure, from the past I know that with 3V it delivers about 600bar and with the full battery load (13.8V) over 2300bar.

Also have some trouble with the injectors, they have been laying in stock for 2 years and they are jammed despite being filled with diesel. (hardware troubles it is, got one going now, will open them this weekend I suspect the diesel has turned into grease ;)

The arduino addon hardware I am making in Fritzing, one output board and one input board, when both finished and working I will post the files here to, OK?


@anybody_else, sorry for being off-topic in an arduino forum...

Found some documentation about the parts I use for the PSA 2.0Hdi engine (RHY type) with Bosch CR system:

Pump CR/CP1S3/R65/10-16S
According to a benchmark from a pump testing/overhauling company this pump delivers; 1350bar@2000rpm - 1200cc/min. In conventional pumps we speak off cc. injection amount per 1000 injections so assume we run 1000 rotations so the pump delivers 600cc.
Since we have a four stroke four cylinder that means that one pump rotation we have to feed 4 cylinders, 600/4=150cc per injector at 1000rpm but that means we have to inject 90 pump degrees/180 crank degrees to get it all in.

A bigger one is: CR/CP3S3/L110/30-789S: 1350bar@2000rpm - 2000cc/min. (AUDI 4.x/Iveco/Mitsubishi/MAN/Sisu)

Also found scope readings from the injectors:
@idle 200uS pre-inject, 2.2mS wait and 400uS main injection.
@3000rpm one injection 400uS
So it seems in automotive use we don't use injection duration for power...

And scope readings from the pump PWM (1khz):
@2000rpm 25% duty cycle
@3000rpm 35% duty cycle
Accelerating 45% duty cycle
Which is also strange, one would expect 100% when power is needed.

It seems all knowledge gathered with conventional injection is off, I know I inject 160cc. currently over 35 degree crank duration. (45btdc till 10btdc)

Wrote a test program with timer pulses relative to pump rpm (must see first how strong/fast my lathe is with the pump attached) that injects 1000 times 500uS with PWM@50% and will collect the amount of fuel while monitoring pump pressure sensor..

If someone takes offense about me posting arduino-irrelevant information please let me know... (but from my point of view it belongs to the "package" and maybe someone not familiar to diesel injections creates a new and fresh point of view)


A small update for whoever is following this subject.
2 weeks ago I finished the injectordriver addon board for the mega.
I used the LM1949 injector driver but since it was intended for 1A gasoline injectors it is not good enough for the 12A common rail injectors.
There is a resistor used for measuring Amps which is stock at 0.1ohm and currently I am using 0.005ohm and got 6-10 amps running or so, I did try to use 2 of those resistors parallel but that didn't made a difference so I think the chip thinks it's enough.

However the injectors are working!
Despite the opening "lag" of ~450uS they open and close at my arduino's wish and command!
The lag can be easily worked around in the main program since I am using a delay before injecting, it means that delay will become 450uS shorter...

I did some tests:

And summed them up:


One of the key factors for getting a well-behaved engine is to manage the fuel injection quantity accurately and repeatably. That's why people use fancy peak-and-hold drivers and voltage compensation and fuel temperature compensation and so on. A driver that barely manages to open the injector is going to put you at a real disadvantage. It sounds to me as if your driver is not providing as much current as you need, and if so you should consider uprating it.


That is correct Peter, not enough amps.
Unfortunatly the LM1949 can't do better but maybe I can fool it with a voltage divider but I am not going to test that with my good injectors...

The LM1949 is a peak and hold driver, peak is 4 times the hold and currently the driver is delivering 4 times the amps that where needed to open the injector but when I look at some scope reading I found on the net of a running engine with those injectors I am still half way when I compare it to my scope. (but mine wasn't that expensive and is a bit hard to read ;)


Jape,   how is your progress?

I'm interested in the whole concept.  If its up and running, can you report on the conclusion.


Go Up