i-k-bus-board/site/public/spice/ibus_rx_path.cir
Ryan Malloy 48b61f462a Add SPICE waveform plots and downloadable netlists to circuit design page
Simulated RX and TX paths via mcltspice, generated 4 SVG waveform
plots (2000 data points each), and staged all 8 netlists plus the
muki01 schematic as downloadable site assets.

Presentation: Starlight Tabs for RX/TX waveform pairs, inline
schematic image, dark mode CSS filter for white-background SVGs,
and netlist inventory with download links.
2026-02-20 13:28:03 -07:00

66 lines
1.7 KiB
Plaintext

* BMW I/K-Bus Interface - RX Path (Bus to ESP32) - PC817 Optocoupler
* Bus drives byte 0x50 (MFL addr) at 9600 baud 8E1
* 0x50 = 01010000, LSB first = 00001010, even parity = 0
* Frame: START(0) d0(0) d1(0) d2(0) d3(0) d4(1) d5(0) d6(1) d7(0) P(0) STOP(1)
* Bus: 12V=idle/HIGH, 0V=active/LOW, bit time=104.17us
* ESP32 GPIO thresholds: LOW < 0.825V, HIGH > 2.475V
*
* PC817 pin order: 1=Anode, 2=Cathode, 3=Collector, 4=Emitter
* U1 config: emitter-follower (collector to VCC, emitter to RX output)
* === Power Supplies ===
V_BAT V12 0 12
V_MCU VCC 0 3.3
* === Bus Model ===
* External module driving byte 0x50 through 100R source impedance
V_BUS V_BUS_SRC 0 PWL(
+ 0u 12
+ 199.5u 12
+ 200u 0
+ 720.33u 0
+ 720.83u 12
+ 824.5u 12
+ 825u 0
+ 928.67u 0
+ 929.17u 12
+ 1032.83u 12
+ 1033.33u 0
+ 1241.17u 0
+ 1241.67u 12
+ 2000u 12)
R_BUS V_BUS_SRC IBUS 100
C_BUS IBUS 0 100p
* === RX Optocoupler (U1) ===
* Bus HIGH (12V): LED on -> phototransistor ON -> RX HIGH
* Bus LOW (0V): LED off -> phototransistor OFF -> RX LOW (via R4)
R1 IBUS U1_A 2k
XU1 U1_A 0 VCC RX PC817 Igain=1m
R4 RX 0 1k
* === PC817 Subcircuit (inlined from LTspice library) ===
.subckt PC817 1 2 3 4
R1 N003 2 2
D1 1 N003 LD
G1 3 N004 N003 2 {Igain}
C1 1 2 18p
Q1 3 N004 4 [4] NP
.model LD D(Is=1e-20 Cjo=18p)
.model NP NPN(Bf=1200 Vaf=140 Ikf=100m Rc=1 Cjc=19p Cje=7p Cjs=7p C2=3e-15)
.ends PC817
* === Simulation ===
.tran 0 2000u 0 0.1u
* === Measurements ===
.meas tran RX_HIGH MAX V(RX)
.meas tran RX_LOW MIN V(RX)
.meas tran IBUS_HIGH MAX V(IBUS)
.meas tran IBUS_LOW MIN V(IBUS)
.meas tran LED_CURRENT_MAX MAX I(R1)
.meas tran RX_RISE TRIG V(RX) VAL=0.825 RISE=1 TARG V(RX) VAL=2.475 RISE=1
.meas tran RX_FALL TRIG V(RX) VAL=2.475 FALL=1 TARG V(RX) VAL=0.825 FALL=1
.backanno
.end