I am having a problem while driving an IR LED @38kHz with a MOSFET.
A bit of background info: I am trying to create a beam detection system for 49 IR LED sensors pairs hence needing to drive the LEDs with a MOSFET. Now when I drive the LED directly from the Arduino pin everything works correctly and the beam detection functions as excepted. But as soon as I connect the MOSFET circuit the receiver gives me erratic feedback, it pulses the output. Even when I disconnected the LED the receiver output still toggles erratically so this tells me that I am getting interferance from the MOSFET ? I tried adding a 220Ohm resister between the arduino output and the MOSFET gate and it seemed to reduce the noise but it is still persistent.
Any Ideas on what I am doing wrong or how to fix the erratic feedback ?
I am using the IRLB8721 MOSFET and VS1838B IR Reciever.
I have attached the schematic that I am using for testing.
That MOSFET is not logic level and will not turn on fully with 5V to the gate. Misread the data sheet.
A 2.2K gate resistor will not improve things. The gate resistor, if present, should be as low a value as possible to charge the gate capacitance quickly but large enough value to limit the inrush current to the gate capacitance to protect the Arduino output.
The LED current limit resistor value in the schematic reads 10K to me. Is it 100 or 10K?
The resistor is 10K, the sensor pair are in very close proximity so anything less and the receiver would pick up unwanted reflections. Without the MOSFET the beam detection works very well. But as soon as the MOSFET is connected things go haywire. Even with the LED completely disconnected the output of the receiver is pulled low.
Have you tried any other MOSFET? The IRLB8721 is a relatively high power device, which means significant gate capacitance, which means a limitation on its frequency response. A 60A device to drive an LED seems like overkill, to say the least.
S.
49 LEDs is still on the order of an amp or less, unless they're high power units. Using what you have on hand makes perfect sense ... as long as it's appropriate to the need.
Try using a smaller MOSFET... OR driving the existing one at only a few hertz, to see if gate capacitance is causing problems at higher frequencies.
S.
Its has a suggested circuit - you are not using it. In particular you have no supply decoupling
and no pull-up on the output. The latter you could fix with INPUT_PULLUP for inPin, but the
former is fundamental - they recommend 100nF ceramic in parallel with 100µF electrolytic,
and a 100 ohms series resistor in the supply - that's all there to prevent interference like you
are seeing.