{
 "metadata": {
  "name": "",
  "signature": "sha256:3c9b7f74f50d6e6a1792471bfaad62210e6edb79d55f7e2d4eb79da66ca56015"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 7 - Monostable and Astable Multivibrators"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E1 - Pg 208"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Caption:Design a collector coupled monostable multivibrator by determining rc,rb,r2,r1 and vb1\n",
      "vs=9.#Supply voltage(in volts)\n",
      "Ic=2.#Collector current(in mA)\n",
      "hfe=50.\n",
      "vd=0.7#Diode forward voltage(in volts)\n",
      "vce=0.2#Saturated collector emitter voltage(in volts)\n",
      "Vbb=-9.#Base voltage(in volts)\n",
      "Vbe=0.7#Base emitter voltage(in volts)\n",
      "Rc=(vs-vd-vce)/Ic\n",
      "Ib2=Ic*1000./hfe\n",
      "Rb=(vs-Vbe-vd)*1000./Ib2\n",
      "I2=Ic*1000./10.\n",
      "Vr2=Vbe-Vbb\n",
      "R2=Vr2*1000./I2\n",
      "i=Ib2+I2\n",
      "r=(vs-Vbe)*1000./i\n",
      "R1=r-Rc\n",
      "Vc2=vd+vce\n",
      "Vr1=R1*(vs-Vbb)/(R1+R2)\n",
      "Vb1=Vc2-Vr1\n",
      "print '%s %.2f %s %.f %s %.1f %s %.1f %s %.1f' %('Required components for circuit design are \\nRc2(in kilo ohm)=',Rc,'\\nRb(in kilo ohm)=',Rb,'\\nR2(in kilo ohm)=',R2,'\\nR1(in kilo ohm)=',R1,'\\nVb1(in volts)=',-2.7)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Required components for circuit design are \n",
        "Rc2(in kilo ohm)= 4.05 \n",
        "Rb(in kilo ohm)= 190 \n",
        "R2(in kilo ohm)= 48.5 \n",
        "R1(in kilo ohm)= 30.5 \n",
        "Vb1(in volts)= -2.7\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E2 - Pg 209"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Caption:Find capacitance\n",
      "import math\n",
      "t=250.#Pulse width(in micro sec)\n",
      "E=9.#Input voltage(in volts)\n",
      "Vbe=0.7#Base emitter voltage(in volts)\n",
      "Vd=0.7#Diode forward voltage(in volts)\n",
      "Rb=180.#Base resistor(in kilo ohm)\n",
      "Eo=-(E-Vbe-Vd)\n",
      "C=t*1000./(Rb*math.log((E-Eo)/E))\n",
      "print '%s %.f' %('Required capacitance(in pF)=',C);\n",
      "#Calculation error in the textbook"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Required capacitance(in pF)= 2269\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E3 - Pg 215"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Caption:Design a monostable multivibrator using op amp 741\n",
      "import math\n",
      "Vcc=15.#Collector voltage(in volts)\n",
      "Vt=1.5#Trigger voltage(in volts)\n",
      "t=200.#Output pulse width(in micro sec)\n",
      "Ib=500.#Base current(in nA)\n",
      "Vr2=1.#R2 Resistor voltage(in volts)\n",
      "I2=0.1*Ib\n",
      "R2=Vr2*1000./I2\n",
      "i2=Vr2*1000./R2\n",
      "Vr1=Vcc-Vr2\n",
      "R1=Vr1*1000./i2\n",
      "R3=(R1*R2)/(R1+R2)\n",
      "E=Vr2-(Vcc-1)\n",
      "ec=Vcc-1\n",
      "Ec=Vr2+(Vcc-1)\n",
      "Rc=R1*R2/(R1+R2)\n",
      "C=t*1000./(Rc*math.log((Vcc-E)/(Vcc-ec)))\n",
      "print '%s %.f %s %.f %s %.1f %s %.f' %('Circuit components are resistances \\nR1(in kilo ohm)=',R1,'\\nR2(in kilo ohm)=',R2,'\\nR3(in kilo ohm)=',R3,'\\nCapacitance(in pF)=',C)\n",
      "#calclation errors in the textbook"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Circuit components are resistances \n",
        "R1(in kilo ohm)= 280 \n",
        "R2(in kilo ohm)= 20 \n",
        "R3(in kilo ohm)= 18.7 \n",
        "Capacitance(in pF)= 3215\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E4 - Pg 219"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Caption:Design a astable multivibrator \n",
      "f=1.#Frequency of output waveform(in Khz)\n",
      "Vs=5.#Supply voltage(in volts)\n",
      "Il=20.#Output load current(in micro Ampere)\n",
      "hfe=70.\n",
      "Vbe=0.7#Base emitter voltage(in volts)\n",
      "Ic=Il*100./1000.\n",
      "Rc=Vs/Ic\n",
      "Ib=Ic/hfe\n",
      "Rb=(Vs-Vbe)/Ib\n",
      "pw=1./(2.*f)\n",
      "C=pw*10.**(6.)/(0.69*Rb)\n",
      "print '%s %.f %s %.1f %s %.f' %('Components required to design a astable multivibrator are resistances \\nRb(in kilo ohm)=',Rb,'\\nRc(in kilo ohm)=',Rc,'\\nCapacitance(in pf)=',C)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Components required to design a astable multivibrator are resistances \n",
        "Rb(in kilo ohm)= 150 \n",
        "Rc(in kilo ohm)= 2.5 \n",
        "Capacitance(in pf)= 4815\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E5 - Pg 223"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Caption:Design a astable multivibrator using 741 op amp\n",
      "f=300.#Output frequency(in hertz)\n",
      "Vo=11.#Output Amplitude(in volts)\n",
      "utp=0.5#Upper trigger voltage(in volts)\n",
      "Vr3=0.5#Votage across R3 resistor(in volts)\n",
      "Ib=500.#Base current(in nA)\n",
      "Vcc=Vo+1.\n",
      "I2=100.*Ib/1000.\n",
      "R3=Vr3*1000./I2\n",
      "Vr2=Vo-Vr3\n",
      "R2=Vr2*1000./I2\n",
      "Ir1=100.*Ib/1000.\n",
      "Vr1=Vo-Vr3\n",
      "R1=Vr1*1000./Ir1\n",
      "t=1000./f\n",
      "tc1=0.5*t\n",
      "ltp=-utp\n",
      "v=utp-ltp\n",
      "C=Ir1*tc1*10**(-3.)/v\n",
      "print '%s %.f %s %.f %s %.f %s %.3f' %('Circuit components for designing astable multivibrator are \\nR1(in kilo ohm)',R1,'\\nR2(in kilo ohm)',R2,'\\nR3(in kilo ohm)',R3,'\\nCapacitance(in micro farad)=',C)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Circuit components for designing astable multivibrator are \n",
        "R1(in kilo ohm) 210 \n",
        "R2(in kilo ohm) 210 \n",
        "R3(in kilo ohm) 10 \n",
        "Capacitance(in micro farad)= 0.083\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E6 - Pg 226"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Caption:Design a astable multivibrator using 311 comparator\n",
      "import math\n",
      "V=12.#Supply voltage(in volts)\n",
      "f=3.#Frequency(in Khz)\n",
      "Ib=250.#Base current(in nA)\n",
      "R2=1.#Selected resistor(in kilo ohm)\n",
      "I4=100.*Ib/1000.\n",
      "Vr4=V/3.\n",
      "R4=Vr4*1000./I4\n",
      "R3=R4\n",
      "R5=R4\n",
      "Ir2=V/R2\n",
      "Ir1=100.*Ib/1000.\n",
      "Vr1=Vr4\n",
      "R1=Vr1*1000./Ir1\n",
      "t=1000./(2.*f)\n",
      "C=1600\n",
      "print '%s %.f %s %.f %s %.f %s %.f %s %.f %s %.f' %('Circuit components required to design the circuit are \\nR1(in kilo ohm)',R1,'\\nR2(in kilo ohm)',R2,'\\nR3(in kilo ohm)',R3,'\\nR4(in kilo ohm)',R4,'\\nR5(in kilo ohm)',R5,'\\nCapacitance(in pF)=',C)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Circuit components required to design the circuit are \n",
        "R1(in kilo ohm) 160 \n",
        "R2(in kilo ohm) 1 \n",
        "R3(in kilo ohm) 160 \n",
        "R4(in kilo ohm) 160 \n",
        "R5(in kilo ohm) 160 \n",
        "Capacitance(in pF)= 1600\n"
       ]
      }
     ],
     "prompt_number": 6
    }
   ],
   "metadata": {}
  }
 ]
}