CapEncoderSpiceModel

From Open Source Ecology
Jump to: navigation, search

Rotary_encoder#CapEncoder

Electrical Simulation Model

SPICE model:

* CapEncoderSim.asc
C1 ROTOR A+ 3.5p
C2 ROTOR A- 1.5p
C3 ROTOR B+ 4p
C4 ROTOR B- 1p
C9 AIN0 AIN1 .025µ
R1 N005 AIN0 3300
L1 AIN0 AIN1 10m
C5 ROTOR 0 10p
V3 A+ 0 PULSE(0 5 0 .1u .1u 50u 100u 100) AC 5 0 Rser=0 Cpar=0
V5 N001 0 5 Rser=0
R3 N001 N004 2MEG
A1 A+ 0 0 0 0 A- 0 0 BUF Vhigh=5
A2 B+ 0 0 0 0 B- 0 0 BUF Vhigh=5
A3 A+ 0 0 0 0 0 B+ 0 BUF Td=25u Vhigh=5
C6 N002 ROTOR 50p
C8 N003 N002 0.01µ
R2 N004 N003 3300
C7 N002 0 100p
D1 AIN1 0 1N4148
R4 ROTOR 0 20MEG
M1 N001 N004 N005 N005 2N7002
.model D D
.lib C:\PROGRA~1\LTC\LTSPIC~1\lib\cmp\standard.dio
.model NMOS NMOS
.model PMOS PMOS
.lib C:\PROGRA~1\LTC\LTSPIC~1\lib\cmp\standard.mos
;ac oct 20 100 100000
.tran 2500u
* ANGLE-DEPENDENT\nCOUPLING CAPACITANCES\nC1-C4
* STRAYS
* CABLE
* ROTOR\nCOUPLING
* ARDUINO\nOUTPUTS
* ARDUINO\nCOMPARATOR INPUTS
* 5V SUPPLY
* 10 KHz
* 10KHz\nFILTER\nQ ~ 5
* ~100mV pk-pk
.backanno
.end

Schematic file for LTSpice IV

Version 4
SHEET 1 880 680
WIRE 96 -336 -32 -336
WIRE 288 -336 96 -336
WIRE -32 -304 -32 -336
WIRE 288 -304 288 -336
WIRE 96 -192 96 -336
WIRE 288 -192 288 -224
WIRE -1312 -112 -1344 -112
WIRE -1200 -112 -1232 -112
WIRE -1040 -112 -1200 -112
WIRE -976 -112 -1040 -112
WIRE -800 -112 -976 -112
WIRE -720 -112 -800 -112
WIRE -608 -112 -656 -112
WIRE -544 -112 -608 -112
WIRE -480 -112 -544 -112
WIRE -416 -112 -480 -112
WIRE -304 -112 -352 -112
WIRE -240 -112 -304 -112
WIRE -144 -112 -176 -112
WIRE -32 -112 -32 -224
WIRE -32 -112 -64 -112
WIRE 48 -112 -32 -112
WIRE -304 -80 -304 -112
WIRE -480 -64 -480 -112
WIRE -480 -64 -544 -64
WIRE -544 -48 -544 -64
WIRE -480 -48 -480 -64
WIRE 96 -48 96 -96
WIRE -976 -16 -976 -112
WIRE -928 -16 -976 -16
WIRE -800 -16 -864 -16
WIRE -720 -16 -800 -16
WIRE -608 -16 -608 -112
WIRE -608 -16 -656 -16
WIRE -304 32 -304 -16
WIRE -1344 48 -1344 -112
WIRE -544 48 -544 16
WIRE -480 48 -480 32
WIRE -480 48 -544 48
WIRE -1200 64 -1200 -112
WIRE -1152 64 -1200 64
WIRE -1040 64 -1088 64
WIRE -976 64 -1040 64
WIRE -800 64 -976 64
WIRE -720 64 -800 64
WIRE -608 64 -608 -16
WIRE -608 64 -656 64
WIRE 96 64 96 32
WIRE 208 64 96 64
WIRE 592 64 208 64
WIRE 96 80 96 64
WIRE 208 96 208 64
WIRE -480 112 -480 48
WIRE -976 144 -976 64
WIRE -928 144 -976 144
WIRE -800 144 -864 144
WIRE -720 144 -800 144
WIRE -608 144 -608 64
WIRE -608 144 -656 144
WIRE 96 208 96 144
WIRE 160 208 96 208
WIRE 208 208 208 176
WIRE 208 208 160 208
WIRE 592 208 208 208
WIRE 160 240 160 208
WIRE 160 352 160 304
FLAG 160 352 0
FLAG -1344 48 0
FLAG -480 112 0
FLAG 288 -192 0
FLAG 592 64 AIN0
IOPIN 592 64 Out
FLAG -544 -112 ROTOR
FLAG -304 32 0
FLAG 592 208 AIN1
IOPIN 592 208 Out
FLAG -1040 -112 OC1A
FLAG -1040 64 OC1B
FLAG -800 -112 A+
FLAG -800 -16 A-
FLAG -800 64 B+
FLAG -800 144 B-
SYMBOL cap -656 -128 R90
WINDOW 0 0 32 VBottom 2
WINDOW 3 32 32 VTop 2
SYMATTR InstName C1
SYMATTR Value 3.5p
SYMBOL cap -656 -32 R90
WINDOW 0 0 32 VBottom 2
WINDOW 3 32 32 VTop 2
SYMATTR InstName C2
SYMATTR Value 1.5p
SYMBOL cap -656 48 R90
WINDOW 0 0 32 VBottom 2
WINDOW 3 32 32 VTop 2
SYMATTR InstName C3
SYMATTR Value 4p
SYMBOL cap -656 128 R90
WINDOW 0 0 32 VBottom 2
WINDOW 3 32 32 VTop 2
SYMATTR InstName C4
SYMATTR Value 1p
SYMBOL cap 80 80 R0
SYMATTR InstName C9
SYMATTR Value .025µ
SYMBOL res 80 -64 R0
SYMATTR InstName R1
SYMATTR Value 3300
SYMBOL ind 192 80 R0
SYMATTR InstName L1
SYMATTR Value 10m
SYMBOL cap -560 -48 R0
SYMATTR InstName C5
SYMATTR Value 10p
SYMBOL voltage -1216 -112 R90
WINDOW 0 -32 56 VBottom 2
WINDOW 3 -135 142 VTop 2
WINDOW 123 -99 61 VTop 2
SYMATTR InstName V3
SYMATTR Value PULSE(0 5 0 .1u .1u 50u 100u 100)
SYMATTR Value2 AC 5 0
SYMATTR SpiceLine Rser=0 Cpar=0
SYMBOL voltage 288 -320 R0
WINDOW 123 0 0 Left 2
SYMATTR SpiceLine Rser=0
SYMATTR InstName V5
SYMATTR Value 5
SYMBOL res -48 -320 R0
SYMATTR InstName R3
SYMATTR Value 2MEG
SYMBOL Digital\\inv -928 -80 R0
SYMATTR InstName A1
SYMATTR SpiceLine Vhigh=5
SYMBOL Digital\\inv -928 80 R0
SYMATTR InstName A2
SYMATTR SpiceLine Vhigh=5
SYMBOL Digital\\buf1 -1152 0 R0
WINDOW 39 -24 102 Left 2
SYMATTR InstName A3
SYMATTR SpiceLine Td=25u
SYMATTR SpiceLine2 Vhigh=5
SYMBOL cap -352 -128 R90
WINDOW 0 0 32 VBottom 2
WINDOW 3 32 32 VTop 2
SYMATTR InstName C6
SYMATTR Value 50p
SYMBOL cap -176 -128 R90
WINDOW 0 0 32 VBottom 2
WINDOW 3 32 32 VTop 2
SYMATTR InstName C8
SYMATTR Value 0.01µ
SYMBOL res -48 -128 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R2
SYMATTR Value 3300
SYMBOL cap -320 -80 R0
SYMATTR InstName C7
SYMATTR Value 100p
SYMBOL diode 144 240 R0
SYMATTR InstName D1
SYMATTR Value 1N4148
SYMBOL res -496 -64 R0
SYMATTR InstName R4
SYMATTR Value 20MEG
SYMBOL nmos 48 -192 R0
SYMATTR InstName M1
SYMATTR Value 2N7002
TEXT -584 336 Left 2 !;ac oct 20 100 100000
TEXT -584 304 Left 2 !.tran 2500u
TEXT -688 -248 Center 2 ;ANGLE-DEPENDENT\nCOUPLING CAPACITANCES\nC1-C4
TEXT -568 72 Left 2 ;STRAYS
TEXT -288 8 Left 2 ;CABLE
TEXT -392 -200 Center 2 ;ROTOR\nCOUPLING
TEXT -1080 -200 Left 2 ;ARDUINO\nOUTPUTS
TEXT 632 120 Center 2 ;ARDUINO\nCOMPARATOR INPUTS
TEXT 344 -264 Left 2 ;5V SUPPLY
TEXT -1312 -280 Left 2 ;10 KHz
TEXT 256 -40 Center 2 ;10KHz\nFILTER\nQ ~ 5
TEXT 320 128 Left 2 ;~100mV pk-pk