PIR motion sensor frontend SPICE simulation

From Noisebridge
Revision as of 17:49, 19 April 2009 by Cmaier (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

PIR review

Christoph Maier

While a SPICE simulation doesn't really provide enough insight to design circuits, it's a rather useful tool to verify what an existing circuit design is actually doing.

Linear Technology provides a fully functional SPICE type simulator, LTspice, for free (unless you try to compete with them).

It is possible to import device models from other manufacturers, e.g. Texas Instruments's TLC272: [1].

A simulation of the PIR sensor front end circuit PIR skeem Sensor.jpg can provide some insight: Screenshot-LTspice IV - PIR review 001.asc.png

The noisebridge wiki doesn't allow me to upload the schematic files directly, so you'll have to paste them into plain text files and save them, together with the extracted TLC272 models, into the directory you run LTspice in.

Save the following as PIR_review_001.asc

Version 4
SHEET 1 1484 680.
WIRE -80 -192 -512 -192
WIRE 16 -192 -80 -192
WIRE 336 -192 16 -192
WIRE 960 -192 336 -192
WIRE 1184 -192 960 -192
WIRE 1312 -192 1184 -192
WIRE 16 -160 16 -192
WIRE 960 -160 960 -192
WIRE 1312 -160 1312 -192
WIRE 496 -80 224 -80
WIRE 544 -80 496 -80
WIRE 656 -80 624 -80
WIRE 496 -32 496 -80
WIRE 656 -16 656 -80
WIRE 960 -16 960 -80
WIRE 16 16 16 -80
WIRE 48 16 16 16
WIRE 224 16 224 -80
WIRE 224 16 128 16
WIRE 1184 32 1184 -192
WIRE 336 48 336 -192
WIRE 960 48 960 -16
WIRE 1104 48 960 48
WIRE 1152 48 1104 48
WIRE 224 64 224 16
WIRE 304 64 224 64
WIRE 1312 64 1312 -80
WIRE 1312 64 1216 64
WIRE 1344 64 1312 64
WIRE 496 80 496 48
WIRE 496 80 368 80
WIRE 576 80 496 80
WIRE 656 80 656 48
WIRE 656 80 576 80
WIRE 736 80 656 80
WIRE 848 80 800 80
WIRE 896 80 848 80
WIRE 1056 80 896 80
WIRE 1152 80 1056 80
WIRE -224 96 -304 96
WIRE -144 96 -224 96
WIRE -96 96 -144 96
WIRE 160 96 -32 96
WIRE 304 96 160 96
WIRE -512 128 -512 -192
WIRE 16 144 16 16
WIRE 848 144 848 80
WIRE 960 144 960 48
WIRE 16 160 16 144
WIRE 48 160 16 160
WIRE 160 160 160 96
WIRE 160 160 128 160
WIRE 1104 160 1104 48
WIRE -304 176 -304 96
WIRE 224 192 224 64
WIRE 848 272 848 224
WIRE 896 272 848 272
WIRE 960 272 960 224
WIRE 960 272 896 272
WIRE -144 288 -144 96
WIRE 16 288 16 160
WIRE 160 288 160 160
WIRE 960 288 960 272
WIRE 1056 288 1056 80
WIRE -512 400 -512 208
WIRE -304 400 -304 256
WIRE -304 400 -512 400
WIRE -144 400 -144 368
WIRE -144 400 -304 400
WIRE 16 400 16 368
WIRE 16 400 -144 400
WIRE 96 400 16 400
WIRE 160 400 160 352
WIRE 160 400 96 400
WIRE 224 400 224 256
WIRE 224 400 160 400
WIRE 336 400 336 112
WIRE 336 400 224 400
WIRE 960 400 960 368
WIRE 960 400 336 400
WIRE 1056 400 1056 352
WIRE 1056 400 960 400
WIRE 1104 400 1104 224
WIRE 1104 400 1056 400
WIRE 1184 400 1184 96
WIRE 1184 400 1104 400
WIRE 96 432 96 400
FLAG 96 432 0
FLAG -80 -192 dd
FLAG 160 96 inp
FLAG 224 -80 inn
FLAG 16 144 div1
FLAG -224 96 in
FLAG 1344 64 sensor
IOPIN 1344 64 Out
FLAG 960 -16 div22
FLAG 896 272 div21
FLAG 576 80 out1
FLAG 896 80 in2
SYMBOL Opamps\\opamp2 336 16 R0
WINDOW 3 16 96 Invisible 0
WINDOW 38 16 124 Left 0
SYMATTR InstName U102a
SYMATTR Value ""
SYMATTR SpiceModel TLC272
SYMBOL voltage -512 112 R0
SYMATTR InstName Vdd
SYMATTR Value 5
SYMBOL res 0 -176 R0
SYMATTR InstName R111
SYMATTR Value 2.2k
SYMBOL res 0 272 R0
SYMATTR InstName R113
SYMATTR Value 2.2k
SYMBOL res 144 144 R90
WINDOW 0 0 56 VBottom 0
WINDOW 3 32 56 VTop 0
SYMATTR InstName R112
SYMATTR Value 1Meg
SYMBOL res 480 -48 R0
SYMATTR InstName R104
SYMATTR Value 470k
SYMBOL res -160 272 R0
SYMATTR InstName R105
SYMATTR Value 47k
SYMBOL res 144 0 R90
WINDOW 0 0 56 VBottom 0
WINDOW 3 32 56 VTop 0
SYMATTR InstName R110
SYMATTR Value 820
SYMBOL cap 640 -16 R0
SYMATTR InstName C106
SYMATTR Value 47n
SYMBOL res 640 -96 R90
WINDOW 0 0 56 VBottom 0
WINDOW 3 32 56 VTop 0
SYMATTR InstName R108
SYMATTR Value 10k
SYMBOL cap -32 80 R90
WINDOW 0 0 32 VBottom 0
WINDOW 3 32 32 VTop 0
SYMATTR InstName C104
SYMATTR Value 100n
SYMBOL voltage -304 160 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName Vin
SYMATTR Value PULSE(0 5m 10m 1n 1n 40m 100m)
SYMBOL cap 208 192 R0
SYMATTR InstName C109
SYMATTR Value 470p
SYMBOL cap 144 288 R0
SYMATTR InstName C110
SYMATTR Value 470p
SYMBOL Opamps\\opamp2 1184 0 R0
WINDOW 3 16 96 Invisible 0
WINDOW 38 16 124 Left 0
SYMATTR InstName U102b
SYMATTR Value ""
SYMATTR SpiceModel TLC272
SYMBOL cap 800 64 R90
WINDOW 0 0 32 VBottom 0
WINDOW 3 32 32 VTop 0
SYMATTR InstName C105
SYMATTR Value 100n
SYMBOL res 944 -176 R0
SYMATTR InstName R102
SYMATTR Value 10k
SYMBOL res 944 272 R0
SYMATTR InstName R109
SYMATTR Value 10k
SYMBOL res 944 128 R0
SYMATTR InstName R107
SYMATTR Value 820
SYMBOL res 832 128 R0
SYMATTR InstName R106
SYMATTR Value 1Meg
SYMBOL res 1296 -176 R0
SYMATTR InstName R103
SYMATTR Value 22k
SYMBOL cap 1088 160 R0
SYMATTR InstName C107
SYMATTR Value 470p
SYMBOL cap 1040 288 R0
SYMATTR InstName C108
SYMATTR Value 470p
TEXT -448 304 Left 0 !.include TLC272.5_2
TEXT -442 344 Left 0 !.tran 0 1 0

and the following as PIR_review_001.plt

[Transient Analysis]
{
   Npanes: 5
   Active Pane: 4
   {
      traces: 1 {524295,0,"V(sensor)"}
      X: (' ',1,0,0.1,1)
      Y[0]: (' ',1,0,0.4,4)
      Y[1]: ('_',0,1e+308,0,-1e+308)
      Volts: (' ',0,0,1,0,0.4,4)
      Log: 0 0 0
      GridStyle: 1
      PltMag: 1
      PltPhi: 1 0
   },
   {
      traces: 3 {524294,0,"V(in2)"} {524296,0,"V(div21)"} {524297,0,"V(div22)"}
      X: (' ',1,0,0.1,1)
      Y[0]: (' ',1,2,0.1,3.1)
      Y[1]: ('_',0,1e+308,0,-1e+308)
      Volts: (' ',0,0,1,2,0.1,3.1)
      Log: 0 0 0
      GridStyle: 1
      PltMag: 1
      PltPhi: 1 0
   },
   {
      traces: 1 {524293,0,"V(out1)"}
      X: (' ',1,0,0.1,1)
      Y[0]: (' ',1,1.4,0.1,2.8)
      Y[1]: ('_',0,1e+308,0,-1e+308)
      Volts: (' ',0,0,1,1.4,0.1,2.8)
      Log: 0 0 0
      GridStyle: 1
      PltMag: 1
      PltPhi: 1 0
   },
   {
      traces: 2 {524290,0,"V(inp)"} {524291,0,"V(div1)"}
      X: (' ',1,0,0.1,1)
      Y[0]: (' ',4,2.4962,0.0007,2.5039)
      Y[1]: ('_',0,1e+308,0,-1e+308)
      Volts: (' ',0,0,4,2.4962,0.0007,2.5039)
      Log: 0 0 0
      GridStyle: 1
      PltMag: 1
      PltPhi: 1 0
   },
   {
      traces: 1 {524292,0,"V(in)"}
      X: (' ',1,0,0.1,1)
      Y[0]: ('m',1,-0.0005,0.0005,0.005)
      Y[1]: ('_',0,1e+308,0,-1e+308)
      Volts: ('m',0,0,1,-0.0005,0.0005,0.005)
      Log: 0 0 0
      GridStyle: 1
      PltMag: 1
      PltPhi: 1 0
   }
}

For people for whom LTspice tastes too much like a commercial product, here is the netlist:

* Z:\data\LTC\LTspiceIV\schematics\noisebridge\PIR_review_001.asc
XU102a inp inn dd 0 out1 TLC272
Vdd dd 0 5
R111 dd div1 2.2k
R113 div1 0 2.2k
R112 inp div1 1Meg
R104 inn out1 470k
R105 in 0 47k
R110 inn div1 820
C106 N001 out1 47n
R108 N001 inn 10k
C104 inp in 100n
Vin in 0 PULSE(0 5m 10m 1n 1n 40m 100m)
C109 inn 0 470p
C110 inp 0 470p
XU102b in2 div22 dd 0 sensor TLC272
C105 in2 out1 100n
R102 dd div22 10k
R109 div21 0 10k
R107 div22 div21 820
R106 in2 div21 1Meg
R103 dd sensor 22k
C107 div22 0 470p
C108 in2 0 470p
.include TLC272.5_2
.tran 0 1 0
.backanno
.end

and the log file (with the Texas Instruments opamp model converted from PSPICE to SPICE3 format)

 --- Expanded Deck Component Count --- 
B's 10 
C's 13 
D's 14 
E's 2 
G's 10 
H's 2 
I's 8 
J's 4 
R's 24 
V's 22 
tot: 109 


   --- Expanded Netist --- 
* Z:\data\LTC\LTspiceIV\schematics\noisebridge\PIR_review_001.asc 
c:u102a:1 u102a:11 u102a:12 5.657e-12  
c:u102a:2 u102a:6 u102a:7 20.00e-12  
c:u102a:psr u102a:85 u102a:86 79.6e-9  
d:u102a:cm+ u102a:81 u102a:82 u102a:dx  
d:u102a:cm- u102a:83 u102a:81 u102a:dx  
d:u102a:c out1 u102a:53 u102a:dx  
d:u102a:e u102a:54 out1 u102a:dx  
d:u102a:lp u102a:90 u102a:91 u102a:dx  
d:u102a:ln u102a:92 u102a:90 u102a:dx  
d:u102a:p 0 dd u102a:dx  
e:u102a:cmr u102a:84 u102a:99 inn u102a:99 1 
b:u102a:egnd u102a:99 0 v=.5*v(dd)+.5*v(0) 
b:u102a:epsr u102a:85 0 v=-246e-6+49.2e-6*v(dd,0) 
b:u102a:ense u102a:89 inn v=1.1e-3+v(u102a:88) 
b:u102a:fb u102a:7 u102a:99 i=1.120e6*i(v:u102a:b)+-1e6*i(v:u102a:c)+1e6*i(v:u102a:e)+1e6*i(v:u102a:lp)+-1e6*i(v:u102a:ln)+1.12e6*i(v:u102a:psr) 
g:u102a:a u102a:6 0 u102a:11 u102a:12 138.2e-6 
g:u102a:cm 0 u102a:6 u102a:10 u102a:99 28.46e-9 
g:u102a:psr u102a:85 u102a:86 u102a:85 u102a:86 100e-6 
g:u102a:rd1 u102a:60 u102a:11 u102a:60 u102a:11 1.382e-4 
g:u102a:rd2 u102a:60 u102a:12 u102a:60 u102a:12 1.382e-4 
h:u102a:lim u102a:90 0 v:u102a:lim 1k 
b:u102a:hcmr u102a:80 inp v=1e2*i(v:u102a:cm+)+1e2*i(v:u102a:cm-) 
i:u102a:rp dd 0 617e-6 
i:u102a:ss dd u102a:10 dc 58.00e-6 
i:u102a:io inn 0 .1e-12 
i:u102a:1 u102a:88 0 1e-21 
j:u102a:1 u102a:11 u102a:89 u102a:10 u102a:jx  
j:u102a:2 u102a:12 u102a:80 u102a:10 u102a:jx  
r:u102a:2 u102a:6 u102a:9 100.0e3  
r:u102a:cm u102a:84 u102a:81 1k  
r:u102a:n1 u102a:88 0 25.7e3  
r:u102a:o1 u102a:8 out1 75  
r:u102a:o2 u102a:7 u102a:99 75  
r:u102a:ss u102a:10 u102a:99 3.448e6  
v:u102a:ad u102a:60 0 -.7 
v:u102a:cm+ u102a:82 u102a:99 1.16 
v:u102a:cm- u102a:83 u102a:99 -2.26 
v:u102a:b u102a:9 0 dc 0 
v:u102a:c dd u102a:53 dc 1.85 
v:u102a:e u102a:54 0 dc .7 
v:u102a:lim u102a:7 u102a:8 dc 0 
v:u102a:lp u102a:91 0 dc 25 
v:u102a:ln 0 u102a:92 dc 25 
v:u102a:psr 0 u102a:86 dc 0 
vdd dd 0 5 
r111 dd div1 2.2k 
r113 div1 0 2.2k 
r112 inp div1 1meg 
r104 inn out1 470k 
r105 in 0 47k 
r110 inn div1 820 
c106 n001 out1 47n 
r108 n001 inn 10k 
c104 inp in 100n 
vin in 0 pulse(0 5m 10m 1n 1n 40m 100m) 
c109 inn 0 470p 
c110 inp 0 470p 
c:u102b:1 u102b:11 u102b:12 5.657e-12  
c:u102b:2 u102b:6 u102b:7 20.00e-12  
c:u102b:psr u102b:85 u102b:86 79.6e-9  
d:u102b:cm+ u102b:81 u102b:82 u102b:dx  
d:u102b:cm- u102b:83 u102b:81 u102b:dx  
d:u102b:c sensor u102b:53 u102b:dx  
d:u102b:e u102b:54 sensor u102b:dx  
d:u102b:lp u102b:90 u102b:91 u102b:dx  
d:u102b:ln u102b:92 u102b:90 u102b:dx  
d:u102b:p 0 dd u102b:dx  
e:u102b:cmr u102b:84 u102b:99 div22 u102b:99 1 
b:u102b:egnd u102b:99 0 v=.5*v(dd)+.5*v(0) 
b:u102b:epsr u102b:85 0 v=-246e-6+49.2e-6*v(dd,0) 
b:u102b:ense u102b:89 div22 v=1.1e-3+v(u102b:88) 
b:u102b:fb u102b:7 u102b:99 i=1.120e6*i(v:u102b:b)+-1e6*i(v:u102b:c)+1e6*i(v:u102b:e)+1e6*i(v:u102b:lp)+-1e6*i(v:u102b:ln)+1.12e6*i(v:u102b:psr) 
g:u102b:a u102b:6 0 u102b:11 u102b:12 138.2e-6 
g:u102b:cm 0 u102b:6 u102b:10 u102b:99 28.46e-9 
g:u102b:psr u102b:85 u102b:86 u102b:85 u102b:86 100e-6 
g:u102b:rd1 u102b:60 u102b:11 u102b:60 u102b:11 1.382e-4 
g:u102b:rd2 u102b:60 u102b:12 u102b:60 u102b:12 1.382e-4 
h:u102b:lim u102b:90 0 v:u102b:lim 1k 
b:u102b:hcmr u102b:80 in2 v=1e2*i(v:u102b:cm+)+1e2*i(v:u102b:cm-) 
i:u102b:rp dd 0 617e-6 
i:u102b:ss dd u102b:10 dc 58.00e-6 
i:u102b:io div22 0 .1e-12 
i:u102b:1 u102b:88 0 1e-21 
j:u102b:1 u102b:11 u102b:89 u102b:10 u102b:jx  
j:u102b:2 u102b:12 u102b:80 u102b:10 u102b:jx  
r:u102b:2 u102b:6 u102b:9 100.0e3  
r:u102b:cm u102b:84 u102b:81 1k  
r:u102b:n1 u102b:88 0 25.7e3  
r:u102b:o1 u102b:8 sensor 75  
r:u102b:o2 u102b:7 u102b:99 75  
r:u102b:ss u102b:10 u102b:99 3.448e6  
v:u102b:ad u102b:60 0 -.7 
v:u102b:cm+ u102b:82 u102b:99 1.16 
v:u102b:cm- u102b:83 u102b:99 -2.26 
v:u102b:b u102b:9 0 dc 0 
v:u102b:c dd u102b:53 dc 1.85 
v:u102b:e u102b:54 0 dc .7 
v:u102b:lim u102b:7 u102b:8 dc 0 
v:u102b:lp u102b:91 0 dc 25 
v:u102b:ln 0 u102b:92 dc 25 
v:u102b:psr 0 u102b:86 dc 0 
c105 in2 out1 100n 
r102 dd div22 10k 
r109 div21 0 10k 
r107 div22 div21 820 
r106 in2 div21 1meg 
r103 dd sensor 22k 
c107 div22 0 470p 
c108 in2 0 470p 
.model u102b:jx pjf(is=300.0e-15 beta=658.9e-6 vto=-.151 kf=1.85e-16) 
.model u102b:dx d(is=800.0e-18) 
.model u102a:jx pjf(is=300.0e-15 beta=658.9e-6 vto=-.151 kf=1.85e-16) 
.model u102a:dx d(is=800.0e-18) 
.tran 0 1 0 
.end 

Early termination of direct N-R iteration. 
Direct Newton iteration failed to find .op point.  (Use ".option noopiter" to skip.) 
Starting Gmin stepping 
Gmin = 10 
vernier = 0.5 
vernier = 0.25 
vernier = 0.125 
Gmin = 5.5165 
vernier = 0.0625 
vernier = 0.03125 
vernier = 0.015625 
vernier = 0.0078125 
Gmin = 5.49501 
vernier = 0.00390625 
vernier = 0.00195313 
vernier = 0.000976563 
vernier = 0.000488281 
Gmin = 5.50104 
Gmin = 0 
Gmin stepping succeeded in finding the operating point. 


Date: Sun Apr 19 15:19:26 2009 
Total elapsed time: 1.025 seconds. 

tnom = 27 
temp = 27 
method = modified trap 
totiter = 10704 
traniter = 9333 
tranpoints = 3730 
accept = 3074 
rejected = 656 
matrix size = 91 
fillins = 130 
solver = Normal 
Thread vector: 23.4/14.9[2] 8.3/6.4[2] 6.7/4.9[2] 3.4/3.4[1]  2592/500 
Matrix Compiler1: 8.84 KB object code size  7.3/4.7/[3.0] 
Matrix Compiler2: 9.40 KB object code size  4.9/8.8/[3.2] 
Personal tools