Dear friends how write code for 3 cylinder engine .
i want it with hall effect . i have hall effect sensor also it has reaction and works ,,but the problem is not it.
.i want it works together for ignition control .
i need a basic idea about it
.
i put some pictures maybe help


First problem is you need a current limiting or voltage dropping, resistor in series with the coil primary. An automotive type coil rated for 12 volts actually operates on about 8 volts, EXCEPT when starting the engine from an electric starter. When starting, the load on the battery reduces the voltage to about 8 volts. The series resistor is shorted by the starter switch so the coil gets the 8 volts during the start up.
Paul
I don't recognise the mosfet. You'll need one rated at at least 500v and 6A . The IRF800 series are in the right area.
And they need more than 5v on the gate to turn them fully on.
Allan
thank you .
so ,,main plan is :
what we need to have spark ?
need a transistor ( IRF800 ) to (off and on) the earth wire .
if something suddenly off the voltage ,coil will response as 20k voltage .and is that i need .depend of when
time is here is important .
and for timing we have 2 main ways .
first hall effect sensor .
second is optical sensor
.hall effect sensor or optical sensor tell us ,which exactly time must mofst .do off or don't do .
i try to write the code
if some body knows .please don't hesitate .
thank you once again
what about this :
int coilOut = 7; //Coil output on pin 7
volatile byte rpmcount;
unsigned int rpm;
unsigned long timeold;
void setup()
{
attachInterrupt(0, fire, RISING); //Pin 2 tach input
pinMode(coilOut, OUTPUT); //Coil output
Serial.begin(9600); //Initialize serial port
}
void loop()
{
if (rpmcount >= 40) //Serial print RPM loop
{
rpm = 30*1000/(millis() – timeold)*rpmcount;
timeold = millis();
rpmcount = 0;
Serial.print(rpm,DEC);
Serial.println(” RPM”);
}
}
void fire() //Interrupt routine run when tach pulse goes high
{
digitalWrite (coilOut, HIGH); //Charge coil
delayMicroseconds(4000); //4ms dwell time
digitalWrite (coilOut, LOW); //Fire coil
rpmcount++;
}
The hardware to do this is suggested in the enclosed.
Allan
elign.pdf (20.1 KB)