{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 11: Voltage Regulators"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 11.1, Page No. 414"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# op-amp series voltage regulator design\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "Vin_min = 18-3             # min input voltage specification\n",
      "Vin_max = 18+3             # max input voltage specification\n",
      "Vout = 9                   # output voltage specification\n",
      "Iout_min = 10*10**-3       # min output current specification\n",
      "Iout_max = 50*10**-3       # max output current specification\n",
      "Vz = 5.6                   # zener breakdown voltage\n",
      "Pzmax = 0.5                # Maximum power dissipation in zener\n",
      "\n",
      "#Calculations\n",
      "R1 = 10*10**3              # assumed\n",
      "R2 = R1/((Vout/Vz)-1)\n",
      "R3 = (Vin_min-Vz)/Iout_max\n",
      "Iz = (Vin_max-Vz)/R3\n",
      "Pd = Iz*Vz\n",
      "beta = 30                  # assumed\n",
      "Ib = Iout_max/(beta+1)\n",
      "\n",
      "#Result\n",
      "print(\"Element values for designed circuit are as follows:\\nR1 = %d k-ohm\\nR2 = %.2f k-ohm\"%(R1/1000,R2/1000))\n",
      "print(\"R3 = %.3f k-ohm\\nIB = %.2f mA\"%(R3/1000,Ib*1000))\n",
      "#Answer for R3 is wrong in the book"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Element values for designed circuit are as follows:\n",
        "R1 = 10 k-ohm\n",
        "R2 = 16.47 k-ohm\n",
        "R3 = 0.188 k-ohm\n",
        "IB = 1.61 mA\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 11.2, Page No. 420"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Regulator using IC 723\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "Vout = 5                     # Required output voltage\n",
      "Iout = 100*10**-3            # Required output current\n",
      "Vin_min = 15-(0.2*15)        # Min input voltage\n",
      "Vin_max = 15+(0.2*15)        # Max input voltage\n",
      "Isc = 150*10**-3             # Short circuit current requirement\n",
      "Vsense = 0.7                 # short circuit voltage\n",
      "Vref = 7.15                  # reference votage for IC 723\n",
      "Id = 1*10**-3                # potential divider current\n",
      "\n",
      "\n",
      "#Calculation\n",
      "Rsc = Vsense/Isc\n",
      "R1 = (Vref-Vout)/Id\n",
      "R1std = 2.2*10**3 \n",
      "R2 = R1std/((Vref/Vout)-1)\n",
      "R2std = 5.1*10**3 \n",
      "R3 = R1std*R2std/(R1std+R2std)\n",
      "R3std = 1.5*10**3 \n",
      "\n",
      "#Result\n",
      "print(\"R1 = %.3f k-ohm\\t We use %.1f k-ohm as standard resistor.\"%(R1/1000,R1std/1000))\n",
      "print(\"R2 = %.3f k-ohm\\t We use %.1f k-ohm as standard resistor.\"%(R2/1000,R2std/1000))\n",
      "print(\"R3 = %.3f k-ohm\\t We use %.1f k-ohm as standard resistor.\"%(math.floor((R3/1000)*1000)/1000,R3std/1000))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "R1 = 2.150 k-ohm\t We use 2.2 k-ohm as standard resistor.\n",
        "R2 = 5.116 k-ohm\t We use 5.1 k-ohm as standard resistor.\n",
        "R3 = 1.536 k-ohm\t We use 1.5 k-ohm as standard resistor.\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 11.3, Page No. 421"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Ic 723 based positive voltage regulator\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "Vout = 12.0               # output voltage\n",
      "Il = 500*10**-3           # load current\n",
      "Isc = 600*10**-3          # short circuit current\n",
      "Vref = 7.0                # IC 723 reference voltage \n",
      "Vsense = 0.6              # voltage at short circuit\n",
      "\n",
      "#Calculation\n",
      "R1 = 4.7*10**3            # assumed\n",
      "R2 = Vref*R1/(Vout-Vref)\n",
      "R2std = 6.8*10**3 \n",
      "Rsc = Vsense/Isc\n",
      "R3 = R2std*R1/(R2std+R1)\n",
      "Psc = Isc**2*Rsc*1000\n",
      "I = Vout/(R1+R2std)\n",
      "I= math.floor(I*10**6)/10**6\n",
      "P1 = I**2*R1*1000\n",
      "P2 = I**2*R2std*1000\n",
      "\n",
      "#Result\n",
      "print(\"R1 = %.1f k-ohm\\nR2 = %.2f k-ohm = %.1f k-ohm(standard value)\\nRsc = %.1f ohm\"%(R1/1000,R2/1000,R2std/1000,Rsc))\n",
      "print(\"\\nPower wattage:\\nPsc = %.0f mW\\nP1 = %.3f mW\\nP2 = %.3f mW\"%(Psc,math.floor(P1*1000)/1000,P2))\n",
      "print(\"Hence, both R1 and R2 may be selected safely of 1/16th watt power rating.\")"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "R1 = 4.7 k-ohm\n",
        "R2 = 6.58 k-ohm = 6.8 k-ohm(standard value)\n",
        "Rsc = 1.0 ohm\n",
        "\n",
        "Power wattage:\n",
        "Psc = 360 mW\n",
        "P1 = 5.112 mW\n",
        "P2 = 7.397 mW\n",
        "Hence, both R1 and R2 may be selected safely of 1/16th watt power rating.\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 11.4, Page No. 426"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Regulator design using IC 723(refer to fig. 11.26)\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "Vout = 6                    # output voltage\n",
      "Il = 1                      # load current\n",
      "Isc = 0.250                 # short circuit \n",
      "Vref = 7                    # reference voltage\n",
      "Vbe = 0.7                   # base-emitter junction voltage\n",
      "\n",
      "#Calculations\n",
      "R1 = 2.7*10**3              # assumed\n",
      "R2 = Vout*R1/(Vref-Vout)\n",
      "kRsc = Vbe/Isc\n",
      "k =1-(((Il-Isc)*kRsc)/Vout)\n",
      "R4 = 10*10**3                # assumed         \n",
      "R3 = (1-k)*R4\n",
      "Rsc = kRsc/k\n",
      "R = (R1*R2)/(R1+R2)\n",
      "\n",
      "#Result\n",
      "print(\"R1 = %.1f k-ohm\\nR2 = %.1f k-ohm\\nR3 = %.1f k-ohm\\nR4 = %.1f k-ohm\\nR  = %.2f k-ohm\"%(R1/1000,R2/1000,R3/1000,R4/1000,R/1000))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "R1 = 2.7 k-ohm\n",
        "R2 = 16.2 k-ohm\n",
        "R3 = 3.5 k-ohm\n",
        "R4 = 10.0 k-ohm\n",
        "R  = 2.31 k-ohm\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 11.5, Page No.432"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Current source design using IC7812\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "RL = 25.0           # load resistance\n",
      "P = 10.0            # power \n",
      "I = 0.5             # current required\n",
      "V = 12.0            # rated voltage\n",
      "\n",
      "#Calculations\n",
      "R = V/I\n",
      "Vout = V+(I*RL)\n",
      "Vin = Vout+2\n",
      "\n",
      "#Result\n",
      "print(\"R    = %d ohm\\nVout = %.1f V\\nVin  = %.1f V\"%(R,Vout,Vin))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "R    = 24 ohm\n",
        "Vout = 24.5 V\n",
        "Vin  = 26.5 V\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 11.6, Page NO. 432"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# min and max voltage of regulator(refer fig.11.34)\n",
      "\n",
      "import math\n",
      "#variable declaration\n",
      "Iq = 10*10**-3             # quiescent current\n",
      "Vreg = 15.0                # regulated output voltage\n",
      "R2 = 0                     # min value of potentiometer\n",
      "R1 = 40.0                  # R1 resistor\n",
      "\n",
      "#Calculations\n",
      "Vout = (1+(R2/R1))*Vreg+(Iq*R2)\n",
      "\n",
      "#Result\n",
      "print(\"Vout = %d V\"%Vout)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Vout = 15 V\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 11.7, Page No. 432"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# current source using 7805\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "Il = 0.2              # required load current\n",
      "RL = 22.0             # load resistance\n",
      "P = 10.0              # required power\n",
      "Iq = 4.2*10**-3       # quiescent current\n",
      "Vr = 5                # regulated output voltage\n",
      "\n",
      "#Calculation\n",
      "R = Vr/(Il-Iq)\n",
      "Vout = Vr+Il*RL\n",
      "Vin = Vout+2\n",
      "\n",
      "#Result\n",
      "print(\"R = %f ohm\\nVout = %.1f V\\nVin = %.1f V\"%(R,Vout,Vin))\n",
      "# Answer for R is wrong in the book"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "R = 25.536261 ohm\n",
        "Vout = 9.4 V\n",
        "Vin = 11.4 V\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 11.8, Page No.435"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Regulated outpuut voltage(refer fig. 11.38)\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "R1 = 220.0                 # resistance R1\n",
      "R2 = 1500.0                # Resistance R2\n",
      "Iadj = 100*10**-6          # adj. current\n",
      "\n",
      "\n",
      "#Calculartions\n",
      "Vout = (1.25*(1+(R2/R1)))+(Iadj*R2)\n",
      "\n",
      "#Result\n",
      "print(\"Vout = %.2f V\"%Vout)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Vout = 9.92 V\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 11.9, Page No. 435"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Output voltage range\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "R1 = 820.0              # resistance R1\n",
      "R2min = 0               # min potentiometer resistance\n",
      "R2max = 10*10**3        # max potentiometer resistance\n",
      "Iadj = 100*10**-6       # adj. current\n",
      "\n",
      "#calculations\n",
      "Vmin = 1.25*(1+(R2min/R1))+(Iadj*R2min)\n",
      "Vmax = 1.25*(1+(R2max/R1))+(Iadj*R2max)\n",
      "\n",
      "#Result\n",
      "print(\"The output can be varied in the range %.2f V to %.2f V\"%(Vmin,Vmax))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The output can be varied in the range 1.25 V to 17.49 V\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "example 11.10, Page No. 436"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Maximum load current\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "Vbe = 1.0                # base emitter junction voltage\n",
      "beta = 15.0              # current gain\n",
      "R1 = 7.0                 # resistance R1\n",
      "Iout = 1.0               # max output current from IC  \n",
      "#Calculations\n",
      "Il = ((1+beta)*Iout) - beta*(Vbe/R1)\n",
      "Il = math.floor(Il*100)/100\n",
      "#Result\n",
      "print(\"IC which can supply maximum 1A can supply maximum load of %.2f A, with the help of the current boosting arrangements\"%Il)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "IC which can supply maximum 1A can supply maximum load of 13.85 A, with the help of the current boosting arrangements\n"
       ]
      }
     ],
     "prompt_number": 12
    }
   ],
   "metadata": {}
  }
 ]
}