Page 3 of 3 FirstFirst 123
Results 31 to 45 of 45

Thread: Crank timing for COP 4AFE/7Afe

  1. #31
    Forum Member Grease Monkey
    Join Date
    Apr 2019
    Location
    vic
    Posts
    58

    Default Re: Crank timing for COP 4AFE/7Afe

    Hi Ceasar How good are you with arduino code? I written code that gets me 90% there just a little stuck now, the squencer works with 4 leds (simulating the coils) and a switch (simulating the tach signal), but it has 2 issues. 1st the Led stays on when the switch is released. 2nd I havent been able to get it to resart with the second switch (simulating the cam signal). The delay is there to slow it down so you can see whats happening.

    // SEQUENCER WITH BUTTON
    int ledPin1 = 13;

    int ledPin2 = 12;

    int ledPin3 = 11;

    int ledPin4 = 10;

    int butPress1 = 9;

    int countBP = 0;

    void setup()

    {

    pinMode(ledPin1, OUTPUT);

    pinMode(ledPin2, OUTPUT);

    pinMode(ledPin3, OUTPUT);

    pinMode(ledPin4, OUTPUT);

    pinMode(butPress1, INPUT);

    }

    void loop()

    {

    digitalWrite(ledPin1, LOW);

    digitalWrite(ledPin2, LOW);

    digitalWrite(ledPin3, LOW);

    digitalWrite(ledPin4, LOW);

    countBP = digitalRead(butPress1);

    while (countBP != 0)

    {

    switch (countBP)

    {

    if (countBP == 0)

    {

    case 1:

    digitalWrite(ledPin1, HIGH);

    digitalWrite(ledPin2, LOW);

    digitalWrite(ledPin3, LOW);

    digitalWrite(ledPin4, LOW); delay(100);

    countBP = countBP + digitalRead(butPress1);

    break;

    }

    if (countBP == 1)

    {

    case 2:

    digitalWrite(ledPin1, LOW);

    digitalWrite(ledPin2, HIGH);

    digitalWrite(ledPin3, LOW);

    digitalWrite(ledPin4, LOW); delay(100);

    countBP = countBP + digitalRead(butPress1);

    break;

    }

    if (countBP == 2)

    {

    case 3:

    digitalWrite(ledPin1, LOW);

    digitalWrite(ledPin2, LOW);

    digitalWrite(ledPin3, HIGH);

    digitalWrite(ledPin4, LOW); delay(100);

    countBP = countBP + digitalRead(butPress1);

    break;

    }

    if (countBP == 3)

    { case 4:

    digitalWrite(ledPin1, LOW);

    digitalWrite(ledPin2, LOW);

    digitalWrite(ledPin3, LOW);

    digitalWrite(ledPin4, HIGH); delay(100);

    countBP = countBP + digitalRead(butPress1);

    break;

    }

    default:

    digitalWrite(ledPin1, LOW);

    digitalWrite(ledPin2, LOW);

    digitalWrite(ledPin3, LOW);

    digitalWrite(ledPin4, LOW);

    countBP = 0;

    break;

    }

    }

    }

  2. #32
    Forum Member Grease Monkey
    Join Date
    Dec 2018
    Location
    Alvsborg
    Posts
    69

    Default Re: Crank timing for COP 4AFE/7Afe

    Hello! sadly, not good enough i guess haha.

    Nice code, for the problems i had a AVR intro course a while back which kind of touched on what you are stuck on. Will se if i find a it.
    One easy way to turn of the led is just to set low just before break?
    But im would set a interrupt on the butPress with CHANGE, so on the first interrupt it does the "set high" and on second interrupt it will set all leds to low?

    Or two interrupts one that tracing rising edge and count and sets leds to high and one interrupt for falling edge which set leds to low.

    which one is the second switch? "2nd I havent been able to get it to resart with the second switch " cant seem to find that input?

  3. #33
    Forum Member Grease Monkey
    Join Date
    Dec 2018
    Location
    Alvsborg
    Posts
    69

    Default Re: Crank timing for COP 4AFE/7Afe

    Here is the code, is C code for just AVR chip's, simular to the AVR chip use in arduino.

    I like this method of just going portwise operations and just by choosing what kind of interrupt this code could go from just lighting the led push and keeping it on, or just lighting it up while pushed.
    I know arudino also have AVR libery which can help.

    https://github.com/vanDeventer/AS2p/blob/extInt/main.c

    Im going to try out your code this week and see, i learn better by trying codes out then to just read them

  4. #34
    Forum Member Grease Monkey
    Join Date
    Apr 2019
    Location
    vic
    Posts
    58

    Default Re: Crank timing for COP 4AFE/7Afe

    Thanks Ceasar, Ill have a bit more of a play with it, I did have a second button on the code but as I couldn't get it to work I removed it. I was trying to solve one problem at a time before introducing another issue.

  5. #35
    Forum Member Grease Monkey
    Join Date
    Apr 2019
    Location
    vic
    Posts
    58

    Default Re: Crank timing for COP 4AFE/7Afe

    Hi Ceasar I've got the code sorted if you want to have a go, It's full sequential and uses the tach signal from the ECU and you will have fit a cam sensor on the cam pulley that goes high about 120 degrees before TDC on the number one cylinder. It works on the bench I've not fitted it to an engine yet. there may be problems with electrical noise as an Arduino is very fast it can mistake a voltage spike as a signal.
    Let me know if you would like the code.

  6. #36
    Forum Member Grease Monkey
    Join Date
    Dec 2018
    Location
    Alvsborg
    Posts
    69

    Default Re: Crank timing for COP 4AFE/7Afe

    Hello! sorry been doing my master thesis so been up to other stuff!

    Sweet, have you tried running it?

    Got mine running with waster spark code right now on arduino, and yeah i notic that fast switching introduced some problems with false triggering so added capacitors to smooth it out.
    Im right now waiting for PCB that i made with the component to make it a bit more "stable"

    If you want i can try your code aswell Liquid as we are running on the same principles?

    So there you have it running!
    https://www.youtube.com/watch?v=fKlHVdlir3A

    Also i wanted to give some closure to the thread since i kind of found the answers to the problems and hope that they will make it easier for the next guy doing this, but meny thanks to you Liquidhandwash and jondee86 for helping along the way, really really appreciate it!

    So.

    Can you use the IGT signal to drive COP's on the FE engines like people do on the 20v 4age engines.
    - Yes you can, but you have to enhance the signal in some way to be able to power all 4, only got max 2 to fire with just hooking it up according to the 20v 4age method.
    My method to enhance the signal was by arduino powering mosfet's which would boost the signal, which i later evolved into wasted spark firing but work's for both.

    The 7afe block with the crank trigger i havn't gone further with, but i added a hallsensor and trigger to the normal block to use for the arduino to know the engines position.

    Now to the IGF part, which there is quite low information on i think and was tricky.
    -So i tried using the 1zz coils IGF to the ECU, sadly this didnt work. why? i kind of dont know, could be the signal shape or threshhold voltage. always leading to code 14 and injectors shutting of.

    - I tried using the arduino to generate a signal that would look like the IGF, didnt get it to work. why? can be both me trying to make the wrong(shape) signal with the arduino or delay / timing of signal. resulting in code 14.

    - last method i found was a method some people have used with the 2JZ. Also found it in some old thread on this forum but i sums up very good by this page both in wiring and method:
    http://www.tuimotorsports.com/tui-mo...tion-simulator

    So instead is splitting it from each cylinder i tapped into the source IGT signal added a 1k resistor before the diode and voila. The Engine wont throw a code 14 and you now dont need the Igniter or coil to zap away to generate the IGF.

    This method should also work on all 4A-FE and 7A-FE engines, but also on the 4A-GE.

    I´m going to make a Build thread on this with wiring, components and code. To make it more clear.

    //thanks and cheers

  7. #37
    Forum Member Grease Monkey
    Join Date
    Apr 2019
    Location
    vic
    Posts
    58

    Default Re: Crank timing for COP 4AFE/7Afe

    Good to hear you got it running, I haven't done anything more as this whole COVID lockdown has thrown a spanner in the works.
    I've not tried the code on an engine but it seems to work correctly on the bench, with some LED and a couple of buttons, It will likely need a filter on it to stop false triggering.

    // cycle will not start untill cam sensor pin 8 goes high.
    // coils will fire in sequnce with tach signal from ecu
    // cam sensor signal will reset squence to coil number one
    // set the dwell time to coils specs usuallay from 3-5 ms
    // all inputs and outputs work on high signal, if a low signal is need the code will have to be modifited

    // SEQUENCER WITH BUTTON

    int ledPin1 = 13; //coil 1 pin 13
    int ledPin2 = 12; //coil 3 pin 12
    int ledPin3 = 11; //coil 4 pin 11
    int ledPin4 = 10; //coil 2 pin 10

    int IgnitionPress = 9; // tach signal from ECU pin 9
    int Button1State =0;
    int lastButton1State = 0;
    bool Button1Running = false;

    int butPress2 = 8; //signal from cam sensor 120 degress BTC pin 8
    int Button2State =0;
    int lastButton2State = 0;
    bool Button2Reset = false;
    bool Button2Running = false;

    int countBP = 0;
    int counter = 0; // counter for the number of button presses


    void setup(){

    pinMode(ledPin1, OUTPUT);
    pinMode(ledPin2, OUTPUT);
    pinMode(ledPin3, OUTPUT);
    pinMode(ledPin4, OUTPUT);
    pinMode(IgnitionPress, INPUT);
    pinMode(butPress2, INPUT);



    }



    void loop(){

    // See if the buttons are pressed or not
    Button1State = digitalRead(IgnitionPress);
    Button2State = digitalRead(butPress2);

    if(Button1State == HIGH and countBP==0)
    {
    Button1Running = true; //!Button1Running;
    // Serial.println("Ignition is ON");

    }

    // If the ignition button is pressed for on then do the following
    if(Button1Running == true)
    {


    digitalWrite(ledPin1, LOW);
    digitalWrite(ledPin2, LOW);
    digitalWrite(ledPin3, LOW);
    digitalWrite(ledPin4, LOW);

    Button2State = digitalRead(butPress2);
    //countBP = 1 ;
    if (Button2State != lastButton2State) {

    if(Button2State == HIGH)
    {
    Button2Running = true;
    // Serial.println("Reset the first time");
    }
    }



    if(Button2Running == true)
    {
    // while (countBP != 0)
    // {

    Button2State = digitalRead(butPress2);
    if (Button2State != lastButton2State) {
    if(Button2State == HIGH) {
    countBP= 1;
    // counter= 0;
    // Serial.println("Reset has been pressed");
    }
    }
    lastButton2State = Button2State ;
    Button1State = digitalRead(IgnitionPress);

    if(countBP==1) {
    if((Button1State == HIGH) )
    {
    if (counter == 0) {
    digitalWrite(ledPin1, HIGH);
    digitalWrite(ledPin2, LOW);
    digitalWrite(ledPin3, LOW);
    digitalWrite(ledPin4, LOW);
    // Serial.println("LED1 is ON");
    delay(3); // set dwell time 3ms-5ms

    countBP++;
    counter = 1;
    }
    } else {
    counter = 0;

    }

    }

    if(countBP==2) {
    if((Button1State == HIGH) )
    {
    if (counter == 0) {
    digitalWrite(ledPin1, LOW);
    digitalWrite(ledPin2, HIGH);
    digitalWrite(ledPin3, LOW);
    digitalWrite(ledPin4, LOW);
    // Serial.println("LED2 is ON");
    counter = 1;
    delay(3); // set dwell time 3ms-5ms

    countBP++;
    }
    } else {
    counter = 0;
    }

    }

    if(countBP==3) {
    if((Button1State == HIGH) )
    {
    if (counter == 0) {
    digitalWrite(ledPin1, LOW);
    digitalWrite(ledPin2, LOW);
    digitalWrite(ledPin3, HIGH);
    digitalWrite(ledPin4, LOW);
    counter = 1;
    // Serial.println("LED3 is ON");
    delay(3); // set dwell time 3ms-5ms

    countBP++;
    }
    } else {
    counter = 0;
    }
    }

    if(countBP==4) {
    if((Button1State == HIGH) )
    {
    if (counter == 0) {
    digitalWrite(ledPin1, LOW);
    digitalWrite(ledPin2, LOW);
    digitalWrite(ledPin3, LOW);
    digitalWrite(ledPin4, HIGH);
    // Serial.println("LED4 is ON");
    counter = 1;
    delay(3);// set dwell time 3ms-5ms

    countBP = 1;
    }
    } else {
    counter = 0;
    }
    }

    } lastButton2State = Button2State ;
    // }
    } else { // The button is not pressed so turn the lights off
    // turn LED OFF;
    digitalWrite(ledPin1, LOW);
    digitalWrite(ledPin2, LOW);
    digitalWrite(ledPin3, LOW);
    digitalWrite(ledPin4, LOW);
    Serial.println("Ignition is Off");
    countBP = 0;
    }

    }

  8. #38
    I like Stuff Backyard Mechanic mikie's Avatar
    Join Date
    Jul 2006
    Location
    Vic
    Posts
    201

    Default Re: Crank timing for COP 4AFE/7Afe

    i have been playing with the idea of using Arduino to sequence COPs on a 3SGE for a while, currently have attached a "Magic black box" which, when engine was running, exhibited weird issues.

    i have tested the code below on Arduino nano attached to a signal generator, code stops sequencing correctly around 9500 rpm when using Serial.print over terminal to output firing order.

    Code:
    //==================================================================================
    
    #define OUT_COP01 8
    #define OUT_COP02 9
    #define OUT_COP03 10
    #define OUT_COP04 11
    #define PIN_IGT 3
    #define PIN_IG1 2
    volatile boolean syncAchieved = 0;    //Set this to true if sync has been achieved
    volatile byte cylinderCounter = 10;
    volatile boolean CylFireOK = 1;
    
    void setup() {
      //Serial.begin(9600);
      pinMode(OUT_COP01, OUTPUT);
      pinMode(OUT_COP02, OUTPUT);
      pinMode(OUT_COP03, OUTPUT);
      pinMode(OUT_COP04, OUTPUT);
      pinMode(PIN_IGT, INPUT);
      pinMode(PIN_IG1, INPUT);
    
      attachInterrupt(digitalPinToInterrupt(PIN_IG1), IN_IG1, RISING); //  function for creating external interrupts at pin2 on Rising (LOW to HIGH)
      attachInterrupt(digitalPinToInterrupt(PIN_IGT), IN_IGT, RISING); //  function for creating external interrupts at pin3 on Rising (LOW to HIGH)
    }
    
    void loop() {
      while (syncAchieved == 1) {   //Start sequencing ignition outputs when sync has occured. Otherwise just wait until engine starts rotating.
        if (CylFireOK == 0) {       // wait here for next ignition event. 
          switch (cylinderCounter) {
    
            case 0:
              Serial.println("COP03");
              digitalWrite(OUT_COP03, HIGH);
              delay(2); //Dwell Time
              digitalWrite(OUT_COP03, LOW);
              CylFireOK = 1;
              break;
            case 1:
              Serial.println("COP04");
              digitalWrite(OUT_COP04, HIGH);
              delay(2); //Dwell Time
              digitalWrite(OUT_COP04, LOW);
              CylFireOK = 1;
              break;
            case 2:
              Serial.println("COP02");
              digitalWrite(OUT_COP02, HIGH);
              delay(2); //Dwell Time
              digitalWrite(OUT_COP02, LOW);
              CylFireOK = 1;
              break;
            case 3:
              Serial.println("COP01");
              digitalWrite(OUT_COP01, HIGH);
              delay(2); //Dwell Time
              digitalWrite(OUT_COP01, LOW);
              CylFireOK = 1;
              break;
          }
        }
      }
    }
    void IN_IG1() //Wait for G1 to begin sequence
    {
      detachInterrupt(digitalPinToInterrupt(PIN_IG1));
      Serial.println("CAM_TDC");  
      syncAchieved = 1;
      cylinderCounter = 0;
    }
    
    void IN_IGT()
    {
      cylinderCounter++;
      CylFireOK = 0;
      delay(1); // IGT Input debounce
      if (cylinderCounter > 3) {
        cylinderCounter = 0;
      }
    }
    //==================================================================================
    testing this on the engine will be another story, my project is currently in pieces, the code is also missing failsafes.
    i doubt this code will hot start, ie. Arduino has to be powered off and back on between attempts at starting.
    need something to drive COPs (TC4468EPD or similar), and Arduino should be shielded form EMI / EMF.
    If using the G1 G2 signals from the Dizz, a signal conditioner will also be required. G1 and G2 signals don't reach Arduino logic voltage
    Last edited by mikie; 09-11-2020 at 09:10 AM.

  9. #39
    Forum Member Grease Monkey
    Join Date
    Apr 2019
    Location
    vic
    Posts
    58

    Default Re: Crank timing for COP 4AFE/7Afe

    That great that your having a go, My plans changed after I found a 4age in a barn, so the dizzy is on the side of the engine.

  10. #40
    1MZ > 2JZ Carport Converter knightrous's Avatar
    Join Date
    Jul 2009
    Location
    NSW
    Posts
    1,785

    Default Re: Crank timing for COP 4AFE/7Afe

    Can always check out Speeduino which is an open source Arduino based ECU.
    https://speeduino.com/

  11. #41
    Forum Member Grease Monkey
    Join Date
    Dec 2018
    Location
    Alvsborg
    Posts
    69

    Default Re: Crank timing for COP 4AFE/7Afe

    @mikie
    Fun that you also trying, dont know what sets the 3SGE apart ignition-wise, are they running the same system?

    As for running, i designed a PCB so just revived my testboard which I'm soldering right now. Run my car with about 1000km on the old testsolderboard and seems to work fine.
    Im using a 3d printed triggerwheel though.
    So my next step is to see if i can use the Cam reset already in the dizzy.

    About the reseting at hot start i have notic that i wont be needed. Since the arduino count's the IGT signal from the ecu and i use the triggerwheel to sync it picks up the order after a least one rotation!

    I will try to upload my schimatic and PCB plans here so you can take part of it, seems like we are going same direction.

    I have max rev the engine once not i think about 7000 rpm? (dont know what max is) and i seems to keep up

    @Liquidhandwash
    Damn you... i cant seem to find a 4age anywere #jealous


    @knightrous
    yeah, been looking alot at speeduino and it's a nice way to go.
    But with this method you dont have to redo ignition map/map the ecu to get the benefit of the COPS. At least that my opinion

  12. #42
    Forum Member Grease Monkey
    Join Date
    Dec 2018
    Location
    Alvsborg
    Posts
    69

    Default Re: Crank timing for COP 4AFE/7Afe

    So here is the PCB


    And schimatic (note i dont work in these programs so often therefore quite messy):


    Btw when through the code you added mikie, looks good!

  13. #43
    Forum Member Grease Monkey
    Join Date
    Apr 2019
    Location
    vic
    Posts
    58

    Default Re: Crank timing for COP 4AFE/7Afe

    Yep it was a barn find 20+ years of crap on it

  14. #44
    Forum Member Grease Monkey
    Join Date
    Dec 2018
    Location
    Alvsborg
    Posts
    69

    Default Re: Crank timing for COP 4AFE/7Afe

    Haha damn! that's a lot of chickenpower on top!

    Have you cracked it up and checked how bad it is inside?

  15. #45
    Forum Member Grease Monkey
    Join Date
    Apr 2019
    Location
    vic
    Posts
    58

    Default Re: Crank timing for COP 4AFE/7Afe

    Its got a few problems, but ive got most of the parts to fix, Broken crank, missing the flywheel, dizzy and exhaust. Ive got a new crank and new conrods, just got to get rings bearings gaskets and some time and It should be all good. Just had my daily driver blow up so Ive been fixing that at the moment.

Similar Threads

  1. Undoing crank bolt on auto 4AFE/4AFC - and retorque
    By highrolla in forum Tech and Conversions
    Replies: 9
    Last Post: 09-06-2017, 04:17 PM
  2. 4afe to 7afe AE92
    By wa5 in forum Tech and Conversions
    Replies: 0
    Last Post: 27-07-2015, 09:45 PM
  3. 4AFE to 7AFE AE92 hatch
    By mattysshop in forum Engine & Driveline Conversions
    Replies: 12
    Last Post: 24-09-2009, 02:48 PM
  4. 7afe Crank angle sensor on the OIL PUMP (97 Geo Prizm )
    By Cameron_Datto in forum Tech and Conversions
    Replies: 1
    Last Post: 28-05-2008, 02:01 PM
  5. Crank timing pulley timing belt guide, fixed or spinning?
    By Howieau in forum Tech and Conversions
    Replies: 2
    Last Post: 27-09-2007, 06:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •