diff options
Diffstat (limited to 'Electronic_Instrumentation_and_Measurements_by_David_A._Bell/Chapter5.ipynb')
-rw-r--r-- | Electronic_Instrumentation_and_Measurements_by_David_A._Bell/Chapter5.ipynb | 388 |
1 files changed, 388 insertions, 0 deletions
diff --git a/Electronic_Instrumentation_and_Measurements_by_David_A._Bell/Chapter5.ipynb b/Electronic_Instrumentation_and_Measurements_by_David_A._Bell/Chapter5.ipynb new file mode 100644 index 00000000..9085b454 --- /dev/null +++ b/Electronic_Instrumentation_and_Measurements_by_David_A._Bell/Chapter5.ipynb @@ -0,0 +1,388 @@ +{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# CHAPTER 5: DIGITAL INSTRUMENT BASICS"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 5-1, Page Number: 120"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "High output voltage(Voh)= 4.0 V\n",
+ "Low output voltage(Vol)= 0.7 V\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "Vcc=5 #in V\n",
+ "R1=1*10**3 #in ohm \n",
+ "Vd=0.7 #Diode voltage in V\n",
+ "I0=1*10**-3 #High output current in A\n",
+ "Vilow=0 #Low input voltage\n",
+ "\n",
+ "#Calculation\n",
+ "Voh=Vcc-I0*R1\n",
+ "Vol=Vilow+Vd\n",
+ "\n",
+ "print \"High output voltage(Voh)=\",Voh,\"V\"\n",
+ "print \"Low output voltage(Vol)=\",Vol,\"V\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 5-2, Page Number: 121"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 31,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "With Q2 ON,\n",
+ "Vc2= 0.2 V\n",
+ "Vr1r2= 5.2 V\n",
+ "Vr1= 1.9 V\n",
+ "Vb1= -1.7 V\n",
+ "\n",
+ "With Q1 OFF,\n",
+ "Vrc1= 0.6 V\n",
+ "Vc1= 4.4 V\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "Vbe=0.7 #Base emitter voltage in V\n",
+ "Vce_sat=0.2 #Saturation voltage in V\n",
+ "R1=15*10**3 #in ohm\n",
+ "R2=27*10**3 #in ohm\n",
+ "Vcc=5 #in V\n",
+ "Vbb=-5 #in V\n",
+ "Rc1=2.7*10**3 #in ohm\n",
+ "R11=15*10**3 #in ohm\n",
+ "R21=27*10**3 #in ohm\n",
+ "\n",
+ "#Calculation\n",
+ "#With Q2 on,\n",
+ "Vc2=Vce_sat #Q2 is ON \n",
+ "Vr1r2=Vc2-Vbb #KVL\n",
+ "Vr1=R1*Vr1r2/(R1+R2) #Voltage Divider Rule\n",
+ "\n",
+ "Vb1=Vc2-Vr1 #KVL\n",
+ "\n",
+ "#With Q1 off, \n",
+ "Vrc1=Rc1*(Vcc-Vbb)/(Rc1+R11+R21) #Voltage Divider Rule\n",
+ "Vc1=Vcc-Vrc1 #KVL\n",
+ "\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print \"With Q2 ON,\"\n",
+ "print \"Vc2=\",round(Vc2,1),\"V\"\n",
+ "print \"Vr1r2=\",round(Vr1r2,1),\"V\"\n",
+ "print \"Vr1=\",round(Vr1,1),\"V\"\n",
+ "print \"Vb1=\",round(Vb1,1),\"V\"\n",
+ "print\n",
+ "print \"With Q1 OFF,\"\n",
+ "print \"Vrc1=\",round(Vrc1,1),\"V\"\n",
+ "print \"Vc1=\",round(Vc1,1),\"V\"\n",
+ "\n",
+ "#Note: A round off error of 0.1 V is observed in Vr1 and Vb1 variables"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 5-3, Page Number: 124"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 34,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "For the LED Display,\n",
+ "Current for each 7 segment display= 140.0 mA\n",
+ "Current for 1/2 (2 segment) display= 40.0 mA\n",
+ "Total current for 3 and 1/2 digits= 460.0 mA\n",
+ "\n",
+ "For the LCD Display,\n",
+ "Current for each 7 segment display= 2.1 mA\n",
+ "Current for 1/2 (2 segment) display= 600.0 micro ampere\n",
+ "Total current for 3 and 1/2 digits= 6.9 mA\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "If=20*10**-3 #Forward current in A\n",
+ "\n",
+ "#Calcualtions\n",
+ "#For the LED display\n",
+ "I7=7*If #Seven Segment Current in A\n",
+ "I_1by2=2*If #Current for 1/2 digit in A\n",
+ "It=3*I7+I_1by2 #Total Current in A\n",
+ "\n",
+ "print \"For the LED Display,\"\n",
+ "print \"Current for each 7 segment display=\",round(I7*10**3),\"mA\"\n",
+ "print \"Current for 1/2 (2 segment) display=\",round(I_1by2*10**3),\"mA\"\n",
+ "print \"Total current for 3 and 1/2 digits=\",round(It*10**3),\"mA\"\n",
+ "\n",
+ "\n",
+ "#For the LCD Display\n",
+ "If=300*10**-6\n",
+ "\n",
+ "I7=7*If #Seven Segment Current in A\n",
+ "I_1by2=2*If #Current for 1/2 digit in A\n",
+ "It=3*I7+I_1by2 #Total Current in A\n",
+ "\n",
+ "print\n",
+ "print \"For the LCD Display,\"\n",
+ "print \"Current for each 7 segment display=\",round(I7*10**3,1),\"mA\"\n",
+ "print \"Current for 1/2 (2 segment) display=\",round(I_1by2*10**6),\"micro ampere\"\n",
+ "print \"Total current for 3 and 1/2 digits=\",round(It*10**3,1),\"mA\"\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 5-4, Page Number: 130"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 35,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Time period= 4.1 ms\n",
+ "Frequency= 244.0 Hz\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "\n",
+ "#Variable Declaration\n",
+ "T0=1*10**-6 #Oscillator time period in s\n",
+ "N=16 #Modulus of the counters \n",
+ "n=3 #No. of counters\n",
+ "\n",
+ "#Calculations\n",
+ "T=T0*N**n #Time period in s\n",
+ "f=1/T #Frequency in Hz\n",
+ "\n",
+ "#Results\n",
+ "print \"Time period=\",round(T*10**3,1),\"ms\"\n",
+ "print \"Frequency=\",round(f),\"Hz\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 5-5, Page Number: 131"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 41,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "For Vi=0.9V,\n",
+ "t= 90.0 ms\n",
+ "Pulses counted= 90000.0\n",
+ "For Vi=0.75V,\n",
+ "t= 75.0 ms\n",
+ "Pulses counted= 75000.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "\n",
+ "#Variable Declaration\n",
+ "Vr=1.25 #in V\n",
+ "tr=125*10**-3 #in s\n",
+ "f=1.0*10**6 #in Hz\n",
+ "\n",
+ "#For Vi=0.9\n",
+ "Vi=0.9 #in V\n",
+ "t1=tr*Vi/Vr #in s \n",
+ "T=1/f #in s\n",
+ "N=t1/T #No. of pulses counted \n",
+ "\n",
+ "print \"For Vi=0.9V,\"\n",
+ "print \"t=\",round(t1*10**3),\"ms\"\n",
+ "print \"Pulses counted=\",round(N)\n",
+ "\n",
+ "#For Vi=0.75\n",
+ "Vi=0.75 #in V\n",
+ "t1=tr*Vi/Vr #in s \n",
+ "N=t1/T #No. of pulses counted \n",
+ "\n",
+ "print \"For Vi=0.75V,\"\n",
+ "print \"t=\",round(t1*10**3),\"ms\"\n",
+ "print \"Pulses counted=\",round(N)\n",
+ "\n",
+ "#**********************Error********************************\n",
+ "##Note:The count values obtained in text book are 900 and 750 \n",
+ "##Whereas the actual values are 900000 and 75000 respectively"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 5-6, Page Number: 133"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 47,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "N= 7 bit ADC is requird for quantizing error less than 1%\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "#For 1% quantizing error count, count>=100\n",
+ "N=1\n",
+ "while(N):\n",
+ " count=2**N-1\n",
+ " if(count>=100):\n",
+ " break \n",
+ " N=N+1\n",
+ "\n",
+ "print \"N=\",N,\"bit ADC is requird for quantizing error less than 1%\"\n",
+ " "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 5-7, Page Number: 135"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 50,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Vo= 6.25 V\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "\n",
+ "#Variable Declaration\n",
+ "a3=1 #bit\n",
+ "a2=0 #bit\n",
+ "a1=1 #bit\n",
+ "a0=0 #bit\n",
+ "Vi=10 #in V\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "Vo=(2**3*a3+2**2*a2+2**1*a1+a0)*Vi/16.0\n",
+ "\n",
+ "print \"Vo=\",round(Vo,2),\"V\"\n",
+ " \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
+}
|