summaryrefslogtreecommitdiff
path: root/Linear_Integrated_Circuit_by_M._S._Sivakumar/Ch3.ipynb
blob: 7a4856f8a9bd167bf7c5715bb718d08da62c0e1a (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
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 3 Current Voltage Sources and Differential Amplifiers"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.1 Pg 53"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The  collector  current  of  difference  amplifier  Ic1 = Ic2 = 0.50  mA \n",
      "The collector voltages of transistors Q1 and Q2 are  Vc1 = Vc2 = 5.00  volt \n",
      "For Ve = -0.7 Volt  the  collector - emitter  voltage  Vce1  = 5.70  Volt\n",
      "For Ve = 4.3 Volt  the  collector - emitter  voltage  Vce1  = 0.70  Volt\n",
      "For Ve = -5.7 Volt  the  collector - emitter  voltage  Vce1  = 10.70  Volt\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "# Determine the collector current Ic1 and collector-emitter voltage Vce1 for the difference amplifier circuit\n",
    "\n",
    "V1 = 0 #    # volt\n",
    "V2 = -5 #   #volt\n",
    "Vcm =  5 #   #volt\n",
    "Vcc = 10#   #volt\n",
    "Vee = -10 #  #volt\n",
    "Ie =  1 #  #mA\n",
    "Rc =  10 #  #kilo ohm\n",
    "\n",
    "# Transistor parameters\n",
    "# base current are negligible\n",
    "Vbe = 0.7 #  # volt\n",
    "\n",
    "# The collector current of difference amplifier is\n",
    "Ic1 = Ie/2 # \n",
    "print 'The  collector  current  of  difference  amplifier  Ic1 = Ic2 = %0.2f'%Ic1,' mA '\n",
    "\n",
    "# The collector voltages of transistors Q1 and Q2 are expressed as\n",
    "\n",
    "Vc1  = Vcc-Ic1*Rc #\n",
    "print 'The collector voltages of transistors Q1 and Q2 are  Vc1 = Vc2 = %0.2f'%Vc1,' volt '\n",
    "\n",
    "# We know common mode voltage (Vcm) , from this the emitter voltage can be identified as follows\n",
    "# For the common mode voltage Vcm = 0 V , the emitter voltage is Ve = -0.7 V\n",
    "# For the common mode voltage Vcm = 5 V , the emitter voltage is Ve =  4.3 V\n",
    "# For the common mode voltage Vcm = -5 V , the emitter voltage is Ve = -5.7 V\n",
    "\n",
    "# For the different emitter voltages the collector-emitter voltage can be calculated as\n",
    "\n",
    "Ve = -0.7 #  # volt\n",
    "Vce1 = Vc1-Ve#\n",
    "print 'For Ve = -0.7 Volt  the  collector - emitter  voltage  Vce1  = %0.2f'%Vce1,' Volt'\n",
    "\n",
    "Ve = 4.3 #  # volt\n",
    "Vce1 = Vc1-Ve#\n",
    "print 'For Ve = 4.3 Volt  the  collector - emitter  voltage  Vce1  = %0.2f'%Vce1,' Volt'\n",
    "\n",
    "Ve = -5.7 #  # volt\n",
    "Vce1 = Vc1-Ve#\n",
    "print 'For Ve = -5.7 Volt  the  collector - emitter  voltage  Vce1  = %0.2f'%Vce1,' Volt'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.2 Pg 54"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " The differential mode gain Ad = 184.6\n",
      " The common mode gain Acm = -0.237\n"
     ]
    }
   ],
   "source": [
    "# To determine the difference-mode and common-mode gain of the difference amplifier\n",
    "\n",
    "Vcc = 10 # # volt\n",
    "Vee = -10 #  #volt\n",
    "Iq  =  0.8 #  #mA\n",
    "Ie  =  0.8 #  #mA\n",
    "Rc = 12 #  #kilo-Ohm\n",
    "Vt = 0.026 #  # volt\n",
    "\n",
    "# Transistor parameter\n",
    "beta = 100 #\n",
    "Rs = 0 #  #Ohm\n",
    "Ro = 25 #  #kilo-Ohm \n",
    "# The differential mode gain Ad\n",
    "gm = (Ie/ 2*Vt) #\n",
    "# Ad = (gm*r*Rc/r+Rc) #   # where r is r-pi\n",
    "# For Rb=0 , the differential mode gain is\n",
    "\n",
    "Ad = (Ie/(2*Vt))*Rc#\n",
    "#But\n",
    "print ' The differential mode gain Ad = %0.1f'%Ad\n",
    "\n",
    "#The common mode gain Acm\n",
    "# Acm = - (gm*Rc/1+2*gm*Re+2*Re/r)\n",
    "Acm =-(Ad/(1+(((1+beta)*Ie*Ro)/(beta*Vt))))\n",
    "print ' The common mode gain Acm = %0.3f'%Acm"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.3 Pg 56"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The output of a difference amplifier is  Vo  = -47.40 sinwt uV \n"
     ]
    }
   ],
   "source": [
    "# To find the output of a difference amplifier when only common mode signal is applied\n",
    "\n",
    "# V1 = V2 = Vcm = 200*sin(wt) #   # micro volt (uV)\n",
    "Acm  = -0.237 #\n",
    "\n",
    "# When the common mode input signal is applied to the difference amplifier , the difference mode gain is zero\n",
    "Vcm = 200 #\n",
    "Vo = Acm*Vcm #\n",
    "print 'The output of a difference amplifier is  Vo  = %0.2f'%Vo,'sinwt uV '  # multiply by sinwt because it is in Vcm"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.4 Pg 56"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The differential mode gain Ad = 184.6\n",
      "The common mode gain Acm = -0.237\n",
      "The CMRR of difference amplifier is = 389\n",
      "In decibel CMRR is = 51.80\n"
     ]
    }
   ],
   "source": [
    "from math import log10\n",
    "#Determine the common mode rejection ratio(CMRR) of the difference amplifier\n",
    "\n",
    "Vcc = 10 # # volt\n",
    "Vee = -10 #  #volt\n",
    "Iq  =  0.8 #  #mA\n",
    "Ie  =  0.8 #  #mA\n",
    "Rc = 12 #  #kilo-Ohm\n",
    "Vt = 0.026 #  # volt\n",
    "\n",
    "# Transistor parameter\n",
    "beta = 100 #\n",
    "Rs = 0 #  #Ohm\n",
    "Ro = 25 #  #kilo-Ohm\n",
    " \n",
    "# The differential mode gain Ad\n",
    "gm = (Ie/ 2*Vt) #\n",
    "# Ad = (gm*r*Rc/r+Rc) #   # where r is r-pi\n",
    "# For Rb=0 , the differential mode gain is\n",
    "\n",
    "Ad = (Ie/(2*Vt))*Rc#\n",
    "#But\n",
    "print 'The differential mode gain Ad = %0.1f'%Ad\n",
    "\n",
    "#The common mode gain Acm\n",
    "# Acm = - (gm*Rc/1+2*gm*Re+2*Re/r)\n",
    "Acm =-(Ad/(1+(((1+beta)*Ie*Ro)/(beta*Vt))))\n",
    "print 'The common mode gain Acm = %0.3f'%Acm\n",
    "\n",
    "# The CMRR of difference amplifier is given as\n",
    "Ad = Ad/2 #\n",
    "CMRR = abs(Ad/Acm)\n",
    "print 'The CMRR of difference amplifier is = %0.f'%CMRR\n",
    "\n",
    "# In decibel it can be expressed as\n",
    "CMRRdb = 20*log10(CMRR)\n",
    "print 'In decibel CMRR is = %0.2f'%CMRRdb"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.5 Pg 58"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " The CMRR of difference amplifier is = 3.16e+04\n",
      " The value of resistance RE is = 2.04  Mohm \n"
     ]
    }
   ],
   "source": [
    "# To determine emitter resistance of the difference amplifier\n",
    "\n",
    "Vcc = 10 # # volt\n",
    "Vee = -10 #  #volt\n",
    "Iq  =  0.8 #  #mA\n",
    "Ie  =  0.8 #  #mA\n",
    "CMRRdb = 90 #  #dB\n",
    "Vt = 0.026 #\n",
    "\n",
    "# Transistor parameter\n",
    "beta = 100 #\n",
    "\n",
    "# CMRR = abs(Ad/Acm)\n",
    "# the CMRR of the difference amplifier is defined as\n",
    "#CMRR = ((1/2)*(1+((1+beta)*Ie*Re)/beta*Vt))\n",
    "\n",
    "# CMRRdb = 20*log10(CMRR)\n",
    "CMRR = 10**(CMRRdb/20)\n",
    "print ' The CMRR of difference amplifier is = %0.2e'%CMRR\n",
    "\n",
    "# The resistance RE is calculated as\n",
    "\n",
    "RE = (((2*CMRR)-1)/((1+beta)*Ie))*(beta*Vt)/1e3\n",
    "print ' The value of resistance RE is = %0.2f'%RE,' Mohm '"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.6 Pg 59"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " The differential mode gain Ad is = 321\n"
     ]
    }
   ],
   "source": [
    "# determine the differential mode gain when load resistance RL = 100 k ohm\n",
    "\n",
    "RL = 100*10**3 # # k ohm  # load resistance\n",
    "IE = 0.20*10**-3 # # mA  # biasing current\n",
    "VA = 100 # # V # early voltage\n",
    "VT = 0.026 #  # threshold volt\n",
    "\n",
    "# the differential gain of differential amplifier with an active load circuit\n",
    "#Ad = Vo/Vd  = gm(ro2 || ro4 || RL  )\n",
    "ro2 = (2*VA)/IE#\n",
    "ro4 = ro2 #\n",
    "gm = IE/(2*VT) #\n",
    "\n",
    "Ad = gm/((1/ro2)+(1/ro4)+(1/RL))\n",
    "print ' The differential mode gain Ad is = %0.f'%Ad"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}