Go Down

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


Are there any update's about using Arduino with common rail?

Not working yet, have been a bit busy with other aspects of the machine but did come somewhat closer.
Currently the electronics for the PWM driver for the pump pressure and the alternator are being made and the alternator housing is finished.
Also have some testing to do since my new injectors are slightly different from my previous ones.

My previous project with timer stuff and injector drivers in it can be found at: http://www.minimumrisk.nl/articles.php?lng=nl&pg=270

Last code looks like this:
Code: [Select]
  Cuprum-2.0 simplified 1-3-4-2 cylinder common rail injection system for Arduino Mega.
  Using interrupts for timing injections cycle, a timing disc (alternator) is mounted to camshaft.
  Throttle position is read from potentiometer.
  Base rule for the system is that we want all fuel injected at 10 crank degree before TDP:
  - timer 2 gives pulse for cylinder 1
  - wait (180 degrees in uS at current rpm) - injection time - (10 degrees in uS at current rpm)
  Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground, output will be 0-1023.
  Attach timing signals to external interrupts: cyl1 pin 3, cyl2 pin 21, cyl3 pin 20 and cyl4 pin 19.
  Attach injector drivers: cyl1 pin 4, cyl2 pin 5, cyl3 pin 6 and cyl4 pin 7.

// setup pin for throttle potentiometer:
int ThrottlePin = A0;
unsigned long ThrottleValue = 0;
unsigned long ThrottleDuration = 0;
// base idle injectiontime is 100uS
unsigned long IdleDuration = 100;
// define throttle calibration values:
// we like to inject from -45 to -10 TDP making 35 degree injection duration max.
// crank duration in uS: (1000000/(rpm/60))/360*35
// at 10K rpm that is 583uS since the throttle has 1023 steps 1023/583=1.75
float ThrottleCalib = 1.75;
// define injection delay
unsigned long InjectionDelay = 0;
// define microsecond timeframe between 2 injects = duration 90 degree camshaft/ 180 degree crankshaft
unsigned long TimeFrame = 0;
unsigned long TimeOld = 0;
unsigned long Delay = 0;
// setup timer pins for interrupts:
int cyl1 = 1;
int cyl2 = 2;
int cyl3 = 3;
int cyl4 = 4;
volatile int state = LOW;
// setup pins for injector drivers:
int inj1 = 4;
int inj2 = 5;
int inj3 = 6;
int inj4 = 7;

void setup()
  // initialize the digital injector pins as an output:
  pinMode(inj1, OUTPUT);     
  pinMode(inj2, OUTPUT);     
  pinMode(inj3, OUTPUT);     
  pinMode(inj4, OUTPUT);
  // attach action when interrupt gets actived:
  pinMode(cyl1, INPUT);
  attachInterrupt(1, inject1, RISING);
  pinMode(cyl2, INPUT);
  attachInterrupt(2, inject2, RISING);
  pinMode(cyl3, INPUT);
  attachInterrupt(3, inject3, RISING);
  pinMode(cyl4, INPUT);
  attachInterrupt(4, inject4, RISING);

void loop()
  // read the throttle input on analog pin 0:
  ThrottleValue = analogRead(ThrottlePin);
  // see if we are trying to have fun
  if (ThrottleValue > 5)
    // injection delay uS/180*170 to make sure all juice is injected 10 degree before TDP.
    InjectionDelay = TimeFrame/18*17;
    // recalculate throttle value to wanted microseconds:
    ThrottleDuration = ThrottleValue/ThrottleCalib;
    // check the interrupts:
    digitalWrite(cyl1, state);
    digitalWrite(cyl2, state);
    digitalWrite(cyl3, state);
    digitalWrite(cyl4, state);
  // it seems we are idling
    // on idle we want injecting to stop at TDP not before
    InjectionDelay = TimeFrame;
    // if we are running 900rpm we reduce injection time
    if (TimeFrame > 33333)
      // reduce injection time
      ThrottleDuration = IdleDuration;
    // if we are running 800rpm we inject a bit longer
    else if (TimeFrame < 37500)
      // expand injection time
      ThrottleDuration = IdleDuration;
    // check the interrupts:
    digitalWrite(cyl1, state);
    digitalWrite(cyl2, state);
    digitalWrite(cyl3, state);
    digitalWrite(cyl4, state);

void inject1()
  // find out how many uS 90 degrees camshaft is
  TimeFrame = (micros() - TimeOld);
  TimeOld = TimeFrame;
  Delay = InjectionDelay-ThrottleDuration;
  // open injector, hold it and close
  digitalWrite(inj1, HIGH);
  digitalWrite(inj1, LOW);

void inject2()
  TimeFrame = (micros() - TimeOld);
  TimeOld = TimeFrame;
  Delay = TimeFrame/18*17-ThrottleDuration;
  digitalWrite(inj2, HIGH);
  digitalWrite(inj2, LOW);

void inject3()
  TimeFrame = (micros() - TimeOld);
  TimeOld = TimeFrame;
  Delay = TimeFrame/18*17-ThrottleDuration;
  digitalWrite(inj3, HIGH);
  digitalWrite(inj3, LOW);

void inject4()
  TimeFrame = (micros() - TimeOld);
  TimeOld = TimeFrame;
  Delay = TimeFrame/18*17-ThrottleDuration;
  digitalWrite(inj4, HIGH);
  digitalWrite(inj4, LOW);


Jan 13, 2013, 08:57 pm Last Edit: Jan 13, 2013, 09:07 pm by Panther95 Reason: 1
Thanks for the update. I have been looking around on the net for something like this, and this looks very good.
I have a Hobbysport tractor with a friend. A Same Panther with 6 cyl 6ltr engine and stock it has prf1k90.... pumps in it( each cyl its own 9mm pump).
And they can't be made bigger, only good thing about them is that they start with 700bar can go up to 1200bar of injection pressure.
A Inline would be the first chose for many. I think that Common rail could be "easyer" to build, mechanicly than.
Only the hardest part for now is to find injectors that could fit with the least modifycations.

I found the Cuprum befor the arduino, only my electronics knowledge isn't so good.
Are you using a alternator to replace a rotary encoder? bit like this link http://christian.liljedahl.dk/guides/simple-rotary-encoder

Hope to see more here.


Hello Panther,

In the past we drove with our electronics system with injectors from a John Deere 8.5 common rail but they are pretty big.
You could find some injector that fits and then change the nozzle to the desired flow or drill the holes to what you want.
In a common rail the holes aren't much smaller then in a conventional system and when using bosh you can also switch nozzles from conventional to CR and visa versa fine when choosing carefully.
Main problem is finding a pump that delivers enough.
I know that a stock 2.0hdi (as fitted on a PSA engine) Siemens pump can deliver up to 160cc without problems according to the specs. and we can "over" rpm the thing to get more juice, but above 5000 pump rpm it will die.

We have two machines based on a 2.0 engine:
On our current conventional Bosch A-pump we use 10mm. plungers at 160cc. and one P-pump with 12mm. plungers at 240cc. Both machines have a different setup, the 160 was meant to scale from lower to upper until pistons start melting and the other we started very high and work our way downwards until critical temps are reached.

I will post results of the project over here but first I have some other rebuilding stuff to do and will setup a test setup on my workbench to gather data about pump capacity/pressure related to injection time, nozzle size and injection duration.
After that some testing of the main program and IF working I will replace the line-pump...


Hello Japie,

I already thought those injectors where from a John Deere. I repair Same and Claas tractors, Claas use also JD. They won't fit my Same.
Next week I have some injectors to try. Have you drilled a nozzle your self? For this year I'm putting pumps from a "bigger" engine( still 9mm only with bit more delivery)  and the nozzles need to be 0.295mm. So we talked about drilling them.
For you to look for a bigger pump would be hard I think, for me would be trucks a good source. Or maybe this could be an idea? http://www.albertazziracing.com/foto-foto1-2009.html
Fun to see some one else doing this, especially when he's doing better :D



Drilling nozzles is only good for creating porcupines.

Over here you can find a small list of bosch nozzles usable on a lot of different injectors, mechanical or electronic all exchangeable:

DSLA is the "dimension" type and the 145 is the spray angle, only thing not listed is the injector angle in the head so you have to see before you buy.
If you have some other model it is still possible they can be exchanged, find some nozzle reseller and try.

Truck pumps have the disadvantage for me that they can't handle high rpm's, the 2.0l engine is good for 9000rpm (even with convential mechanical pump) so that means 4500 for the pump, large pumps like on US Cummins diesel pick up trucks can only rev to 2500 or 3000 so they are off. (and heavy since our class may only weight 600kg including driver that is an issue)
For tiny use (up to 200cc) a pump from 3.0l automotive engine will do, for your goal a truck pump will probably do it's job.

When looking at the pics from the Italians I think they can use more juice, no idea what temps and air flow they have but I don't see enough smoke... ;-)

Go Up