Near zero linear LED regulator

A simple circuit utilizing an op amp and a MOSFET to control the current through a string of LEDs down to barely visible light.

Similar projects worth following

It can't be that difficult, can it? Switched constant current drivers are excused, but there are plenty of constant voltage driven LED products that resort to butchered PWM dimming (or none att all) where they should be able to dim from blending light till pitch black with the grace of a superlight, fluffy feather in a low gravity, air dense environment...


Adjust component values according to needs

Adobe Portable Document Format - 70.62 kB - 05/24/2020 at 19:28


lib - 29.79 kB - 05/20/2020 at 17:11


lib - 735.00 bytes - 05/20/2020 at 17:11


plain - 2.04 kB - 05/20/2020 at 17:11


raw - 29.75 kB - 05/20/2020 at 17:11


View all 6 files

  • Results

    Ole Andreas Utstumo05/24/2020 at 17:54 0 comments

    Well, the LEDs themselves are as a good indication as any instrument. With the right sense resistor and voltage divider for the reference voltage we're getting barely a shimmer of light from the chip inside the LEDs. My camera doesn't do the best job capturing this, but if you can see the phosphor surrounding the chip with your bare eyes we're talking µA range currents, I dare even claim single digits. Could we go lower? Absolutely. We're generating a reference voltage with a dutycycle of 1/2000 in the above case, where going to 0/2000 produces no light detectable to the eye. So there's the answer: mission accomplished! 

    How about flicker? Depends on the reference signal. For PWM generated reference voltages: by lowering the PWM pre-filter frequency without compensating the filter thereafter, there is visible flicker. Moving the RC filter corner frequency by increasing the resistance will start to affect the op amp -- the input bias currents will generate a voltage at the input through the scaled voltage divider which results in a pA current in the LEDs at "off" state. A good compromise is your best friend, or use more components till happy. 

  • Mounted circuit board

    Ole Andreas Utstumo05/20/2020 at 20:32 0 comments

    For those wondering -- the LEDs are actually 3030 package LEDs that didn't need much of convincing to fit on the 2835 pad. By soldering method I tinned all the LED pads in advance, covered them with flux, placed the LEDs and used a hot air station from underneath to reflow solder them. On the backside of the PCB are copper pads with vias thermally connecting to the LEDs on front. 

  • Programming an STM8

    Ole Andreas Utstumo05/20/2020 at 20:19 0 comments

    The STM8 family is looking like something of an artefact, with outdated tools and a seemingly small community. Thankfully I stumbled over this excellent guide by Ben Ryves which got me up and running with the programming. There's also this more step by step guide at

    I used the Cosmic compiler together with the ST Visual Develop / Programmer and one of those cheap China ST-Link programmers

    I have no idea what happened with the GUI here

    You will need to accept some bugs and crashes here and there, and I never got debugging working with my programmer, so it was a back to old school cool experience. There is an optional framework that takes some of the pain (or joy, depending on who you ask) away from the programming which can be downloaded from ST's site here. What they have possibly forgotten to add in the download is the stm8s_conf.h file which can be found in an example project like this. It really is just a file including all the peripheral files.

    Oh, and by the way - if you are using the SWIM pin as an output, don't forget to include a couple of seconds of delay from reset till the GPIO is configured. 

  • Completing the circuit

    Ole Andreas Utstumo05/20/2020 at 17:56 0 comments

    Keeping to the theme of exploring new stuff I also put one of those cheap 8 bit microcontrollers from ST Microelectronics in the circuit. To play around even more I did two channels for the LEDs, in case tunable white would be fun.

    There's really not a lot to it. I originally had more components surrounding the op amp just in case of stability problems or if the circuit refused to go down to "off", but in the end there was no use for them. 

  • Will it Spice?

    Ole Andreas Utstumo05/19/2020 at 19:55 0 comments

    There are plenty of ways to do op amp current sources and sinks. See Analog Devices' writeup on the subject. The transconductance amplifier seems like the simplest you can get, so let's go for it. 

    This should be a fairly easy circuit to simulate. We'll go for eight ~3V mid power LEDs landing us at about 24V with razor thin margins for the transistor and the sense resistor. The efficiency! It's gonna be beautiful, I tell you! We might need to pick some good voltage bins for the LEDs if we want some powder out of this, though, or cheat and adjust the supply voltage. 

    Spice files are as follows: 

    Putting the band together it should look something like this:

    Some notes here:

    • R7, C1, R2 were placed there for toying with different feedback responses and can be omitted.
    • There are two strings of LEDs because each LED device is made up of two Spice models in parallel.
    • The R5 resistor is there for stability because op amps dislike driving capacitive loads. 
    • The voltage divider for the reference voltage is how it'll be done on the circuit board.
    • I originally tried a LM358 op amp model, but simulations made no sense and I swapped it to a random op amp from the libraries, yet I still placed an LM358 on the circuit board.  

    Ramping up the reference we are getting this:

    Current through LEDs vs reference voltage

    Current through LEDs vs MOSFET voltage drop - touching the limits here

    And that's all I needed to know. I made sure to attach the Spice model to this project.

View all 5 project logs

Enjoy this project?



crun wrote 05/20/2020 at 22:43 point

Check out the excellent forth for STM8, and bypass the whole toolchain issue. It's the best thing about STM8.
One thing I like is that when you come back to your project in 5 years time and want to make "one little change" , you don't have to try and get the whole dev toolchain working again since its on chip.

  Are you sure? yes | no

Ole Andreas Utstumo wrote 05/22/2020 at 17:19 point

That's awesome, thanks for the tip!

  Are you sure? yes | no

Dan Maloney wrote 05/18/2020 at 20:23 point

I'm interested to learn more about this one.

  Are you sure? yes | no

Ole Andreas Utstumo wrote 05/19/2020 at 19:04 point

Sure thing.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates