For anything not related to Speeduino, but still about car/bike/boat/engines etc
#42234
Hello!

Im doing a little side project and converting my car (Toyota 4afe) with coil on plugs. :roll:
I have a ECU powerd distributer that contains two VR sensors.

The system works like this:
Image

So my plan was to insted of the rotor, just send the IGT signal to a arduino to distribute what coil to fire.

My plan was to set one tooth on the crank and a hallsensor, right before TDC and wiring it up with so the IGT signal goes into the arduino and also get bypassed to the coils by mosfets, Like this:
Image

The code looks like this, i setup two arduino to test it. One to fire 4 IGT signals and 1 crank signal, and the code seems to work like i should, it Sync on the first revulotion and fires 1-4 cylinders.

what i dont manage to do is to set the output to the cylinder to high when active, like i would need to get the IGT signal bypassed the mosfet.
Code: Select all
const byte IGTPin = 2;   //Interrupt pin for IGT signal from ECU (pin3)
const byte crankPin = 3;  //Interrupt pin for crankshaft reference pin (pin2)
volatile boolean syncAchieved = 0;    //Set this to true if sync has been achieved
volatile byte cylinderCounter = 0;    //Sequence which cylinder should fire (0-1-2-3)
const byte fireOrder[] = {            //Table containing the fireorder (1-3-4-2)
  B00000001,                          // cylinder 1-4
  B00000010,                          // cylinder 2-3
  B00000001,                          // cylinder 1-4
  B00000010
};                         // cylinder 2-3


void setup() {
  Serial.begin(19200);               //for debug
  pinMode(crankPin, INPUT_PULLUP);   //Interrupt pin for crankshaft position Use pullup to get rid of dangerous wire break situation
  pinMode(IGTPin, INPUT_PULLUP);
  DDRB = 0b00000011;                 //Set the first 2 pins on the B register to outputs.
  attachInterrupt(digitalPinToInterrupt(crankPin), ISR0, RISING);
  Serial.println("Startup");
}

void loop() {
  // put your main code here, to run repeatedly:
  while (syncAchieved == 1) { //Start sequencing ignition outputs when sync has occured. Otherwise just wait until engine starts rotating.
    PORTB = fireOrder[cylinderCounter];
  }
}

void ISR0()
{
  detachInterrupt(digitalPinToInterrupt(crankPin));              //If sync is achieved, we immedeatly disable keeping track of the position pin permanently
  syncAchieved = 1;                                              //Set variable used to start ignition and disable unnecessary measuring of position pin
  Serial.println("Sync Achieved");                               //Add when troubleshooting
  attachInterrupt(digitalPinToInterrupt(IGTPin), ISR1, HIGH);    //We no longer keep track of change state once synced. Now we locate rising change on the ref pin.
}

void ISR1()
{
  if (syncAchieved == 1) {                                        //If we have achieved sync, do only this part of the interrupt
    if (digitalRead(IGTPin) == HIGH) {                        //This is an "unneeded if". It filters out spark EMI, incorrect pulses will be counted otherwise.
      cylinderCounter++;                                      //we sequence the next cylinder that should fire
      Serial.println(cylinderCounter);                        //debug line to see that the right cylinder are shooting
      if (cylinderCounter > 3) {
        cylinderCounter = 0; //This a reset for the cylinder firing sequencer. We have 4 cylinders, so we reset after we reached the final one.
      }
    }
  }
}
So to the questions, do you think this method will work? i have smart coils from toyota 1zz engine, and will feedback the IGF signal to the ecu aswell. :?

Also, how can i do so the outputs get high when cylinder get rotated? :D
Im not a good coder :roll:

//thanks
#42361
theonewithin wrote: How will you control ignition timing?

How will you control ignition dwell?

Why are you recreating the wheel?

Just feed standard speedy the VR signal with a conditioner and away you go.
Sorry havn't been clear enough of how i will do it. But the problem with the rotor comes with that i have RWD a 4afe, so the dizzy hit the firewall. by removing the cap and rotor i can clear it. Also alot of 4A series engines would benefit from this.
So the dizzy looks like this:
Image

And at the bottom of it is have the sensor the ecu need:
Image

So by just leaving the base and cap it, the base will be my ignition timing and the ecu will controll dwell, advance and so on. Yes a speeduino would be a smoother option maybe, but with this i wont need to recreate the ignition advance table and so on. :roll:

or did i answer you question theonewithin?
JHolland wrote:It would be better to gate the signals from the stock ECU using logic gates with the signals from the Aduino acting as enable signals
Hmm i might have drawn it wrong but the plan is when arduino sends high to the mosfet the IGT signal will get passed to the coils. Is that how you meant it or how did you think about the logic gate? :)
My signal knowlage is slim to non

//thanks
#42362
ceasar wrote: Fri Apr 24, 2020 8:27 am Hmm i might have drawn it wrong but the plan is when arduino sends high to the mosfet the IGT signal will get passed to the coils. Is that how you meant it or how did you think about the logic gate? :)
My signal knowlage is slim to non
//thanks
You are using a P-channel FET? I guess that should work. You should have a resistor in series with the gate to limit turn on current and prevent oscillation.
#42368
JHolland wrote: You are using a P-channel FET? I guess that should work. You should have a resistor in series with the gate to limit turn on current and prevent oscillation.
That some good input! :D havn't choosen what type of mosfet i will use, got a recomendation what should work the best?
I have been looking at TC4468 chipset, do you think it will work?
then i will have option too do 4 individuall trigger later on if i want but it will work for 2 aswell. :roll:
#42524
But for the code, it seems like i cant get the output choosen to become high when the cylinder i choosen.
Code: Select all
DDRB = 0b00000011;
Shouldn't this make the the port B to output high? :shock:
Code: Select all
const byte fireOrder[] = {            //Table containing the fireorder (1-3-4-2)
  B00000001,                          // cylinder 1-4
  B00000010,                          // cylinder 2-3
  B00000001,                          // cylinder 1-4
  B00000010
And by this rotating that output?
I know from running a test with the other arduino that the cylinder counter rotates like i should upon stimuli. :?

Hi, I am trying to assign Signed values to the x-a[…]

Vr Conditioner Noise when cranking

New version 202305 don't fix the issue. Now after[…]

blitzbox

I've finally figured out why MAP and Lambda weren'[…]

Hello, I bring news!! Let me tell you that after […]

Still can't find what you're looking for?