Driving a IR LED at 5v while MCU is powered at 3.3V

Hello,

I am currently using an NRF52840 microcontroller (powered at 3.3V) to control two IR LEDs (powered at 5V) via an N-MOSFET. The GPIO pin that controls the N-MOSFET is configured in push-pull mode with a pull-down resistor, as shown in Image 1.

The IR LEDs are intended to be operated in pulsed mode to prevent them from burning out.

Recently, we discovered a firmware bug that caused the GPIO pin to remain continuously active, which resulted in damage to the IR LED drive circuit (N-MOSFET, LEDs, etc.) and the microcontroller itself.

To protect the circuit from potential future bugs of this nature, I am considering reconfiguring the GPIO to open-drain mode, with a pull-up resistor connected to 5V at the N-MOSFET gate to prevent leakage issues. If the pull-up resistor were connected to 3.3V while the IR LEDs are powered at 5V, it could cause leakage current through the N-MOSFET, as shown in Image 2. This change would be implemented while keeping the MCU powered at 3.3V.

Would this approach be effective in protecting the circuit? Could connecting the pull-up resistor to 5V while the MCU is powered at 3.3V cause any problems? 

Thanks for your help

Parents
  • The pull-up is a bad idea and will result in the IR LED being on any time the nRF52 is in reset or not correctly running firmware. This issue is as old as the hills, if I may say so. The trick is to not allow any fixed GPIO pin state to keep the FET (and LED) on; the simplest solution is to keep your original circuit but insert a 1nF capacitor at the GPIO port pin driving both the FET Gate and the pull-down resistor on the FET Gate. To turn the FET on use a pulse (or series of pulses) on the GPIO pin; a fixed high or low on the IO pin will eventually result in the FET turning off as the 3.3V on the capacitor decays. The CR time-constant controls how long the FET (and LED) stays on for each low-to-high edge on the GPIO pin. Make this time longer than required for a single pulse, such that the actual LED on time is the width of the active-high GPIO pin pulse; the decaying voltage on the capacitor (which will eventually turn off the LED) is only used in case the GPIO pin "forgets" to go low. Increase the pull-down resistor value to lengthen the "on" time of the IR LED; try to avoid large coupling capacitor values to avoid stressing the GPIO pin..

    Choose a FET with a Gate schottky clamp diode between Gate and Gnd to stop negative voltages appearing on the Gate when the GPIO pin changes from high-to-low, Some FETs have an internal pull-down to Gnd in addition to the schottky clamp diode, but the external pull-down resistor is fine; do not rely solely on the internal nRF52 internal pull-down as the internal pull-down is not active some of the time (power-on reset, software bug, ..).

    For safety-critical applications, typically driving a solenoid or laser diode, a secondary fail-safe would be mandatory, typically a clamp FET or series FET such that both FETs on separate drivers have to be in the correct state to energise.

    A FET something like the NMOS ntnd31225cz would work; you could lso just the the FET you already have as the Vgs spec allows negative voltages but that would probably adversely affect the timing between adjacent pulses.

    Edit: On reflection maybe just keep the FETs you are already using and add external schottky from the Gate to Gnd for each FET.

Reply
  • The pull-up is a bad idea and will result in the IR LED being on any time the nRF52 is in reset or not correctly running firmware. This issue is as old as the hills, if I may say so. The trick is to not allow any fixed GPIO pin state to keep the FET (and LED) on; the simplest solution is to keep your original circuit but insert a 1nF capacitor at the GPIO port pin driving both the FET Gate and the pull-down resistor on the FET Gate. To turn the FET on use a pulse (or series of pulses) on the GPIO pin; a fixed high or low on the IO pin will eventually result in the FET turning off as the 3.3V on the capacitor decays. The CR time-constant controls how long the FET (and LED) stays on for each low-to-high edge on the GPIO pin. Make this time longer than required for a single pulse, such that the actual LED on time is the width of the active-high GPIO pin pulse; the decaying voltage on the capacitor (which will eventually turn off the LED) is only used in case the GPIO pin "forgets" to go low. Increase the pull-down resistor value to lengthen the "on" time of the IR LED; try to avoid large coupling capacitor values to avoid stressing the GPIO pin..

    Choose a FET with a Gate schottky clamp diode between Gate and Gnd to stop negative voltages appearing on the Gate when the GPIO pin changes from high-to-low, Some FETs have an internal pull-down to Gnd in addition to the schottky clamp diode, but the external pull-down resistor is fine; do not rely solely on the internal nRF52 internal pull-down as the internal pull-down is not active some of the time (power-on reset, software bug, ..).

    For safety-critical applications, typically driving a solenoid or laser diode, a secondary fail-safe would be mandatory, typically a clamp FET or series FET such that both FETs on separate drivers have to be in the correct state to energise.

    A FET something like the NMOS ntnd31225cz would work; you could lso just the the FET you already have as the Vgs spec allows negative voltages but that would probably adversely affect the timing between adjacent pulses.

    Edit: On reflection maybe just keep the FETs you are already using and add external schottky from the Gate to Gnd for each FET.

Children
  • Hello !


    Thank you so much for your response! I just want to make sure I understood it correctly. Could you please take a look at my new design?

    The LED's single pulse duration is 13 µs, so I extended this time to 20 µs. Based on the formula T = CR, I calculated the resistance as R = 20 kΩ. Does this seem correct to you?

    Thanks again for all your help!

    Best regards,

    Estibaly

    EDIT: in the schematics the Resistance is 15kΩ but I modified it to 20k.

  • Yes that looks good, except the schottky diodes D2 and D3 look like they are drawn upside-down; these diodes are required to clamp any negative going voltages to Gnd (not positive voltages). The key to the values lie in the gate threshold voltage of the FET, which as usual has a hopelessly loose specification of between 1 and 2 volts depending on temperature, pressure and day of week. AC Coupled FET ZXMN3A01FTA drive to IR LED, let's assume the FET (parameter Vgsth) turns off at (say) 2V to be sure the drive is always sufficient:

    AC Coupled FET ZXMN3A01FTA drive to IR LED, assume Vgsth turns off at (say) 2V:
    Key:
        Vs Starting pulse voltage measured on C26 (=Vdd, volts)      3.1 volts
        Vd Decaying measured voltage measured on C26 (=Vgsth. volts) 2.0 volts
        C  Primary storage capacitor C26 1nF
        t  Measurement (decay) interval Vs to Vd (seconds)           20 uSecs
        R  Resistance to drain C26 from Vs to Vd (Ohms)
        Vd = VsE^(-t/CR)
        ln(Vd/Vs) = -t/CR
        R = -t/(C*ln(Vd/Vs)
        R11 = (-20us)/(1nF * ln(2/3.1) = 45k
        So use 1nF and 45K
    Set high-drive on the GPIO port to ensure clean waveforms.

    So use 1nF and 45K and set high-drive on the GPIO port to ensure clean waveforms presented to the capacitor and FET gate. Remember the capacitor decay is the safe turn-off of the FET in case the GPIO misbehaves; normally it will be the clean sharp edges from GPIO which turns the FET and IR LED on and off.

  • Not sure if you see edits so repeating my edit above:

    Schottky diodes D2 and D3 look like they are drawn backwards; these diodes are required to clamp any negative going voltages to Gnd (not positive voltages).

  • Hello,

    Thanks a lot for your great explanations ! I have another question about Schottky diodes, is there any specifications that I must consider ? I choose BAT54-HE3-08 https://www.vishay.com/docs/86410/bat54_bat54a_bat54c_bat54s.pdf

    Does it seems correct for you ?

    Have a nice day

  • Perfect! Two BAT54 or one BAT54A with a common Gnd.

    As an aside, where is the 5V coming from? If this is (say) a USB device, then that makes sense but if instead the 5V is generated by something like a boost regulator from a lower voltage there are other options for driving something like an IR LED (or motor, or solenoid, etc). Instead of having a 15uSec high-current burst often it is better to charge a capacitor bank over a longer period and discharge that bank through the IR LED. The advantage of a relatively slow charge allows something like a CR2032 coin cell to use IR LEDs without shortening the coin battery life. Stored charge is CV, so control charge voltage V via a PWM voltage inverter (a trivial circuit) and use the same circuit you have now to discharge the capacitor through the IR LED. If this is an optical project typically the illumination pulse relies on the energy emitted and not the specific envelope of the emission.

    Detecting mastitis in cow's milk takes two IR LEDs and two photodiodes and the ratiometric value indicates imbalance in flow discolouration across a dark mesh. Hot steel rod vibrating at high speed can be frozen in time on a linear CCD or photodiode array to give precise measurements of diameter. Phased pulsing of two IR LEDs within a single frame capture on a global shutter area camera can freeze the flight of a golf ball or other moving object allowing determination of rotation, speed and angle of travel and thus prediction of flight path. Short discharge pulses onto the IR LED matched with narrow-band optical filters make measurements less affected by sunlight or factory argon lights. Of course some IR LEDs allow higher pulse discharge voltages than others, which affects component choice. I once used 100V for 200nSec pulses, equivalent to 4uSec at 5V.

    Using PPI and PWM to create a voltage doubler or tripler on the nRF52:

    // Voltage Doubler
    //
    //        |\  (         |\  (          |Measure V
    // Phase 0| \ )         | \ )          |
    //   -----|  )----#-----|  )-----#-----#------+
    //        | / (   |     | / (    |            |
    //        |/  )   |     |/  )    |           --- LED
    //                |              |           \ / =>
    //              -----            |           ---
    //              -----          -----          |
    //                |            -----        |-+
    //                |              |      +-->|
    //                |              |      |   |-+
    //                |              |      |     |
    //                |            =====    |   =====
    //                |             ===     |    ===
    //            Phase 1            =    Disch   =
    
    // Voltage Tripler
    //
    //        |\  (         |\  (         |\  (          |Measure V
    // Phase 0| \ )         | \ )         | \ )          |
    //   -----|  )----#-----|  )----#-----|  )-----#-----#------+
    //        | / (   |     | / (   |     | / (    |            |
    //        |/  )   |     |/  )   |     |/  )    |           --- LED
    //                |             |              |           \ / =>
    //              -----         -----            |           ---
    //              -----         -----          -----          |
    //                |             |            -----        |-+
    //                |             |              |      +-->|
    //                |             |              |      |   |-+
    //                |             |              |      |     |
    //                |             |            =====    |   =====
    //                |             |             ===     |    ===
    //            Phase 1        Phase 2           =    Disch   =
    

    nrf52840-1-8v-driving-rgb-led

Related