{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 10 : Multivibrators"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 10.1\n",
      " - Page No : 324"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "#Given data\n",
      "R2 = 5 # in k ohm\n",
      "R2 = R2 * 10**3 # in  ohm\n",
      "R1 = R2 # in ohm\n",
      "R_B = R2 # in ohm\n",
      "R4 = 0.4 # in k ohm\n",
      "R4 = R4 * 10**3 # in ohm\n",
      "R3 = R4 # in ohm\n",
      "R_C = R4 # in ohm\n",
      "C2 = 0.02 # in \u00b5F\n",
      "C2 = C2 * 10**-6 #  in F\n",
      "C1 = C2 # in F\n",
      "C = C2 # in F\n",
      "T = 1.386*R_B*C # in sec\n",
      "T= T*10**3 # in ms\n",
      "print \"The time period = %0.2f ms \" %T\n",
      "f = 1/T # in kHz\n",
      "print \"The frequency of circuit oscillation = %0.1f kHz \" %f\n",
      "Beta_min = R_B/R_C #minimum value of transistor \u00df \n",
      "print \"The minimum value of transistor \u00df = %0.1f \" %Beta_min"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The time period = 0.14 ms \n",
        "The frequency of circuit oscillation = 7.2 kHz \n",
        "The minimum value of transistor \u00df = 12.5 \n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 10.2\n",
      " - Page No : 324"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "V_CC = 20 # in V\n",
      "V_BB = 20 # in V\n",
      "R_C2 = 1 # in k ohm\n",
      "R_C2 = R_C2 * 10**3 # in ohm\n",
      "R_C1 = R_C2 # in  ohm\n",
      "f = 500 # in Hz\n",
      "h_fe = 50 # unit less\n",
      "PW = 0.2 # in ms\n",
      "PW = PW*10**-3 # in sec\n",
      "V_CEsat = 0.3 # in V\n",
      "V_BEsat = 0.7 # in V\n",
      "I_CEsat= (V_CC-V_CEsat)/R_C1 # in A\n",
      "I_Bmin= I_CEsat/h_fe # in A\n",
      "I_B= 1.5*I_Bmin # in A\n",
      "R= (V_BB-V_BEsat)/I_B # in ohm\n",
      "R= int(R*10**-3) # in k ohm\n",
      "R1=R # in k ohm\n",
      "R2= R1 # in k ohm\n",
      "T= 1/f # in sec\n",
      "D_cycle= PW/T \n",
      "T2= D_cycle*T #sec\n",
      "T1= T-T2 # in sec\n",
      "C1= T1/(0.693*R2) # in mF\n",
      "C1= C1*10**3 # in \u00b5F\n",
      "C2= T2/(0.693*R1) # in mF\n",
      "C2= C2*10**3 # in \u00b5F\n",
      "print \"The value of R1 = %0.f k ohm \" %R1\n",
      "print \"The value of R2 = %0.f k ohm \" %R2\n",
      "print \"The value of C1 = %0.3f \u00b5F \" %C1\n",
      "print \"The value of C2 = %0.3f \u00b5F \" %C2"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of R1 = 32 k ohm \n",
        "The value of R2 = 32 k ohm \n",
        "The value of C1 = 0.081 \u00b5F \n",
        "The value of C2 = 0.009 \u00b5F \n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 10.3\n",
      " - Page No : 327"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import log \n",
      "#Given data\n",
      "V_CC = 12 # in V\n",
      "R_B = 20 # in k ohm\n",
      "R_B = R_B * 10**3 # in ohm\n",
      "R_C = 2 # in k ohm\n",
      "R_C = R_C * 10**3 # in ohm'\n",
      "C = 0.1 # in \u00b5F\n",
      "C = C * 10**-6 # in F\n",
      "V_CEsat = 0.2 # in V\n",
      "V_BEsat = 0.8 # in V\n",
      "Beta = 50 # unit less\n",
      "T =R_B*C*log( (2*V_CC-V_BEsat)/(V_CC-V_BEsat) ) # in S\n",
      "print \"The input pulse = %0.4f ms \" %(T*10**3)\n",
      "I_Csat = (V_CC-V_CEsat)/R_C # in A\n",
      "I_Csat = I_Csat * 10**3 # in mA\n",
      "# Beta = h_fe \n",
      "I_Bmin = I_Csat/Beta # in mA\n",
      "I_B = (V_CC-V_BEsat)/R_B # in A\n",
      "I_B = I_B * 10**3 # in mA\n",
      "if I_B>I_Bmin :\n",
      "    print \"The value of I_B (\",round(I_B,2),\"mA) is greater than the value of  I_Bmin (\",round(I_Bmin,3),\"mA).\" \n",
      "    print \"Hence the transistor in saturaion \"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The input pulse = 1.4565 ms \n",
        "The value of I_B ( 0.56 mA) is greater than the value of  I_Bmin ( 0.118 mA).\n",
        "Hence the transistor in saturaion \n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 10.4\n",
      " - Page No : 328"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from sympy import symbols, solve, N\n",
      "#Given data\n",
      "T= 500*10**-6 # in sec\n",
      "h_femin = 25 # unit less\n",
      "I_CEsat = 5 # in mA\n",
      "I_CEsat = I_CEsat * 10**-3 # in A\n",
      "V_CC = 10 # in V\n",
      "V_BB = 4 # in V\n",
      "V_CEsat = 0.4 # in V\n",
      "V_BEsat = 0.8 # in V\n",
      "V_BEoff = -1 # in V\n",
      "R_C2 = (V_CC-V_CEsat)/I_CEsat # in ohm\n",
      "R_C1= R_C2 # in ohm\n",
      "print \"The value of R_C1 = %0.2f k ohm \" %(R_C1*10**-3)\n",
      "print \"The value of R_C2 = %0.2f k ohm \" %(R_C2*10**-3)\n",
      "I_B2min = I_CEsat/h_femin # in A\n",
      "I_B2actual = 1.5*I_B2min # in A\n",
      "R = (V_CC-V_BEsat)/(I_B2actual) # in ohm\n",
      "print \"The value of R = %0.3f k ohm \" %(R*10**-3)\n",
      "C= T/(0.693*R) # in F\n",
      "print \"The value of C = %0.6f \u00b5F \" %(C*10**6)\n",
      "R1= symbols('R1')\n",
      "R2= 2.143*R1 # in ohm\n",
      "# I_B1actual= (V_CC-V_BE1sat)/(R_C+R1) - (V_BE1sat+V_BB)/R2 and R2= 2.143*R1 so\n",
      "expr = I_B2actual*R2*(R1+R_C1)-V_CC*R2+V_BEsat*R2+R1*V_BEsat+R1*V_BB+R_C1*V_BEsat+R_C1*V_BB \n",
      "R1 = solve(expr, R1)\n",
      "R1= R1[1] # in ohm\n",
      "R1= R1*10**-3 # in kohm\n",
      "R2= 2.143*R1 # in k ohm\n",
      "print \"The value of R1 = %0.2f k\" %R1\n",
      "print \"The value of R2 = %0.1f k\u03a9 \" %R2\n",
      "R1= R1*10**3 # in ohm\n",
      "R1C1= 1*10**-6 # in F\n",
      "C1= R1C1/R1 # in F\n",
      "C1= C1*10**12 # in pF\n",
      "print \"The value of C1 = %0.1f pF \" %C1"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of R_C1 = 1.92 k ohm \n",
        "The value of R_C2 = 1.92 k ohm \n",
        "The value of R = 30.667 k ohm \n",
        "The value of C = 0.023527 \u00b5F \n",
        "The value of R1 = 20.58 k"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "The value of R2 = 44.1 k\u03a9 \n",
        "The value of C1 = 48.6 pF \n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 10.5\n",
      " - Page No : 331"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "V_CC = 10 # in V\n",
      "V_BB = -10 # in V\n",
      "R_C2 = 1.2* 10**3 # in ohm\n",
      "R_C1 = R_C2 # in ohm\n",
      "R_B1 = 39 * 10**3 # in ohm\n",
      "R_B2 = R_B1 # in ohm\n",
      "R2 = 10* 10**3 # in ohm\n",
      "R1 = R2 # in ohm\n",
      "h_fe = 30 # unit less\n",
      "V_CE2sat = 0 # in V\n",
      "I1 = (V_CC-V_CE2sat)/R_C2 # in A\n",
      "I2 = (V_CE2sat-V_BB)/(R1+R_B2) # in A\n",
      "I_C2 = I1-I2 # in A\n",
      "I_B2min = I_C2/h_fe # in A\n",
      "V_C2 = 0 # in V\n",
      "V_B1 = V_C2 - (I2*R1) # in V\n",
      "V_B2 = 0 # in V\n",
      "V_C1 = 10 # in V\n",
      "I3 = (V_CC-V_C1)/R_C1 # in A\n",
      "V_BE2sat = 0 # in V\n",
      "I4 = (V_C1-V_BE2sat)/R2 # in A\n",
      "I_D = I3-I4 # in A\n",
      "I5 = (V_BE2sat-V_BB)/R_B1 # in A\n",
      "I_B2actual = I4-I5 # in A\n",
      "I_B2actual= I_B2actual*10**3 # in mA\n",
      "I_C1 = 0 # in mA\n",
      "I_B1 = 0 # in mA\n",
      "I_C2= I_C2*10**3 # in mA\n",
      "print \"The value of V_C1 = %0.f V \" %V_C1\n",
      "print \"The value of V_C2 = %0.f V \" %V_C2\n",
      "print \"The value of V_B1 = %0.f V \" %V_B1\n",
      "print \"The value of V_B2 = %0.f V \" %V_B2\n",
      "print \"The value of I_C1 = %0.f mA \" %I_C1\n",
      "print \"The value of I_C2 = %0.2f mA \" %I_C2\n",
      "print \"The value of I_B1 = %0.f mA \" %I_B1\n",
      "print \"The value of I_B2 = %0.3f mA \" %I_B2actual"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of V_C1 = 10 V \n",
        "The value of V_C2 = 0 V \n",
        "The value of V_B1 = -2 V \n",
        "The value of V_B2 = 0 V \n",
        "The value of I_C1 = 0 mA \n",
        "The value of I_C2 = 8.13 mA \n",
        "The value of I_B1 = 0 mA \n",
        "The value of I_B2 = 0.744 mA \n"
       ]
      }
     ],
     "prompt_number": 21
    }
   ],
   "metadata": {}
  }
 ]
}