Singke cylinder efi

Good day guys

So i am busy with a single cylinder efi.

It is going to be as simple as possible.

So the inputs wil be a potentiometer conected to the throttle to determine the position and sensor for cam position. And outputs will be 1 injector.

I know there is Arduinos that they use for efi systems but i want to use the uno.

So this is the idea

When the cam sensor is made , the injector must fire in miliseconds that is determined by the potentiometer, so in other words if the engine speed is low and the throttle is closed the injector must fire one or 2 pulses every time the program reads the cam sensor , but when the throttle is opened (changing the value of the pod) then the injector must fire 2 or 4 pulses and so on as the throttle is opened more.

I wil poste the program later today , i have built it on a bread bord with an led as the injector , the problem i have is the speed at witch the injector fires is proportional to the value of the potentiometer , in other words the more closed the pot the slower the led blinks but stays on for the same amount of time that it is off ,

Not sure if you guys will understand but ill try to explain more if need be. Any way any suggestions?

Hi,
Have you looked at this?

Tom... :slight_smile:

not quite what i need but thank you,

what i need is code that will blink the led at a constant pulse length, lets say 25ms and the potensiometer will determain the length between pulses ? i am doing some home work to see what i can find,

i am trying also to stay away from the delay function as this will make the program slow.

This is the code so far , as i said , i want the injector on time to be constant , but the amount of time it is on must be determined by the pot

// inputs

int CamPos = 7; // CamPos
int potPin = 5;    // The input pin for the potentiometer
int val = 0;       // Variable to store the value coming from the pod
 
// outputs
int injector = 8; // Injector (using MOSFET)
int LED = 10;
 
 
// setup
void setup()
{
// proxy for cam position input
 pinMode(CamPos, INPUT); // the proxy on the cam wil give this input

 
 // set injector pin as output
 pinMode(injector, OUTPUT);

 
 // enable by default
 digitalWrite(injector, LOW);
 
 
 
 // wait 6 seconds
 delay(1000);
}
 
// loop
void loop()
{
   
   // check when cam sensor is activated
 if (digitalRead(CamPos) == LOW)
 {
   // power on/off injector with reverance to the POT
   val = analogRead(potPin);    // read the value from the POT
  digitalWrite(injector, HIGH);  // turn the Relay on
  delay(val);                  // stop the program for some time
  digitalWrite(injector, LOW);   // turn the Relay off
  delay(val);                  // stop the program for some time

  
 }
}

Not that I have ever done any monkeying around with EFI, but I thought that the O2 sensor in the exhaust was pretty critical to the calculation of how much fuel to spray.

Google tells me that these other inputs are pretty standard:
RPM
Airflow
Manifold pressure
Air temp
Water temp

Hi,
You are using delay to give you your pulsed output, however delay() causes the code to STOP for the delay time.

You would be better to use millis as your timing.
Look for in the IDE Examples, "Blink without Delay" it will allow you to blink your LED ans still process other data.

Tom... :slight_smile:

okay some good news.

it sort of runs hehe ,

problem i am having is the time the injector is on is way to long so it over fuels the engine.

when i start it i pulse the fuel pump every 3 to 4 seconds an then it keeps on running,

so next step is to change up the programming.

so the sensor on the camshaft is picking up nicely, it pulses once every 2 rotations of the engine.

i am going to see if i can modify blink without delay program and make that work for me.

still looking for a way to get the led(injector) to flash at a constant length like eg. 25ms and then control the amount of time it pulses..

i will also like to read the rpm of the motor by the cam sensor as it is running at half the engine speed i can maybe code it in somehow

thanks for the inputs so far!!

so after a bit of homework, i came across nbailey52 post asking to blink without delay for diverent times.

this is the code

#define LED_PIN 13
#define LED_ON 5       //milliseconds
#define LED_OFF 2000

unsigned long ms;        //time from millis()
unsigned long msLast;    //last time the LED changed state
boolean ledState;        //current LED state


void setup(void)
{
    pinMode(LED_PIN, OUTPUT);
}

void loop(void)
{
    ms = millis();
    blinkLED();
}

void blinkLED(void)
{
    if (ms - msLast > (ledState ? LED_ON : LED_OFF)) {
        digitalWrite(LED_PIN, ledState = !ledState);
        msLast = ms;
    }
}

now this will work with some modifications.

the #define LED_OFF 2000 at the start of the program needs to be made so that the value can be change by the potensiometer, so i was thinking adding "int val = 0;" and then using the value of the pot , divide or multiply it or use it as is to give the off delay for the function.

sorry to ask you guys but can someone help me with changing the code like this ? i can not seem to get it working , ill still be fiddling away to see if i can get it
:slight_smile: