Notifications
Clear all

Fuel injectors controlled from Arduino

33 Posts
4 Users
1 Likes
8,698 Views
(@bmann)
Member
Joined: 4 years ago
Posts: 10
 

@zeferby

Ok this sketch BrianEFI-V01 does work, no Pin 7 stuck on / high.


   
ReplyQuote
(@bmann)
Member
Joined: 4 years ago
Posts: 10
 

@pugwash

I appreciate the help understanding the millis function..  Nice to not have to use delay and hold everything up.


   
ReplyQuote
(@zeferby)
Member
Joined: 5 years ago
Posts: 355
Topic starter  

@bmann Wow ! That's ugly !

As I wrote I could not test that code.  I'll try to rig something with a pot + LEDs to impersonate injectors if I can find a spare UNO, and I'll probably make all timings x100 to make some time available during the loop() for some Serial.print statements (to get a debug trace).

 

Edit : AAARGH ! Actually I just re-read the EFI00.ino code and facepalmed !

 

When I copy/pasted the block at lines 63-71 to lines 72-82 I forgot to replace the "start" with "stop" two times !

Lines 72-82 currently read like this with the bug :

 else if (stopInjectTime > 0) //an injector is currently injecting and waiting for the time to stop injection
{
if (currentTime > startInjectTime)
{
startInject(); //stop injecting with current injector, calculate the time when we have to start again, make next injector "current"
}
else // continue waiting
{
delayMicroseconds(50);
}
}//else if (stopInjectTime > 0)

and they should be like that (test vs. stopInjectTime line 74 and stopInject line 76) :

 else if (stopInjectTime > 0) //an injector is currently injecting and waiting for the time to stop injection
{
if (currentTime > stopInjectTime)
{
stopInject(); //stop injecting with current injector, calculate the time when we have to start again, make next injector "current"
}
else // continue waiting
{
delayMicroseconds(50);
}
}//else if (stopInjectTime > 0)

 

Also at line 85 the initial "current" injector should be 0 for the startup sequence.

 

This is the version of EFI00.ino with the above corrections :

 

Eric


   
ReplyQuote
(@bmann)
Member
Joined: 4 years ago
Posts: 10
 

@zeferby

Thank you it works!

Using various resistors to change voltage to A0 we have different speeds.  I will make  short video to share with this group later today or tomorrow or once I get a variable pot.  This is a huge learning experience for me .


   
ReplyQuote
(@zeferby)
Member
Joined: 5 years ago
Posts: 355
Topic starter  

@bmann Warning : I also forgot to change the injectDelay declaration from byte or uint8_t to unsigned int or uint16_t

So when your throttle is down for low speed/high delay, you will get a weird behaviour when the delay crosses the 255ms value : since the byte variable will overflow, anything > 255 will actually give you the modulo/remainder, for example :

a theoretical 300ms will give an actual 300-255 = 45 ms and 400ms will give an actual 400-255=145 ms !

To correct this, please change line 21 to declare injectDelay as an uint16_t or an unsigned int

Eric


   
ReplyQuote
(@bmann)
Member
Joined: 4 years ago
Posts: 10
 

@zeferby

I will adjust  lines thanks.


   
ReplyQuote
(@bmann)
Member
Joined: 4 years ago
Posts: 10
 

Here is project working!


   
ReplyQuote
(@pugwash)
Sorcerers' Apprentice
Joined: 5 years ago
Posts: 923
 

@bmann

Cool!! Glad you got it working and learned about millis() too!

I do have one question that no one has answered yet if it is not a too complicated answer!!

I own an Audi 3.0 TDI and achieve full 500N/M torque at 1300 RPM (goes off the lights like a rocket ?), why does a petrol-driven engine need more than 4000 RPM to reach full torque?

And I thought I would show you the sort of crankshafts I used to deal with, during my past (working) life!

P1010004

   
ReplyQuote
(@zeferby)
Member
Joined: 5 years ago
Posts: 355
Topic starter  

@pugwash

Wow these are serious crankshafts ! (sub?)Marine engines ?

Eric


   
ReplyQuote
(@pugwash)
Sorcerers' Apprentice
Joined: 5 years ago
Posts: 923
 

@zeferby

You are correct! Ship's diesel engines.


   
ReplyQuote
(@bmann)
Member
Joined: 4 years ago
Posts: 10
 

@pugwash

This is a great question.

Almost all of my experience is with gasoline / petrol  engines.  Diesel and gasoline have nearly the same energy when equal weights are compared, however diesel is more dense than gasoline so there is more power by volume.   Here is a link some one who knows more than I do. 

 

Those are large crankshafts?   locomotive / marine ?


   
ReplyQuote
(@pugwash)
Sorcerers' Apprentice
Joined: 5 years ago
Posts: 923
 

@bmann

Thanks, I'll take a peek at it!

By the way, did you refer to racing cars and 3000 rpm in one sentence? I learned that F1 racing cars go up to 16000 rpm, with little 1.6 litre engines. I may be wrong but if I'm not they must be just ticking over at 3000 rpm.


   
ReplyQuote
(@bmann)
Member
Joined: 4 years ago
Posts: 10
 

@pugwash

Yes I did,  I was being sarcastic. 3k RPM is slow indeed.  This is fast enough for my demonstration.  The  less the stroke of the engine the easier and more reliably it can reach higher RPM .   I believe that in the design end of things it is the piston speed that is the limiting design factor.  I remember a sport bike I had that dint really make any power till about 8k,   and pulled hard though 12.5k I think the stroke on that engine was around 1.7 inches.


   
ReplyQuote
(@pugwash)
Sorcerers' Apprentice
Joined: 5 years ago
Posts: 923
 

@bmann

Yes I did,  I was being sarcastic.

Oh! That went right over my head. ? 


   
ReplyQuote
(@pugwash)
Sorcerers' Apprentice
Joined: 5 years ago
Posts: 923
 

@bmann

The video on petrol vs diesel was very enlightening.

In fact, I think the penny has finally dropped on the subject of "Why are two strokes more powerful that four strokes in small motorbike engines?"

You could say "Every stroke counts" ? ? ? 


   
ReplyQuote
Page 2 / 3