summaryrefslogtreecommitdiff
path: root/Electronic_Instrumentation_and_Measurements/Chapter11_2.ipynb
blob: 75895112ad25919e3f483bda9de850f13e574ddc (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
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# CHAPTER 11: SIGNAL GENERATORS"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 11-1, Page Number: 317"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Mimimum frequency f(min)= 106.0 Hz\n",
      "Maximum frequency f(max)= 1.06 kHz\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#Variable Declaration\n",
    "R1min=500          #Minimum Value of R1(ohm)\n",
    "R1max=5*10**3      #Maximum Value of R1(ohm)\n",
    "C=300*10**-9       #in farad(C=C1=C2) \n",
    "\n",
    "#Calculation\n",
    "#Using the formula f=1/2*pi*R*C for Wein bridge oscillator\n",
    "\n",
    "fmin=1/(2*math.pi*C*R1max)   #Minimum frequency occurs when R1 is maximum(Hz)\n",
    "fmax=1/(2*math.pi*C*R1min)   #Maximum frequency occurs when R1 is minimum(Hz)\n",
    "\n",
    "print \"Mimimum frequency f(min)=\",round(fmin),\"Hz\"\n",
    "print \"Maximum frequency f(max)=\",round(fmax/1000,2),\"kHz\"\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 11-2, Page Number: 319"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "R3= 1.0 kilo ohm\n",
      "R1+R2= 49.0 kilo ohm\n",
      "R1= 4.0 kilo ohm\n",
      "R2= 45.0 kilo ohm\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#Variable Declaration\n",
    "\n",
    "Vi=5                        #Input voltage(V)\n",
    "Ib=500*10**-9               #Bias Current(A)\n",
    "\n",
    "#Calculation\n",
    "#With R1 and R2 in the circuit\n",
    "Vr3=0.1                     #As range is 0-0.1V\n",
    "Vr=Vi-Vr3                   #KVL\n",
    "\n",
    "I3=100*10**-6               #Since I3>>Ib, assume I3=100micro ampere\n",
    "R3=Vr3/I3                   #Ohm's Law \n",
    "Rr=Vr/I3                    #Ohm's Law. Rr is equivalent series resistance. Rr=R1+R2\n",
    "\n",
    "print \"R3=\",round(R3*10**-3),\"kilo ohm\"\n",
    "print \"R1+R2=\",round(Rr*10**-3),\"kilo ohm\"\n",
    "\n",
    "\n",
    "#With R2 swithed out of the circuit\n",
    "Vr3=1                       #Range 0-1V\n",
    "I3=Vr3/R3                   #Ohm's Law \n",
    "Vr1=Vi-Vr3                  #KVL\n",
    "R1=Vr1/I3                   #Ohm's Law\n",
    "R2=Rr-R1                    #Rr is equivalent series resistance                       \n",
    "print \"R1=\",R1*10**-3,\"kilo ohm\"\n",
    "print \"R2=\",R2*10**-3,\"kilo ohm\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 11-3, Page Number: 326"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "For contact at top of R1,\n",
      "f= 1.17 kHz\n",
      "\n",
      "For R1 contact at 10% from bottom,\n",
      "f= 117.0 Hz\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#Variable Declaration\n",
    "C1=0.1*10**-6                  #in farad    \n",
    "R1=1*10**3                     #in ohm\n",
    "R2=10*10**3                    #in ohm \n",
    "UTP=3.0                        #in V\n",
    "LTP=-3.0                       #in V\n",
    "Vcc=15.0                       #in V\n",
    "\n",
    "#Calculation\n",
    "\n",
    "V3=Vcc-1                       #Op-amp saturation voltage is approximately one less than Vcc\n",
    "\n",
    "#For contact at top of R1\n",
    "V1=V3                          \n",
    "I2=V1/R2\n",
    "dV=UTP-LTP\n",
    "t=C1*dV/I2                     #Using equation for a capacitor charging linearly\n",
    "f=1/(2*t)\n",
    "\n",
    "print \"For contact at top of R1,\"\n",
    "print \"f=\",round(f*10**-3,2),\"kHz\"\n",
    "\n",
    "#For R1 at 10% from bottom\n",
    "\n",
    "V1=0.1*V3\n",
    "I2=V1/R2\n",
    "t=C1* dV/I2                    #Using equation for a capacitor charging linearly\n",
    "f=1/(2*t)\n",
    "\n",
    "print \n",
    "print \"For R1 contact at 10% from bottom,\"\n",
    "print \"f=\",round(f),\"Hz\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 11-4, Page Number: 332"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "t= 4.13 ms\n",
      "The frequency of the sqaure wave output is  121.0 Hz\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#Variable Declaration\n",
    "R1=20*10**3             #in ohm\n",
    "R2=6.2*10**3            #in ohm\n",
    "R3=5.6*10**3            #in ohm\n",
    "C1=0.2*10**-6           #in farad\n",
    "Vcc=12.0                #in volt\n",
    "\n",
    "#Calculation\n",
    "\n",
    "Vo=Vcc-1                 #Op-amp saturation voltage is approximately one less than Vcc\n",
    "\n",
    "UTP=Vo*R3/(R3+R2)        #Upper Threshold Voltage\n",
    "LTP=-UTP                 #Lower Threshold voltage              \n",
    " \n",
    "t=C1*R1*math.log((Vo-LTP)/(Vo-UTP))    #Equation to find pulse width for astable multivibrator\n",
    "f=1/(2*t)                               \n",
    "\n",
    "#Results\n",
    "print \"t=\",round(t*10**3,2),\"ms\"\n",
    "print \"The frequency of the sqaure wave output is \",round(f),\"Hz\"\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 11-5, Page Number: 334"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Pulse width(PW)= 289.0 micro second\n",
      "For Pw=6ms, C2 should be 0.2 micro farad\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#Variable Declaration\n",
    "\n",
    "Vcc=10\n",
    "Vb=1\n",
    "R1=22*10**3\n",
    "R2=10*10**3\n",
    "C1=100*10**-12\n",
    "C2=0.01*10**-6\n",
    "\n",
    "#Calculation\n",
    "Vo_plus=Vcc-1\n",
    "Vo_minus=-(Vcc-1)\n",
    "\n",
    "PW=C2*R2*math.log((Vo_plus-Vo_minus)/Vb)\n",
    "print \"Pulse width(PW)=\",round(PW*10**6),\"micro second\"\n",
    "\n",
    "#When Pw=6ms, C2 is found as follows\n",
    "PW=6*10**-3\n",
    "C2=PW/(R2*math.log((Vo_plus-Vo_minus)/Vb))\n",
    "\n",
    "print \"For Pw=6ms, C2 should be\",round(C2*10**6,1),\"micro farad\"\n"
   ]
  }
 ],
 "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
}