* Z:\home\khalils\Downloads\files\data\raw_asc\6dee7956bd75_Variable-duty-cycle-square-wave.asc
* Generated by LTspice 26.0.1 for Windows.
* Variable duty cyle square wave
* Veb_Q1 = 0.513 V (measured)\nVR3 = 0.3065 V (measured)\nEstimated emitter current (Q1) = VR3/10000 = 30.65uA\n \nIe = (Vcc - Veb - R2/(R2+R1)*Vcc)/R3 \nIe = (1+ beta)*Ic\n \nassuming beta >> 1 then Ie = Ic\n \nThen capacitor needs a time t to rise to a voltage equal to 4.5V + Veb\nrequired to turn on Q3 and in turn turning on Q2.\n \nt = (R5/(R4+R5)*Vcc + Veb) * C / Ic\nt = (4.50+0.6)*100*10**(-9)/Ic = 16.6 ms\n \nNeglecting discharging time which is quite fast, we get a frequency of\nf = 1/t = 60.09 Hz while the measured one is 62 Hz. Quite close.\n \n \nTo increase frequency:\n- Reduce C\n- Reduce VA\n- Increase Ic (reduce R3)\n \nVB controls the duty cycle: can be a fixed voltage as in the example, the output of a regulator, or a potentiometer\n \nNotes: better to use polyester capacitors and a real comparator (not an opamp)
* e
* b
* c
* A
* OUT
* B
R3 N001 N002 10k
R6 N001 N008 10k
R7 N008 0 2k
R2 N003 0 10k
R5 N005 0 10k
R8 N007 0 R
XU1 N004 N008 N007 opamp Aol=100K GBW=10Meg ;pnba invin)noninvin)out
R4 N001 N005 10k
Q1 N004 N003 N002 0 BC640
Q2 N005 N006 0 0 BC337-40
C1 N004 0 100n
Q3 N006 N005 N004 0 BC640
V1 N001 0 9
R1 N001 N003 1k
.model NPN NPN
.model PNP PNP
.lib C:\users\khalils\AppData\Local\LTspice\lib\cmp\standard.bjt
.backanno
.end

* LTspice schematic (.asc):
Version 4
SHEET 1 2032 724
WIRE -32 -16 -80 -16
WIRE 32 -16 -32 -16
WIRE 192 -16 32 -16
WIRE 592 -16 192 -16
WIRE 192 16 192 -16
WIRE -80 32 -80 -16
WIRE 32 48 32 -16
WIRE 192 128 192 96
WIRE -80 144 -80 112
WIRE 32 176 32 128
WIRE 128 176 32 176
WIRE 592 176 592 -16
WIRE 32 240 32 176
WIRE 192 240 192 224
WIRE 288 240 192 240
WIRE 352 240 288 240
WIRE 192 256 192 240
WIRE 352 256 352 240
WIRE 496 304 416 304
WIRE 592 304 592 256
WIRE 592 304 496 304
WIRE 496 320 496 304
WIRE 592 320 592 304
WIRE 32 352 32 320
WIRE 192 352 192 320
WIRE 352 368 352 352
WIRE 432 368 352 368
WIRE -32 416 -32 -16
WIRE 496 448 496 416
WIRE 592 448 592 400
WIRE 288 528 288 240
WIRE 304 528 288 528
WIRE 448 544 368 544
WIRE -32 560 -32 496
WIRE 304 560 -32 560
WIRE 448 576 448 544
WIRE -32 608 -32 560
WIRE -32 704 -32 688
WIRE 448 704 448 656
SYMBOL res 16 224 R0
SYMATTR InstName R2
SYMATTR Value 10k
SYMBOL res -48 400 R0
SYMATTR InstName R6
SYMATTR Value 10k
SYMBOL cap 176 256 R0
SYMATTR InstName C1
SYMATTR Value 100n
SYMBOL res 576 160 R0
SYMATTR InstName R4
SYMATTR Value 10k
SYMBOL res 16 32 R0
SYMATTR InstName R1
SYMATTR Value 1k
SYMBOL voltage -80 16 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V1
SYMATTR Value 9
SYMBOL Opamps\\opamp 336 480 R0
SYMATTR InstName U1
SYMBOL res 176 0 R0
SYMATTR InstName R3
SYMATTR Value 10k
SYMBOL res -48 592 R0
SYMATTR InstName R7
SYMATTR Value 2k
SYMBOL res 432 560 R0
SYMATTR InstName R8
SYMBOL npn 432 320 R0
SYMATTR InstName Q2
SYMATTR Value BC337-40
SYMBOL pnp 416 352 R180
SYMATTR InstName Q3
SYMATTR Value BC640
SYMBOL res 576 304 R0
SYMATTR InstName R5
SYMATTR Value 10k
SYMBOL pnp 128 224 M180
SYMATTR InstName Q1
SYMATTR Value BC640
FLAG 32 352 0
FLAG 192 352 0
FLAG -80 144 0
FLAG 496 448 0
FLAG 592 448 0
FLAG -32 704 0
FLAG 448 704 0
TEXT 0 -144 Left 4 ;Variable duty cyle square wave
TEXT 760 -80 Left 2 ;Veb_Q1 = 0.513 V (measured)\nVR3 = 0.3065 V (measured)\nEstimated emitter current (Q1) = VR3/10000 = 30.65uA\n \nIe = (Vcc - Veb - R2/(R2+R1)*Vcc)/R3 \nIe = (1+ beta)*Ic\n \nassuming beta >> 1 then Ie = Ic\n \nThen capacitor needs a time t to rise to a voltage equal to 4.5V + Veb\nrequired to turn on Q3 and in turn turning on Q2.\n \nt = (R5/(R4+R5)*Vcc + Veb) * C / Ic\nt = (4.50+0.6)*100*10**(-9)/Ic = 16.6 ms\n \nNeglecting discharging time which is quite fast, we get a frequency of\nf = 1/t = 60.09 Hz while the measured one is 62 Hz. Quite close.\n \n \nTo increase frequency:\n- Reduce C\n- Reduce VA\n- Increase Ic (reduce R3)\n \nVB controls the duty cycle: can be a fixed voltage as in the example, the output of a regulator, or a potentiometer\n \nNotes: better to use polyester capacitors and a real comparator (not an opamp)
TEXT 208 120 Left 2 ;e
TEXT 112 144 Left 2 ;b
TEXT 160 240 Left 2 ;c
TEXT 616 288 Left 2 ;A
TEXT 464 536 Left 2 ;OUT
TEXT -80 560 Left 2 ;B