Hmm hello im back again!
getting a bit restless in these quarantine so couldn't let the simple solution of using the arduino to power the cop that Liquid linked before.
https://github.com/dalathegreat/Arduino-Coil-On-Plug
And thought that if i can get it to work i migth benefit alot of people using the 4A paltform to convert to COP's.
So i rebuilded the code a bit and sat up one arduino to fake the IGT signal of the engine aswell as a fake hallsensor signal. My plan was to locate 1 tooth inbetween 4:th and 1:th cylinder on the crank. So the hall sensor gives its signal before the firest cylinder fires. And it seems to work.
After it syncs with that i will fire 1-2-3-4 and as the output says for every IGT signal, i will running batchfire.
Like how Daniel did with the source code, i will solder mosfets so the IGT signal get to the arduino and also gets bypassed by the mosfet active to the right cylinder, after that the arduino turns the first mosfet off and primes the other mosfet and so on.
I just wonder, the IGT signal, is it a 12v? in that case i have to build a step-down.
And also i would need some help with risk analysis, with this setup what do you think can go wrong?
not very tempted to blow my engine but very tempted to try it.
What do you think?
Code:
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.
}
}
}
}
Bookmarks