Power LED constant current driver unstability
It took some time to get it working, but in the end I'm kindof proud of it. It regulates nicely, no oscillations nor overshoots. Maybe somebody wants to replicate, I'm providing working schematic and simulation file from ltspice. Main issue was feedback compensation and transistor drive.
What it does?
Circut allows from dimming led using pwm (for example from WS2811 chip) keeping maximum current at set level.
double op-amp LM358 ensures current regulation (current is sensed od 1 Ohm reistor) and compared with reference voltage (created by zener and adjusted by potensiometer). MOSFET transistor is driven in the way to keep current stable. Shorting reference voltage (high impedance) to ground by small Q2 mosfet allows for decreasing current to 0, so pwm regulation is achieved.
Version 4
SHEET 1 880 680
WIRE 336 -416 208 -416
WIRE 208 -400 208 -416
WIRE 336 -48 336 -416
WIRE 352 -48 336 -48
WIRE 352 -32 352 -48
WIRE -112 -16 -128 -16
WIRE -16 -16 -32 -16
WIRE -128 48 -128 -16
WIRE -112 48 -128 48
WIRE -16 48 -16 -16
WIRE -16 48 -48 48
WIRE 208 80 208 48
WIRE -224 144 -240 144
WIRE -128 144 -128 48
WIRE -128 144 -144 144
WIRE -112 144 -128 144
WIRE -16 160 -16 48
WIRE -16 160 -48 160
WIRE 0 160 -16 160
WIRE 160 160 80 160
WIRE -112 176 -304 176
WIRE 208 256 208 176
WIRE 208 256 64 256
WIRE -240 272 -240 144
WIRE -32 272 -240 272
WIRE 0 272 -32 272
WIRE 208 272 208 256
WIRE 96 288 64 288
WIRE -304 320 -304 176
WIRE -304 320 -320 320
WIRE -208 320 -224 320
WIRE -208 336 -208 320
WIRE -512 368 -624 368
WIRE -384 368 -432 368
WIRE -368 368 -384 368
WIRE -624 384 -624 368
WIRE -32 384 -32 272
WIRE -16 384 -32 384
WIRE 96 384 96 288
WIRE 96 384 64 384
WIRE 208 384 208 352
WIRE 96 400 96 384
WIRE -208 416 -320 416
WIRE -208 432 -208 416
WIRE -32 432 -32 384
WIRE 96 432 96 400
WIRE 96 432 32 432
WIRE -624 480 -624 464
WIRE 96 496 96 480
FLAG 208 384 0
FLAG -80 128 12V
FLAG 32 304 12V
FLAG 32 240 0
FLAG -80 192 0
FLAG 96 496 0
FLAG 352 48 0
FLAG -608 48 0
FLAG -608 -32 12V
FLAG -208 432 0
FLAG -624 480 0
SYMBOL nmos 160 80 R0
SYMATTR InstName M1
SYMATTR Value BSB015N04NX3
SYMBOL res 192 256 R0
SYMATTR InstName R1
SYMATTR Value 1
SYMBOL lib\\sym\\ZZZ\\OpAmp\\LM358_AB -80 96 R0
SYMATTR InstName U1
SYMBOL lib\\sym\\ZZZ\\OpAmp\\LM358_AB 32 336 R180
SYMATTR InstName U2
SYMBOL res -128 128 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R2
SYMATTR Value 10k
SYMBOL res 80 368 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R3
SYMATTR Value 10k
SYMBOL res 112 496 R180
WINDOW 0 36 76 Left 2
WINDOW 3 36 40 Left 2
SYMATTR InstName R4
SYMATTR Value 2k2
SYMBOL res 96 144 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R5
SYMATTR Value 10
SYMBOL voltage 352 -48 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V1
SYMATTR Value 15
SYMBOL voltage -608 -48 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V2
SYMATTR Value 12
SYMBOL voltage -208 320 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V3
SYMATTR Value 2
SYMBOL cap -48 32 R90
WINDOW 0 0 32 VBottom 2
WINDOW 3 32 32 VTop 2
SYMATTR InstName C1
SYMATTR Value 100n
SYMBOL res -208 304 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R7
SYMATTR Value 1k
SYMBOL Misc\\signal -624 368 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V4
SYMATTR Value SINE(0 1 2000)
SYMBOL res -416 352 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R8
SYMATTR Value 100
SYMBOL res -16 -32 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R9
SYMATTR Value 220k
SYMBOL npn -384 320 R0
SYMATTR InstName Q1
SYMBOL cap 32 416 R90
WINDOW 0 0 32 VBottom 2
WINDOW 3 32 32 VTop 2
SYMATTR InstName C2
SYMATTR Value 1n
SYMBOL diode 224 48 R180
WINDOW 0 24 64 Left 2
WINDOW 3 24 0 Left 2
SYMATTR InstName D1
SYMATTR Value BZX84C6V2L
SYMBOL diode 192 -80 R0
SYMATTR InstName D2
SYMATTR Value 1N4148
SYMBOL diode 192 -144 R0
SYMATTR InstName D3
SYMATTR Value 1N4148
SYMBOL diode 192 -208 R0
SYMATTR InstName D4
SYMATTR Value 1N4148
SYMBOL diode 192 -272 R0
SYMATTR InstName D5
SYMATTR Value 1N4148
SYMBOL diode 192 -336 R0
SYMATTR InstName D6
SYMATTR Value 1N4148
SYMBOL diode 192 -400 R0
SYMATTR InstName D7
SYMATTR Value 1N4148
TEXT -400 520 Left 2 !.tran 0.01 uic