I am designing a constant current supply using Opamp LM324 & MOSFET IRFZ44N for driving LEDs.

My challenge is to switch the supply to the opamp through a microcontroller. At present, I am controlling it through a potentiometer. I want to remove the potentiometer and use a microcontroller for adjusting the gate supply voltage.

Please see the attached image.

schematic diagram

  • 1
    \$\begingroup\$ And what is the question? \$\endgroup\$ – Chupacabras Sep 21 '18 at 9:25
  • \$\begingroup\$ Why do you want to switch the op-amp supply? \$\endgroup\$ – Andy aka Sep 21 '18 at 13:31
  • \$\begingroup\$ Question is how should I control the opamp input wherein I want to regulate its input without using a potentiometer as in the diagram. My preferred approach would be to use a microcontroller. \$\endgroup\$ – tshivam Sep 24 '18 at 4:37

To answer your question directly: you could drive the positive input of the opamp by using a PWM output from the MCU, and low-pass-filter it (cap + resistor).

But this isn't actually the simplest way to do it. You can get rid of the opamp and achieve the same result:

Just put a simple resistor to build the constant-current source for the LEDs (and set it for the highest current you want to go through the LED: max brightness), and apply PWM to turn off completely the LED at the required duty cycle in order to achieve the desired brightness (due to persistence of vision).

So, basically a circuit as simple as this would make it:


simulate this circuit – Schematic created using CircuitLab

  • \$\begingroup\$ Your pulsed circuit is no more efficient than the OP's variable current circuit. Light output is proportional to average current either way, and so is power consumption at constant Vcc. \$\endgroup\$ – Olin Lathrop Sep 21 '18 at 10:52
  • \$\begingroup\$ @Olin Damn, you're right. I was fooled by the fact the FET dissipates, but the net result is the same. I'll rewrite, simply underlining the fact the suggested circuit is simpler. \$\endgroup\$ – dim Sep 21 '18 at 11:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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