**broken link removed**
I'm working on controlling an ignition coil using a microcontroller connected to a MOSFET and an sensor. The sensor has an ir led and a phototransistor in it and I want the coil to fire when the beam is broken. The microcontroller switches the MOSFET on for a set amount of time, long enough for the ignition coil to "charge up" then switches it off, which will cause a high voltage in the secondary winding of the ignition coil and create a spark.
With this project I have two problems, first is the detection of when the beam is broken.
The photosensor (**broken link removed**) has its emitter connected to +5v and its collector connected to a 150khm: resistor connected to ground. I get either 0 volts or 3.5ish volts across the resistor depending on if the beam is broken or not. All the applications I have seen suggested a 5khm: resistor but for some reason I could not get that to work. Anyway I have the microcontroller programmed to detect when the sensor output goes from high to low and each time I break the beam but the controller counts some huge number. I think I need to a schmitt trigger between the sensor and the microcontroller so the output is always in a defined output state, but I'm not sure.
The other problem is I'm worried about is back emf from the ignition coil damaging things in the circuit particularly the 100v MOSFET and microcontroller and I'm not sure what I need to protect all the components of my circuit from all of this. Someone said the only thing I need is a diode across the MOSFET but I have seen other circuits with stuff that looked more elaborate.
I'm working on controlling an ignition coil using a microcontroller connected to a MOSFET and an sensor. The sensor has an ir led and a phototransistor in it and I want the coil to fire when the beam is broken. The microcontroller switches the MOSFET on for a set amount of time, long enough for the ignition coil to "charge up" then switches it off, which will cause a high voltage in the secondary winding of the ignition coil and create a spark.
With this project I have two problems, first is the detection of when the beam is broken.
The photosensor (**broken link removed**) has its emitter connected to +5v and its collector connected to a 150khm: resistor connected to ground. I get either 0 volts or 3.5ish volts across the resistor depending on if the beam is broken or not. All the applications I have seen suggested a 5khm: resistor but for some reason I could not get that to work. Anyway I have the microcontroller programmed to detect when the sensor output goes from high to low and each time I break the beam but the controller counts some huge number. I think I need to a schmitt trigger between the sensor and the microcontroller so the output is always in a defined output state, but I'm not sure.
The other problem is I'm worried about is back emf from the ignition coil damaging things in the circuit particularly the 100v MOSFET and microcontroller and I'm not sure what I need to protect all the components of my circuit from all of this. Someone said the only thing I need is a diode across the MOSFET but I have seen other circuits with stuff that looked more elaborate.