{ "metadata": { "name": "", "signature": "sha256:7063e92d4f64e517cc0dbce51d65911cbb3639cdb52d68efbfa4c03a57d713df" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter6 - Oscillators and waveform generators" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex 6.1 - page 170" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from __future__ import division\n", "from math import pi, sqrt, ceil\n", "f0=600 #Hz#Oscillating Frequency\n", "print \"Various design parameters are :-\"\n", "C=0.05 #micro F#Chosen for the design\n", "print \"Capacitance = %0.2f micro F\" %C\n", "R=1/(2*pi*f0*sqrt(6)*C*10**-6) #ohm\n", "R=R/1000 #kohm\n", "print \"Resistance R = %0.1f kohm\" %R\n", "#To avoid loading effect\n", "Ri=10*R #kohm#Ri>=10*R\n", "Ri=ceil(Ri) #kohm\n", "print \"Resistance Ri = %0.1f kohm\" % Ri\n", "Rf=29*Ri #kohm#Rf>=29*Ri\n", "print \"Resistance Rf = %0.1f kohm\" %Rf\n", "Rf=640 #kohm\n", "#Balancing the circuit\n", "Rom=Rf*Ri/(Rf+Ri) #kohm\n", "Rom=ceil(Rom) #kohm\n", "print \"Resistance Rom = %0.1f kohm\" %Rom" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Various design parameters are :-\n", "Capacitance = 0.05 micro F\n", "Resistance R = 2.2 kohm\n", "Resistance Ri = 22.0 kohm\n", "Resistance Rf = 638.0 kohm\n", "Resistance Rom = 22.0 kohm\n" ] } ], "prompt_number": 3 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex 6.3 - page 181" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from __future__ import division\n", "from math import pi\n", "f0=12 #kHz#Oscillating Frequency\n", "print \"Various design parameters are :-\"\n", "C=0.01 #micro F#Chosen for the design between 0.01 & 1 micro F\n", "print \"Capacitance = %0.2f micro F \" % C\n", "R=1/(2*pi*f0*1000*C*10**-6) #ohm\n", "R=R/1000 #kohm\n", "print \"Resistance R = %0.1f kohm\" %R\n", "Ri=3*R/2 #kohm#Ri>=3*R/2\n", "print \"Resistance Ri = %0.2f kohm\" %Ri\n", "Ri=2.2 #kohm\n", "Rf=2*Ri #kohm\n", "print \"Resistance Rf = %.1f kohm\" %Rf" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Various design parameters are :-\n", "Capacitance = 0.01 micro F \n", "Resistance R = 1.3 kohm\n", "Resistance Ri = 1.99 kohm\n", "Resistance Rf = 4.4 kohm\n" ] } ], "prompt_number": 6 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex 6.5 - page 184" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from __future__ import division\n", "from math import pi\n", "f0=2 #kHz#Oscillating Frequency\n", "print \"Various design parameters are :-\"\n", "C=0.05 #micro F#Chosen for the design\n", "print \"Capacitance = %0.2f micro F \" %C\n", "R=1/(2*pi*f0*1000*C*10**-6) #ohm\n", "R=R/1000 #kohm\n", "print \"Resistance R = %0.1f kohm \" %R \n", "Ri=3*R/2 #kohm#Ri>=3*R/2\n", "print \"Resistance Ri = %0.1f kohm \" %Ri \n", "Rf=2*Ri #kohm\n", "print \"Resistance Rf = %0.1f kohm \" %Rf " ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Various design parameters are :-\n", "Capacitance = 0.05 micro F \n", "Resistance R = 1.6 kohm \n", "Resistance Ri = 2.4 kohm \n", "Resistance Rf = 4.8 kohm \n" ] } ], "prompt_number": 10 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex 6.6 - page : 184" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from __future__ import division\n", "from math import pi\n", "#Data given\n", "R1=1 #kohm\n", "R2=1 #kohm\n", "R=1 #kohm\n", "C=4.7 #micro F\n", "f0=1/(2*pi*R*10**3*C*10**-6) #Hz#Oscillating Frequency\n", "print \"Oscillation frequency = %0.2f Hz \" %f0 " ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Oscillation frequency = 33.86 Hz \n" ] } ], "prompt_number": 12 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex 6.7 - page : 188" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from __future__ import division\n", "f0=200 #Hz#Oscillating Frequency\n", "print \"Various design parameters are :-\" \n", "C=0.05 #micro F#Chosen for the design\n", "print \"Capacitance = %0.2f micro F \" %C \n", "R=0.159/(f0*C*10**-6) #ohm\n", "R=R/1000 #kohm\n", "print \"Resistance R = %0.1f kohm \" %R \n", "R=510 #kohm\n", "C1=C;C2=C;C3=C #micro F\n", "print \"Capacitance C1 = C2 = C3 = %0.2f micro F \" %(C3) \n", "R2=R;R3=R #kohm\n", "print \"Resistance R2 = %0.1f kohm, R3 = %0.1f kohm \" %(R3,R2)\n", "#Answer for R is calculated wrong in the textbook." ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Various design parameters are :-\n", "Capacitance = 0.05 micro F \n", "Resistance R = 15.9 kohm \n", "Capacitance C1 = C2 = C3 = 0.05 micro F \n", "Resistance R2 = 510.0 kohm, R3 = 510.0 kohm \n" ] } ], "prompt_number": 19 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex 6.8 - page : 189" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from __future__ import division\n", "Rf=570 #kohm\n", "Ri=15 #kohm\n", "A=Rf/Ri #Gain of the circuit\n", "Amin=29 #Minimum Gain requirement of RC phase shift oscillator\n", "deltaA=(A-Amin)/Amin*100 #%(Exceeding Gain)\n", "print \"Gain is exceeded by %0.f %% \" %deltaA " ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Gain is exceeded by 31 % \n" ] } ], "prompt_number": 21 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex 6.9 - page : 192" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from __future__ import division\n", "from math import pi, sqrt\n", "print \"Part (a)\"\n", "L1=25 #micro H\n", "L2=10 #micro H\n", "Rf=22 #kohm\n", "C=0.01 #micro F\n", "LT=L1+L2 #micro H\n", "fr=1/(2*pi*sqrt(C*10**-6*LT*10**-6)) #Hz\n", "fr=fr/1000 #kHz\n", "f0=fr #/kHz\n", "print \"Oscillation frequency = %0.1f kHz \" %f0 \n", "Ri=Rf/(L1/L2) #kohm\n", "print \"Resistance Ri = %0.1f kohm \" %Ri \n", "print \"Part (b)\"\n", "C1=220 #pF\n", "C2=680 #pF\n", "Rf=22 #kohm\n", "L=1 #mH\n", "CT=C1*C2/(C1+C2) #pF\n", "fr=1/(2*pi*sqrt(L*10**-3*CT*10**-12)) #Hz\n", "fr=fr/1000 #kHz\n", "f0=fr #/kHz\n", "f0=round(f0) #kHz\n", "print \"Oscillation frequency = %0.1f kHz \" %f0\n", "Ri=Rf/(C1/C2) #kohm\n", "print \"Resistance Ri = %0.1f kohm \" %Ri" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Part (a)\n", "Oscillation frequency = 269.0 kHz \n", "Resistance Ri = 8.8 kohm \n", "Part (b)\n", "Oscillation frequency = 390.0 kHz \n", "Resistance Ri = 68.0 kohm \n" ] } ], "prompt_number": 23 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex 6.10 - page : 198" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from __future__ import division\n", "f0=1 #/kHz\n", "Vsat=14 #V\n", "print \"Various design parameters are :-\"\n", "C1=0.05 #micro F#Chosen for the design\n", "print \"Capacitance = %0.2f micro F \" %C1\n", "Rf=1/(2*f0*10**3*C1*10**-6)/1000 #kohm\n", "print \"Resistance Rf = %0.1f kohm \" %Rf \n", "#R2=0.86*R1 and Rf=R1||R2\n", "R2byR1=0.86 #from R2=0.86*R1 \n", "R2=Rf*(1+R2byR1) #kohm\n", "R1=R2/R2byR1 #kohm\n", "print \"Resistance R1 = %0.1f kohm \" %R1 \n", "print \"Resistance R2 = %0.1f kohm \" %R2 " ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Various design parameters are :-\n", "Capacitance = 0.05 micro F \n", "Resistance Rf = 10.0 kohm \n", "Resistance R1 = 21.6 kohm \n", "Resistance R2 = 18.6 kohm \n" ] } ], "prompt_number": 26 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex 6.11 - page 199" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from __future__ import division \n", "from math import log\n", "T=10 #ms#(Time period)\n", "f0=1/(T*10**-3) #Hz\n", "C=0.05 #micro F#Chosen for the design\n", "#Formula : f0=1/{2*Rf*C*log(1+2*R2/R1)}\n", "Rf=1/(f0*2*C*10**-6*log(1+2))/1000 #kohm#By putting R1=R2 for this case\n", "Rf=round(Rf) #kohm\n", "print \"Resistance Rf = %0.1f kohm \" %Rf \n", "print \"Capacitance for the design is %0.2f micro F \" %C " ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Resistance Rf = 91.0 kohm \n", "Capacitance for the design is 0.05 micro F \n" ] } ], "prompt_number": 28 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex 6.12 - page : 200" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from __future__ import division \n", "from math import log\n", "R1=4.7 #kohm\n", "R2=3.3 #kohm\n", "Rf=2 #kohm\n", "C=0.1 #micro F\n", "f0=1/2/(Rf*1000)/(C*10**-6)/log(1+2*R2/R1)/1000 #kHz\n", "print \"Frequency of output signal is %0.2f kHz \" %f0 " ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Frequency of output signal is 2.85 kHz \n" ] } ], "prompt_number": 30 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex 6.13 - page : 204" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from __future__ import division \n", "f0=1.5 #kHz\n", "Vout=6 #V##peak to peak\n", "Vsat=13.5 #V\n", "print \"Various design parameters are : \"\n", "R2=10 #kohm#/choosen for the design\n", "R1=R2*2*Vsat/Vout #kohm\n", "print \"R1 = %0.2f kohm \" %R1 \n", "print \"R2 = %0.2f kohm \" %R2 \n", "#Let Cf=0.05 micro F for the design\n", "Cf=0.05 #micro F\n", "print \"Cf = %0.2f micro F \" %Cf \n", "Ri=R1*1000/(f0*1000)/4/(Cf*10**-6*R2*1000)/1000 #kohm\n", "print \"Ri = %0.2f kohm \" %Ri " ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Various design parameters are : \n", "R1 = 45.00 kohm \n", "R2 = 10.00 kohm \n", "Cf = 0.05 micro F \n", "Ri = 15.00 kohm \n" ] } ], "prompt_number": 32 }, { "cell_type": "code", "collapsed": false, "input": [ "#Ex 6.14\n", "from __future__ import division \n", "#Data given\n", "R1=6.8 #kohm\n", "Ri=100 #kohm\n", "R2=1.5 #kohm\n", "Cf=0.01 #micro F\n", "Vsat=14 #V\n", "Vo_pp=2*R2/R1*Vsat #V##Peak to peak output of triangular wave\n", "print \"Peak to peak output of triangular wave is %0.1f V \" %Vo_pp\n", "f0=R1*1000/(4*Ri*10**3*Cf*10**-6*R2*10**3)/1000 #kHz#Oscillating Frequency\n", "print \"Oscillation frequency is %0.2f Hz\" %f0" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Peak to peak output of triangular wave is 6.2 V \n", "Oscillation frequency is 1.13 Hz\n" ] } ], "prompt_number": 34 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex 6.15 - page : 205" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from __future__ import division \n", "#Data given\n", "f0=1 #kHz\n", "Vo_pp=7 #V\n", "Vsat=14 #V\n", "print \"Various design parameters are :-\"\n", "#Let R2=10 #kohm for the design\n", "R2=10 #kohm\n", "R1=2*R2*Vsat/Vo_pp #kohm\n", "print \"R1 = %0.2f kohm \" %R1 \n", "print \"R2 = %0.2f kohm \" %R2 \n", "#Choose Cf=0.1 micro F for the design\n", "Cf=0.1 #micro F\n", "print \"Cf = %0.2f micro F \" %Cf \n", "Ri=R1*10**3/(4*f0*10**3*Cf*10**-6*R2*10**3)/1000 #kohm\n", "print \"Ri = %0.2f kohm \" %Ri " ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Various design parameters are :-\n", "R1 = 40.00 kohm \n", "R2 = 10.00 kohm \n", "Cf = 0.10 micro F \n", "Ri = 10.00 kohm \n" ] } ], "prompt_number": 35 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex 6.16 - page : 208" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from __future__ import division \n", "from math import log\n", "#Data given\n", "tau=1 #ms(time period)\n", "R1byR2_min=1.8 # min R1/R2\n", "R1byR2_max=9 # max R1/R2\n", "Beta_min=1/(1+R1byR2_min) #minimum value of Beta\n", "Beta_max=1/(1+R1byR2_max) #maximum value of Beta\n", "Tmax=2*tau*log((1+Beta_min)/(1-Beta_min)) #ms##For minimum value of Beta\n", "fmin=1/(Tmax*10**-3) #Hz\n", "Tmin=2*tau*log((1+Beta_max)/(1-Beta_max)) #ms##For maximum value of Beta\n", "fmax=1/(Tmin*10**-3)/1000 #kHz\n", "print \"Frequency range is %d Hz to %0.1f kHz.\" %(fmin, fmax)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Frequency range is 669 Hz to 2.5 kHz.\n" ] } ], "prompt_number": 40 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex 6.17 : page 211" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from __future__ import division \n", "from math import sqrt, pi\n", "#Data given\n", "Ls=3 #H\n", "Cs=0.05 #pF\n", "Rs=2 #kohm\n", "Cm=10 #pF\n", "fS=1/2/pi/sqrt(Ls*Cs*10**-12)/1000 #kHz\n", "print \"Series resonant frequency is %0.f kHz \" %fS \n", "CT=Cm*Cs/(Cm+Cs) #pF##Equivalent capacitance\n", "fP=1/2/pi/sqrt(Ls*CT*10**-12)/1000 #kHz\n", "print \"Parallel resonant frequency is %0.f kHz \" %fP " ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Series resonant frequency is 411 kHz \n", "Parallel resonant frequency is 412 kHz \n" ] } ], "prompt_number": 42 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex 6.18 - page : 220" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from __future__ import division \n", "#Data given\n", "f0=5 #kHz\n", "D=60 #%##duty cycle\n", "VCC=12 #V\n", "#As D=t1/(t1+t2)\n", "t2BYt1=1/(D/100)-1 #ratio of t1 & t2\n", "#RB/(2*RA-RB)=t2/t1\n", "RAbyRB=(1/t2BYt1+1)/2 #Ratio of RA & RB\n", "print \"Various design parameters are :\"\n", "#Let CT=0.05 micro F for this design choosing between 0.01 & 1 microo F\n", "CT=0.05 #micro F\n", "print \"CT = %0.2f micro F \" %CT \n", "RA=1/(f0*10**3)/(5/3)**2/(CT*10**-6)/1000 #kohm\n", "print \"RA = %0.2f kohm \" %RA\n", "RB=RA/RAbyRB #kohm\n", "print \"RB = %0.2f kohm \" %RB" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Various design parameters are :\n", "CT = 0.05 micro F \n", "RA = 1.44 kohm \n", "RB = 1.15 kohm \n" ] } ], "prompt_number": 44 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex 6.19 - page : 225" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from __future__ import division \n", "#Data given\n", "Rf=15 #kohm\n", "RT1=4.7 #kohm\n", "R1=56 #kohm\n", "R2=6.8 #kohm\n", "R3=10 #kohm\n", "R4=1 #kohm\n", "R5=1 #kohm\n", "CB=1 #micro F\n", "CT=0.05 #mic\n", "VCC=15 #V\n", "V1=-15 #V##Voltage given through the resistance(R1) 56 kohm\n", "print \"Part (i)\"\n", "Vin=2 #V\n", "Vo=Rf/R1*(-V1)-Rf/R2*Vin #V\n", "print \"Voltage Vo = %0.3f V \" %Vo \n", "N_VCC=0 #V##-VCC##voltage given to the 12th pin of IC\n", "V7=N_VCC+3 #V\n", "print \"Voltage V7 = %0.2f V \" %V7\n", "I=(V7-Vo)/RT1 #mA\n", "print \"Current I = %0.2f mA \" %I \n", "Rmult=R4*R5/(R4+R5)+R3 #kohm##on pin 3\n", "print \"Total resistance on pin 3, Rmult = %0.2f kohm \" %Rmult\n", "f0=0.32*I*10**-3/(CT*10**-6)/1000 #kHz\n", "print \"Oscillation frequency is %0.1f kHz \" %f0\n", "print \"Part (ii)\"\n", "Vin=5 #V\n", "Vo=Rf/R1*(-V1)-Rf/R2*Vin #V\n", "print \"Voltage Vo = %0.f V \" %Vo \n", "N_VCC=0 #V##-VCC##voltage given to the 12th pin of IC\n", "V7=N_VCC+3 #V\n", "print \"Voltage V7 = %0.f V \" %V7 \n", "I=(V7-Vo)/RT1 #mA\n", "print \"Current I = %0.2f mA \" %I \n", "Rmult=R4*R5/(R4+R5)+R3 #kohm##on pin 3\n", "print \"Total resistance on pin 3, Rmult = %0.2f kohm \" %Rmult \n", "f0=0.32*I*10**-3/(CT*10**-6)/1000 #kHz\n", "print \"Oscillation frequency is %0.2f kHz\" %f0" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Part (i)\n", "Voltage Vo = -0.394 V \n", "Voltage V7 = 3.00 V \n", "Current I = 0.72 mA \n", "Total resistance on pin 3, Rmult = 10.50 kohm \n", "Oscillation frequency is 4.6 kHz \n", "Part (ii)\n", "Voltage Vo = -7 V \n", "Voltage V7 = 3 V \n", "Current I = 2.13 mA \n", "Total resistance on pin 3, Rmult = 10.50 kohm \n", "Oscillation frequency is 13.63 kHz\n" ] } ], "prompt_number": 49 } ], "metadata": {} } ] }