* Z:\home\khalils\Downloads\files\data\raw_asc\0f821a222f89_ATtiny85_Brake_Flasher_Complete.asc
* Generated by LTspice 26.0.1 for Windows.
* ATtiny85 Brake Light Flasher - Complete LTspice Simulation
* Input voltage switches between 38V (running) and 57V (brake) every 2 seconds
* Simulation Instructions:
* 1. Run transient analysis: .tran 0 8 0 1m
* 2. Plot these signals: V(VIN), V(SENSE), V(THRESHOLD), V(GATE_DRIVE), I(R_LAMP)
* 3. Observe brake detection at ~3.66V sense voltage (corresponds to ~47V input)
* 4. Watch 2Hz flashing when brake is active (GATE_DRIVE toggles every 250ms)
* Circuit Behavior:
* - Running mode (38V): Steady lamp current, GATE_DRIVE = 5V constant
* - Brake mode (57V): Flashing lamp current, GATE_DRIVE alternates 0V/5V at 2Hz
* Key Components:
* - Voltage divider (120k/10k) scales 38-57V input to 2.9-4.4V sense range
* - Threshold detector triggers at 3.66V (equivalent to ~47V input)
* - Flash generator creates 2Hz square wave (250ms on, 250ms off)
* - RFP30N06LE MOSFET switches lamp load efficiently
* Expected Results:
* - At t=0-1s: 38V input, steady lamp operation
* - At t=1-3s: 57V input, 2Hz flashing lamp operation
* - At t=3-5s: 38V input, return to steady operation
* - Pattern repeats every 4 seconds
R_BUCK_LOAD LAMP_PLUS LAMP_MINUS 5
B_GATE_DRIVER LAMP_MINUS NC_11 V=V(LAMP_MINUS)*V(LAMP_MINUS)/5 AC 0
V_INPUT LAMP_PLUS LAMP_MINUS PULSE(38 57 1 100m 100m 2 4) AC 0
R_DRAIN_LOAD LAMP_PLUS LAMP_MINUS 1
R_THRESH_LOAD 0 0 1Meg
B_FLASH_GENERATOR NC_09 NC_10 V=if(V(LAMP_MINUS)>2.5, if((time-int(time/0.5)*0.5)<0.25, 5, 0), 5) AC 0
R2_DIVIDER LAMP_MINUS 0 10k
R_SENSE_LOAD 0 0 1Meg
R_GATE_LOAD 0 0 1Meg
C_BUCK_OUT LAMP_PLUS NC_01 470
B_THRESHOLD_DETECT NC_05 NC_06 V=if(V(LAMP_MINUS)>3.66, 5, 0) AC 0
R_DRIVE_LOAD 0 0 1Meg
R_MOSFET_LOAD 0 0 1Meg
R_LAMP LAMP_PLUS LAMP_MINUS 15
M_LOAD_SWITCH NC_12 LAMP_MINUS LAMP_MINUS LAMP_MINUS RFP30N06LE l=1u w=100u
V_5V_RAIL NC_02 NC_03 5 AC 0
C_LOAD_FILTER LAMP_PLUS NC_04 10
R_GATE LAMP_PLUS LAMP_MINUS 150
R1_DIVIDER LAMP_MINUS 0 120k
R_PULLDOWN LAMP_PLUS LAMP_MINUS 10k
B_ADC_DELAY NC_07 NC_08 V=delay(V(LAMP_MINUS), 10m) AC 0
R_FLASH_LOAD 0 0 1Meg
.model NMOS NMOS
.model PMOS PMOS
.lib C:\users\khalils\AppData\Local\LTspice\lib\cmp\standard.mos
.backanno
.end

* LTspice schematic (.asc):
Version 4
SHEET 1 2400 1400
WIRE 80 -80 80 -112
WIRE 208 -80 80 -80
WIRE 336 -80 208 -80
WIRE 464 -80 336 -80
WIRE 592 -80 464 -80
WIRE 720 -80 592 -80
WIRE 848 -80 720 -80
WIRE 976 -80 848 -80
WIRE 1104 -80 976 -80
WIRE 80 -32 80 -80
WIRE 208 -32 208 -80
WIRE 336 -32 336 -80
WIRE 464 -32 464 -80
WIRE 592 -32 592 -80
WIRE 720 -32 720 -80
WIRE 848 -32 848 -80
WIRE 976 -32 976 -80
WIRE 1104 -32 1104 -80
WIRE 80 80 80 48
WIRE 208 80 208 48
WIRE 208 80 80 80
WIRE 336 80 336 48
WIRE 336 80 208 80
WIRE 464 80 464 48
WIRE 464 80 336 80
WIRE 592 80 592 48
WIRE 592 80 464 80
WIRE 720 80 720 48
WIRE 720 80 592 80
WIRE 848 80 848 48
WIRE 848 80 720 80
WIRE 976 80 976 48
WIRE 976 80 848 80
WIRE 1104 80 1104 48
WIRE 1104 80 976 80
WIRE 80 128 80 80
WIRE 176 128 80 128
WIRE 304 128 176 128
WIRE 432 128 304 128
WIRE 560 128 432 128
WIRE 688 128 560 128
WIRE 816 128 688 128
WIRE 944 128 816 128
WIRE 1072 128 944 128
WIRE 176 176 176 128
WIRE 304 176 304 128
WIRE 432 176 432 128
WIRE 560 176 560 128
WIRE 688 176 688 128
WIRE 816 176 816 128
WIRE 944 176 944 128
WIRE 1072 176 1072 128
WIRE 176 288 176 256
WIRE 304 288 304 256
WIRE 304 288 176 288
WIRE 432 288 432 256
WIRE 432 288 304 288
WIRE 560 288 560 256
WIRE 560 288 432 288
WIRE 688 288 688 256
WIRE 688 288 560 288
WIRE 816 288 816 256
WIRE 816 288 688 288
WIRE 944 288 944 256
WIRE 944 288 816 288
WIRE 1072 288 1072 256
WIRE 1072 288 944 288
WIRE 176 336 176 288
WIRE 432 352 432 288
WIRE 560 352 560 288
WIRE 688 352 688 288
WIRE 816 352 816 288
WIRE 944 352 944 288
WIRE 1072 352 1072 288
WIRE 432 464 432 432
WIRE 560 464 560 432
WIRE 560 464 432 464
WIRE 688 464 688 432
WIRE 688 464 560 464
WIRE 816 464 816 432
WIRE 816 464 688 464
WIRE 944 464 944 432
WIRE 944 464 816 464
WIRE 1072 464 1072 432
WIRE 1072 464 944 464
WIRE 432 512 432 464
WIRE 688 176 688 128
WIRE 688 208 688 176
WIRE 688 208 752 208
WIRE 752 208 752 176
WIRE 752 176 816 176
SYMBOL res 928 336 R0
SYMATTR InstName R_DRIVE_LOAD
SYMATTR Value 1Meg
SYMBOL res 800 336 R0
SYMATTR InstName R_GATE_LOAD
SYMATTR Value 1Meg
SYMBOL cap 1088 -48 R0
SYMATTR InstName C_LOAD_FILTER
SYMATTR Value 10u
SYMBOL voltage 448 -48 R0
WINDOW 123 24 124 Left 2
WINDOW 39 0 0 Left 0
SYMATTR Value2 AC 0
SYMATTR InstName V_5V_RAIL
SYMATTR Value 5
SYMBOL res 192 -48 R0
SYMATTR InstName R_BUCK_LOAD
SYMATTR Value 5
SYMBOL res 704 -48 R0
SYMATTR InstName R_PULLDOWN
SYMATTR Value 10k
SYMBOL res 544 336 R0
SYMATTR InstName R_THRESH_LOAD
SYMATTR Value 1Meg
SYMBOL res 1056 336 R0
SYMATTR InstName R_MOSFET_LOAD
SYMATTR Value 1Meg
SYMBOL res 160 160 R0
SYMATTR InstName R1_DIVIDER
SYMATTR Value 120k
SYMBOL cap 320 -48 R0
SYMATTR InstName C_BUCK_OUT
SYMATTR Value 470u
SYMBOL res 832 -48 R0
SYMATTR InstName R_GATE
SYMATTR Value 150
SYMBOL res 672 336 R0
SYMATTR InstName R_FLASH_LOAD
SYMATTR Value 1Meg
SYMBOL res 576 -48 R0
SYMATTR InstName R_LAMP
SYMATTR Value 15
SYMBOL bv 544 160 R0
WINDOW 123 24 124 Left 2
SYMATTR Value2 AC 0
SYMATTR InstName B_ADC_DELAY
SYMATTR Value V=delay(V(threshold), 10m)
SYMBOL voltage 80 -48 R0
WINDOW 123 24 124 Left 2
WINDOW 39 0 0 Left 0
SYMATTR Value2 AC 0
SYMATTR InstName V_INPUT
SYMATTR Value PULSE(38 57 1 100m 100m 2 4)
SYMBOL res 416 336 R0
SYMATTR InstName R_SENSE_LOAD
SYMATTR Value 1Meg
SYMBOL bv 416 160 R0
WINDOW 123 24 124 Left 2
SYMATTR Value2 AC 0
SYMATTR InstName B_THRESHOLD_DETECT
SYMATTR Value V=if(V(sense)>3.66, 5, 0)
SYMBOL res 288 160 R0
SYMATTR InstName R2_DIVIDER
SYMATTR Value 10k
SYMBOL bv 672 160 R0
WINDOW 123 24 124 Left 2
SYMATTR Value2 AC 0
SYMATTR InstName B_FLASH_GENERATOR
SYMATTR Value V=if(V(flash_ctrl)>2.5, if((time-int(time/0.5)*0.5)<0.25, 5, 0), 5)
SYMBOL nmos 1024 48 R0
WINDOW 123 56 100 Left 2
SYMATTR Value2 l=1u w=100u
SYMATTR InstName M_LOAD_SWITCH
SYMATTR Value RFP30N06LE
SYMBOL res 960 -48 R0
SYMATTR InstName R_DRAIN_LOAD
SYMATTR Value 1
SYMBOL bv 800 160 R0
WINDOW 123 24 124 Left 2
SYMATTR Value2 AC 0
SYMATTR InstName B_GATE_DRIVER
SYMATTR Value V=V(flash_ctrl)*V(gate_drive)/5
FLAG 176 336 0
FLAG 80 -112 VIN
FLAG 1104 -80 LAMP_PLUS
FLAG 1072 128 LAMP_MINUS
FLAG 336 -80 VCC_5V
FLAG 432 512 0
FLAG 432 128 SENSE
FLAG 688 128 THRESHOLD
FLAG 816 128 FLASH_CTRL
FLAG 944 128 GATE_DRIVE
TEXT 80 -160 Left 2 ;ATtiny85 Brake Light Flasher - Complete LTspice Simulation
TEXT 80 -128 Left 1 ;Input voltage switches between 38V (running) and 57V (brake) every 2 seconds
TEXT 80 560 Left 2 ;Simulation Instructions:
TEXT 80 592 Left 1 ;1. Run transient analysis: .tran 0 8 0 1m
TEXT 80 608 Left 1 ;2. Plot these signals: V(VIN), V(SENSE), V(THRESHOLD), V(GATE_DRIVE), I(R_LAMP)
TEXT 80 624 Left 1 ;3. Observe brake detection at ~3.66V sense voltage (corresponds to ~47V input)
TEXT 80 640 Left 1 ;4. Watch 2Hz flashing when brake is active (GATE_DRIVE toggles every 250ms)
TEXT 80 672 Left 2 ;Circuit Behavior:
TEXT 80 704 Left 1 ;- Running mode (38V): Steady lamp current, GATE_DRIVE = 5V constant
TEXT 80 720 Left 1 ;- Brake mode (57V): Flashing lamp current, GATE_DRIVE alternates 0V/5V at 2Hz
TEXT 80 752 Left 2 ;Key Components:
TEXT 80 784 Left 1 ;- Voltage divider (120k/10k) scales 38-57V input to 2.9-4.4V sense range
TEXT 80 800 Left 1 ;- Threshold detector triggers at 3.66V (equivalent to ~47V input)
TEXT 80 816 Left 1 ;- Flash generator creates 2Hz square wave (250ms on, 250ms off)
TEXT 80 832 Left 1 ;- RFP30N06LE MOSFET switches lamp load efficiently
TEXT 80 864 Left 2 ;Expected Results:
TEXT 80 896 Left 1 ;- At t=0-1s: 38V input, steady lamp operation
TEXT 80 912 Left 1 ;- At t=1-3s: 57V input, 2Hz flashing lamp operation
TEXT 80 928 Left 1 ;- At t=3-5s: 38V input, return to steady operation
TEXT 80 944 Left 1 ;- Pattern repeats every 4 seconds