* Z:\home\khalils\Downloads\files\data\raw_asc\74be384b75f5_ATtiny85_Brake_Flasher.asc
* Generated by LTspice 26.0.1 for Windows.
* ATtiny85 Brake Light Flasher Simulation
* Input voltage switches between 38V (running) and 57V (brake)
* Simulation Notes:
* 1. V_INPUT simulates the brake voltage switching
* 2. V_5V_RAIL represents the buck converter output
* 3. B_THRESHOLD_DETECT models the ATtiny85 ADC threshold detection
* 4. B_FLASH_GENERATOR models the 2Hz flashing behavior
* 5. M_LOAD_SWITCH is the RFP30N06LE MOSFET
* Run transient analysis for 8 seconds to see brake activation
* Plot V(VIN), V(SENSE), V(GATE_DRIVE), and I(R_LAMP)
R_GATE LAMP_MINUS 0 150
C_BUCK_OUT LAMP_PLUS NC_01 100
R2_DIVIDER LAMP_MINUS 0 10k
R_PULLDOWN LAMP_PLUS LAMP_MINUS 10k
B_FLASH_GENERATOR LAMP_MINUS NC_06 V=if(V(threshold)>2.5, if(time-int(time/0.5)*0.5<0.25, 5, 0), 5)
M_LOAD_SWITCH LAMP_MINUS LAMP_MINUS NC_07 NC_08 RFP30N06LE
R_LAMP LAMP_PLUS LAMP_MINUS 20
R_BUCK_LOAD LAMP_PLUS LAMP_MINUS 10
V_INPUT LAMP_PLUS LAMP_MINUS PULSE(38 57 0 1m 1m 2 4)
R1_DIVIDER LAMP_MINUS 0 120k
V_5V_RAIL NC_02 NC_03 5
B_THRESHOLD_DETECT NC_04 NC_05 V=if(V(LAMP_MINUS)>3.66, 5, 0)
.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 2000 1200
WIRE 144 -16 80 -16
WIRE 272 -16 144 -16
WIRE 400 -16 272 -16
WIRE 528 -16 400 -16
WIRE 656 -16 528 -16
WIRE 80 32 80 -16
WIRE 144 32 144 -16
WIRE 272 32 272 -16
WIRE 400 32 400 -16
WIRE 528 32 528 -16
WIRE 656 32 656 -16
WIRE 80 144 80 112
WIRE 144 144 144 112
WIRE 144 144 80 144
WIRE 272 144 272 112
WIRE 272 144 144 144
WIRE 400 144 400 112
WIRE 400 144 272 144
WIRE 528 144 528 112
WIRE 528 144 400 144
WIRE 656 144 656 112
WIRE 656 144 528 144
WIRE 80 192 80 144
WIRE 176 192 80 192
WIRE 304 192 176 192
WIRE 432 192 304 192
WIRE 560 192 432 192
WIRE 688 192 560 192
WIRE 176 240 176 192
WIRE 304 240 304 192
WIRE 432 240 432 192
WIRE 560 240 560 192
WIRE 688 240 688 192
WIRE 176 352 176 320
WIRE 304 352 304 320
WIRE 304 352 176 352
WIRE 432 352 432 320
WIRE 432 352 304 352
WIRE 560 352 560 320
WIRE 560 352 432 352
WIRE 688 352 688 320
WIRE 688 352 560 352
WIRE 176 400 176 352
WIRE 432 240 432 192
WIRE 432 272 432 240
WIRE 432 272 480 272
WIRE 480 272 480 240
WIRE 480 240 544 240
SYMBOL res 160 224 R0
SYMATTR InstName R1_DIVIDER
SYMATTR Value 120k
SYMBOL bv 416 224 R0
WINDOW 123 0 0 Left 0
SYMATTR InstName B_THRESHOLD_DETECT
SYMATTR Value V=if(V(sense)>3.66, 5, 0)
SYMBOL res 288 224 R0
SYMATTR InstName R2_DIVIDER
SYMATTR Value 10k
SYMBOL cap 256 32 R0
SYMATTR InstName C_BUCK_OUT
SYMATTR Value 100u
SYMBOL res 512 16 R0
SYMATTR InstName R_LAMP
SYMATTR Value 20
SYMBOL bv 544 224 R0
WINDOW 123 0 0 Left 0
SYMATTR InstName B_FLASH_GENERATOR
SYMATTR Value V=if(V(threshold)>2.5, if(time-int(time/0.5)*0.5<0.25, 5, 0), 5)
SYMBOL res 128 16 R0
SYMATTR InstName R_BUCK_LOAD
SYMATTR Value 10
SYMBOL nmos 608 112 R0
SYMATTR InstName M_LOAD_SWITCH
SYMATTR Value RFP30N06LE
SYMBOL res 640 16 R0
SYMATTR InstName R_PULLDOWN
SYMATTR Value 10k
SYMBOL voltage 80 16 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V_INPUT
SYMATTR Value PULSE(38 57 0 1m 1m 2 4)
SYMBOL res 672 224 R0
SYMATTR InstName R_GATE
SYMATTR Value 150
SYMBOL voltage 384 16 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V_5V_RAIL
SYMATTR Value 5
FLAG 176 400 0
FLAG 80 -16 VIN
FLAG 656 -16 LAMP_PLUS
FLAG 688 192 LAMP_MINUS
FLAG 272 -16 VCC_5V
FLAG 432 192 SENSE
FLAG 560 192 GATE_DRIVE
TEXT 80 -80 Left 2 ;ATtiny85 Brake Light Flasher Simulation
TEXT 80 -48 Left 1 ;Input voltage switches between 38V (running) and 57V (brake)
TEXT 80 480 Left 2 ;Simulation Notes:
TEXT 80 512 Left 1 ;1. V_INPUT simulates the brake voltage switching
TEXT 80 528 Left 1 ;2. V_5V_RAIL represents the buck converter output
TEXT 80 544 Left 1 ;3. B_THRESHOLD_DETECT models the ATtiny85 ADC threshold detection
TEXT 80 560 Left 1 ;4. B_FLASH_GENERATOR models the 2Hz flashing behavior
TEXT 80 576 Left 1 ;5. M_LOAD_SWITCH is the RFP30N06LE MOSFET
TEXT 80 608 Left 1 ;Run transient analysis for 8 seconds to see brake activation
TEXT 80 624 Left 1 ;Plot V(VIN), V(SENSE), V(GATE_DRIVE), and I(R_LAMP)