summaryrefslogtreecommitdiff
path: root/Electronic_devices_and_circuits_by_I.J_Nagrath/Chapter2.ipynb
blob: 4eb7e1366da011578fb3201b4784715b8c4e9cc6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
{
 "metadata": {
  "name": "",
  "signature": "sha256:7b8ef11e11019a3b1cc284475151e0d8bb5d6632f9c468e0f90289ce47134c38"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "                                   Chapter 2: TRANSISTORS AND OTHER DEVICES"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.1,Page number 89"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "Rb=200                  #base resistance(ohm)\n",
      "Vbe=0.7                 #base emitter voltage drop(V) in active region          \n",
      "Vbb=5                   #base voltage of bipolar transistor(V) \n",
      "beeta=100               #current gain\n",
      "Rc=3                    #collector resistance(k ohms)\n",
      "Vcc=10                  #voltage given to the collector(V)\n",
      "\n",
      "#Calculations\n",
      "Ib=(Vbb-Vbe)/Rb           #base current(mA)  \n",
      "Ic=beeta*Ib               #collector current(mA) \n",
      "Vcb=-Vbe-(Rc*Ic)+Vcc      #collector base voltage drop(V)\n",
      "\n",
      "#Results\n",
      "print\"base current\",Ib,\"mA\" \n",
      "print\"collector current\",Ic,\"mA\"\n",
      "print\"reverse bias collector junction is\",Vcb,\"V\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "base current 0.0215 mA\n",
        "collector current 2.15 mA\n",
        "reverse bias collector junction is 2.85 V\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.2,Page number 90"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "Vbb=5               #base voltage of bipolar transistor(V)\n",
      "Vbe=0.7             #base emitter voltage drop(V) in active region  \n",
      "Rb=150              #base resistance(ohm)\n",
      "beeta=125           #curret gain     \n",
      "Rc=3                #collector resistance(k ohms)  \n",
      "Vcc=10              #supply voltage(V)\n",
      "Vce=0.2             #collector to emitter voltage(V)\n",
      "\n",
      "#Calculations\n",
      "#Part a\n",
      "Ib=(Vbb-Vbe)/Rb       #base current(mA)\n",
      "Ic=beeta*Ib           #collector current(mA)\n",
      "Vcb=-Vbe-(Rc*Ic)+Vcc  #collector base voltage drop(V)\n",
      "\n",
      "#Part b -for npn transistor\n",
      "Vbe=0.8             #base emitter voltage drop(V) in saturation\n",
      "Ic=(Vcc-Vce)/Rc     #collector current(mA)\n",
      "Ib=(Vbb-Vbe)/Rb     #base current(mA)\n",
      "Ibmin=Ic/beeta      #minimum base current(mA) to go into saturation(mA)\n",
      "\n",
      "#Results\n",
      "print\"In active region, base current is\",round(Ib/1E-3),\"*10**-3 mA and collector current is\",round(Ic,2),\"mA\" \n",
      "print\"base current and collector current in npn are\",round((Ib/1E-3),2),\"*10**-3 mA\",\"and\",round(Ic,2),\"mA resp.\"\n",
      "print\"base current minimum is\",round(Ibmin,3),\"mA\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "In active region, base current is 28.0 *10**-3 mA and collector current is 3.27 mA\n",
        "base current and collector current in npn are 28.0 *10**-3 mA and 3.27 mA resp.\n",
        "base current minimum is 0.026 mA\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.3,Page number 91"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "Vbb=5                 #base voltage of bipolar transistor(V)\n",
      "Vbe=0.7               #base emitter voltage drop(V) in active region  \n",
      "Rb=50                 #base resistance(ohm)\n",
      "beeta=50              #current gain\n",
      "Re=1.8                #emitter resistance(k ohms)    \n",
      "Vcc=10                #supply voltage(V)\n",
      "Vce=0.2               #collector to emitter voltage(V)\n",
      "\n",
      "#Calculations\n",
      "Ib=(Vbb-Vbe)/(Rb+Re*(beeta+1))      #base current(mA)\n",
      "Ic=beeta*Ib                         #collector current(mA)\n",
      "Ie=Ib+Ic                            #emitter current(mA)\n",
      "\n",
      "#Results\n",
      "print\"values are Ib:\",round(Ib,2),\"mA,Ic:\",round(Ic,2),\"mA and Ie:\",round(Ie,2),\"mA\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "values are Ib: 0.03 mA,Ic: 1.52 mA and Ie: 1.55 mA\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.4,Page number 91"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "Vbe=0.7                      #base to emitter voltage(V)\n",
      "Rb=250                       #base resistance(k ohms)\n",
      "Vcc=10                       #supply voltage(V)\n",
      "Rl=0.5                       #load resistance(k ohms)\n",
      "\n",
      "#Calculations\n",
      "Ic=Vcc/Rl                    #collector current(mA)\n",
      "IbQ=(Vcc-Vbe)/Rb             #Ib at operating point(uA)\n",
      "IcQ=8                        #Ic at operating point(mA)\n",
      "VceQ=6                       #Vce at operating point(V)\n",
      "\n",
      "#Results\n",
      "print\"values are IbQ:\",IbQ,\"uA,IcQ:\",IcQ,\"mA and Vcc:\",Vcc,\"V\"\n",
      "print\"collector current Ic is\",Ic,\"mA and output voltage,vL=6-2 sinwt V\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "values are IbQ: 0.0372 uA,IcQ: 8 mA and Vcc: 10 V\n",
        "collector current Ic is 20.0 mA and output voltage,vL=6-2 sinwt V\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.5,Page number 104"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "Vgs=12                   #gate to source voltage(V)\n",
      "Vt=4                     #threshold voltage(V)\n",
      "Id=12.8                  #drain current(mA)\n",
      "K=0.0002                 #device parameter \n",
      "Vdd=24                   #drain voltage(V)\n",
      "Vds=Vgs=8                #drain to source voltage(V)      \n",
      "\n",
      "#Calculations\n",
      "Id=K*((Vds-Vt)**2)       #drain current at Vds=8V\n",
      "Rd=(Vdd-Vds)/Id          #drain resistance(k ohms)\n",
      "\n",
      "#Result\n",
      "print\"diode resistance is\",Rd,\"ohms\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "diode resistance is 5000.0 ohms\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.7,Page number 106"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "Vds=7.5                #drain to source voltage(V)\n",
      "Id=5                   #drain current(mA)      \n",
      "\n",
      "#Calculations\n",
      "Vgs=-1.5               #gate to source voltage(V)\n",
      "Vgg=-Vgs               #gate voltage=gate to source voltage(V) \n",
      "\n",
      "#Result\n",
      "print\"gate voltage is\",Vgg,\"V\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "gate voltage is 1.5 V\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.8,Page number 107"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "Vds=7.5                  #drain to source voltage(V)\n",
      "Idss=8.                  #drain current for Vgs(V)\n",
      "Vgs=2.                   #gate to source voltage(V)\n",
      "Vp=4.                    #peak voltage(V)\n",
      "\n",
      "#Calculations\n",
      "Id=Idss*((Vp-Vgs)/Vp)**2  #drain current(mA)\n",
      "\n",
      "#Result\n",
      "print\"diode current is\",Id,\"mA\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "diode current is 2.0 mA\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.10,Page number 115"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "beeta=160               #current gain\n",
      "Vee=10                  #emitter voltage(V)\n",
      "Rb=400                  #base resistance(k ohms)\n",
      "Veb=0.8                 #emitter to base voltage(V)\n",
      "Re=2.5                  #emitter resistance(k ohms)\n",
      "Rc=1.5                  #collector resistance(k ohms)   \n",
      "\n",
      "#Calculations\n",
      "#Part a \n",
      "Ib=(Vee-Veb)/((Re*(1+beeta))+Rb)    #base current(uA)\n",
      "Ic=beeta*Ib                         #collector current(mA)\n",
      "Ie=(beeta+1)*Ib                     #emitter current(mA) \n",
      "Vce=Vee-(Re*Ie)-(Rc*Ic)             #emitter to collector voltage(V)   \n",
      "Vce=-Vce                            #collector to emitter voltage(V)\n",
      "\n",
      "#Part b\n",
      "beeta=80                            #current gain \n",
      "Ib1=(Vee-Veb)/((Re*(1+beeta))+Rb)   #base current(uA)\n",
      "Ic1=beeta*Ib1                       #collector current(mA)\n",
      "Ie1=(beeta+1)*Ib1                   #emitter current(mA)   \n",
      "Vce1=-(Vee-(Ie1*Re)-(Rc*Ic1))       #collector to emitter voltage(V)   \n",
      "                      \n",
      "#Result\n",
      "print\"collector current and Vce for beeta=160 are\",round(Ic,2),\"mA\",\"and\",round(Vce,2),\"V\" \n",
      "print\"Ic and Vce for beeta=80 are\",round(Ic,2),\"mA\",\"and\",round(Vce1,2),\"V\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "collector current and Vce for beeta=160 are 1.83 mA and -2.63 V\n",
        "Ic and Vce for beeta=80 are 1.83 mA and -5.08 V\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.13,Page number 120"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from sympy import*\n",
      "import math \n",
      "\n",
      "#Variable declaration\n",
      "K=2                      #device parameter\n",
      "Rd=Rs=2.5*10**3          #drain resistance(k ohms)\n",
      "R1=100*10**3             #resistance(ohms)\n",
      "R2=200*10**3             #resistance(ohms)\n",
      "Vdd=12                   #drain voltage(V)\n",
      "Vt=4                     #threshold voltage(V)\n",
      "\n",
      "#Calculations\n",
      "Vgg=(R2*Vdd)/(R1+R2)\n",
      "Id=symbols('Id')                         #gate voltage(V)\n",
      "expr=solve(Id**2-3.28*Id+2.56,Id)\n",
      "print expr\n",
      "Id=1.28\n",
      "Vds=Vdd-5*Id\n",
      "\n",
      "#Result\n",
      "print\"Id is\",Id,\"mA and Vds is\",Vds,\"V\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "[1.28000000000000, 2.00000000000000]\n",
        "Id is 1.28 mA and Vds is 5.6 V\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.14,Page number 121"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "k=2.                       #device parameter\n",
      "Vt=-1.                     #threshold voltage(V)\n",
      "Vdd=-12.                   #drain voltage(V)\n",
      "R1=300.                    #resistance(kohms)\n",
      "R2=100.                    #resistance(kohms)\n",
      "\n",
      "#Calculations\n",
      "#Part a\n",
      "Vgs=-2                  #gate to source voltage(V)\n",
      "Vgg=(R2*Vdd)/(R1+R2)    #gate voltage(V)\n",
      "Id=k*((Vgs-Vt)**2)      #drain current(mA)\n",
      "Rs=(Vgs-Vgg)/Id         #source resistance(k ohms) as Id=Is,Kvl in GS loop\n",
      "Is=Id\n",
      "\n",
      "#Part b\n",
      "Vds=-4                    #drain to source voltage(V)\n",
      "Rd=(-Vdd+Vds-(Is*Rs))/Id  #applying kvl in DS loop\n",
      "\n",
      "#Part c \n",
      "Vt=-1.5                      #threshold voltage(V)             \n",
      "Vgg=-1.5                     #gate voltage using Id formula    \n",
      "R2new=(Vgg*R1)/(Vdd-Vgg)     #new resistance(k ohms)\n",
      "\n",
      "#Results\n",
      "print\"a)source resistance is\",Rs,\"kohm\" \n",
      "print\"b)drain resistance is\",Rd,\"kohm\"\n",
      "print\"c)R2new is\",round(R2new,2),\"kohm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "a)source resistance is 0.5 kohm\n",
        "b)drain resistance is 3.5 kohm\n",
        "c)R2new is 42.86 kohm\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.15,Page number 122"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "Vp=-4                    #peak voltage(V)\n",
      "Idss=10                  #drain current for Vgs(V)\n",
      "Vdd=18                   #drain voltage(V)   \n",
      "Rs=2               #source resistance(ohms) \n",
      "Rd=2               #drain resistance(ohms)\n",
      "R1=450*10**3             #resistance(ohms)\n",
      "R2=90*10**3              #resistance(ohms)\n",
      "\n",
      "#Calculations\n",
      "Vgg=(R2*Vdd)/(R1+R2)\n",
      "from sympy import*\n",
      "Id=symbols('Id')\n",
      "expr=solve(20*Id**2-148*Id+245,Id)\n",
      "print expr\n",
      "Id1=2.5\n",
      "Vds=Vdd-((Rs+Rd)*Id1)\n",
      "\n",
      "#Result\n",
      "print\"Id is\",Id1,\"mA and Vds is\",Vds,\"V\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "[5/2, 49/10]\n",
        "Id is 2.5 mA and Vds is 8.0 V\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.16,Page number 123"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "Vp=4                    #peak voltage(V)\n",
      "Idss=12.                #drain current for Vgs(V) \n",
      "Vdd=12                  #drain voltage(V)\n",
      "Id=4.                   #drain current(mA)\n",
      "Vds=6                   #drain to source voltage(V)\n",
      "\n",
      "#Calculations\n",
      "Rs=(Vp/4)*(1-(math.sqrt(Id/Idss)))      #by Id=Idss(1-(Vgs/Vp))^2 and putting Vgs=4Rs in it and solving\n",
      "Rd=((Vdd+Vds)/Id)-Rs                    #solving equation -Vdd-Vds+(Id*(Rd+Rs))=0      \n",
      "                                             \n",
      "#Result\n",
      "print\"source resistance is\",round(Rs,2),\"kohm\" \n",
      "print\"drain resistance\",round(Rd,2),\"kohms\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "source resistance is 0.42 kohm\n",
        "drain resistance 4.08 kohms\n"
       ]
      }
     ],
     "prompt_number": 3
    }
   ],
   "metadata": {}
  }
 ]
}