I am currently working on a LED system prototype using 3W LEDs. I am using these LED drivers but the 700mA variants. It is based off the XL4001E1 constant current chip, datasheet I used for reference can be found here. At page 4 of the datasheet is a schematic for a LED driver application of the component, but I think is only somewhat similar so I am not sure to serve it as basis for the driver module mentioned.

I am also using an ESP32 MCU for PWMing the LEDs since the driver provides PWM functionality. I plan in using a 24v switching PSU for the LED and 5v adapter for the ESP32 where their grounds are common. Schematic provided below:

enter image description here

My questions are:

1.) How come when I turn off the LED system, the LED flickers for a bit before turning off? Is it because of the capacitor discharging at the output of the driver pins as shown in figure 5 of the datasheet? How should I look into fixing this?

2.) Should I probably isolate the MCU from the LED circuit using an optocoupler or should this layout be somewhat acceptable even for long term use?

3.) I am planning to use this design as a customized lighting system in plant canopy. Would this kind of setup be 'ok' for long term use?

I am using high power 3w RGB LEDS, hence, the three parallel LED strips where each color can be controlled using PWM to somehow provide multispectral lighting outputs. The RGB LEDs has forward voltages 2.2V, 3.2V, 3.2v respectively, that can be run at 700mA for max brightness.

  • 3
    \$\begingroup\$ Can you reverse engineer a schematic of that driver module, specifically those PWM input pins? I don't see anything in that XL4001's datasheet indicating it allows for external PWM control... \$\endgroup\$ Jan 7, 2022 at 11:17
  • \$\begingroup\$ I'll try to do this and also look for somewhat similar circuit design, though I believe the EN pin on the datasheet can be used as the PWM input using inverted logic? Also, figure 5 from the datasheet looks like a somewhat similar circuit application with the buck module at the output though this one seems to use only one capacitor at the input. \$\endgroup\$
    – Guorishix
    Jan 7, 2022 at 11:38
  • 1
    \$\begingroup\$ An enable input is usually meant to simply turn the device on and off, not fast PWM. The start up block in the block diagram does not bode well, indicating it needs some (undocumented) amount of start up time. Not saying it's impossible, just that it's out of spec/undocumented/should not be relied on. \$\endgroup\$ Jan 7, 2022 at 11:43
  • \$\begingroup\$ @Unimportant I agree, I don't see how it works either. The chip appears to have an internal 150kHz oscillator so that it can be used in a buck converter, However there is a paragraph that mentions "PWM control circuit is able to adjust the duty ratio linearly from 0 to 100%." but there is no indication I can find as to how it's supposed to be used or on which pin(s). I'm inclined to agree with your second comment also. \$\endgroup\$ Jan 7, 2022 at 11:45
  • 1
    \$\begingroup\$ @PeterJennings Imho, that line is talking about the buck converter itself, merely saying it can swing all the way from 0 to 100%. \$\endgroup\$ Jan 7, 2022 at 11:48

1 Answer 1


Why bother with this driver unit at all? A MOSFET such as the RFP12N10L can be driven directly from the logic levels of an ESP32.
There is a long discussion on doing exactly this in the Arduino forum here. The only proviso is that you may need to include a current limiting resistor in series with each string of LEDs. BTW, you show a string of 7 LEDs, is 12V sufficient to drive them?

  • \$\begingroup\$ Right now I am just looking for off-the-shelf solutions using driver modules in providing appropriate constant current output for supplying the LEDs to see available options for easier interface with MCUs compared to having custom boards using individual components. I am trying to deviate in doing custom boards for the moment as the LED prototype is just a part of a much bigger system design, though I will do consider. The 12V should have been 24v also, my mistake since I am considering between 12 and 24v PSU options. \$\endgroup\$
    – Guorishix
    Jan 7, 2022 at 12:24
  • \$\begingroup\$ OK, but from all the comments to your question and the video you quoted, it won't work. The PWM input appears to be just to turn it on and off and probably doesn't accept high speed PWM required for dimming. \$\endgroup\$ Jan 7, 2022 at 15:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.