Electronics Mini-Lab

From Course Wiki
Revision as of 15:35, 14 September 2013 by Steven Nagle (Talk | contribs)

Jump to: navigation, search
20.309: Biological Instrumentation and Measurement

ImageBar 774.jpg


Photo by Brendan Dolan-Gavitt

During the next lab exercise on measuring DNA melting curves, you will build and debug several electronic circuits. This mini-lab will introduce you to the electronic components and test equipment you will use. A short answer-book style writeup is required. Items to include in your report are shown below in bold.

This mini-lab requires an understanding of basic circuits. If you need to review circuit concepts, start with the Electronics Primer page. If you have a lot of experience with electronics, ask one of the instructors about doing a stimulation mini-project instead of the mini-lab assignment.

Making and characterizing a resistive voltage divider circuit

Schematic diagram of voltage divider circuit.

In part 1 of the mini-lab, you will analyze and build a voltage divider. The divider circuit comprises two resistors and a voltage source, as shown in the schematic diagram. You will select the values for R1 and R2. Choose any resistor values you like, but there are a few practical constraints.

The resistors in the lab range in value from 1Ω to 10MΩ. Within that range, manufacturers only produce certain standard values. Check the supply bins or this table to see which values are available.

Power dissipation in resistors increases as the square of current, P = I 2R. The maximum power rating of the resistors in the lab is 1/4 Watt. Components operated at too high a power level may get very hot and fail. A noxious puff of smoke frequently accompanies failure. Even if a component operated at an excessive power level does not completely fail, its behavior will be unpredictable. Ensure that the power dissipated by R1 and R2 does not exceed the maximum rating.

You will use an oscilloscope to measure voltages in the circuit. The oscilloscope has an input impedance of 1MΩ. Connecting the oscilloscope probe to a node of the circuit is equivalent to placing a 1MΩ resistor between that node and ground. In circuits that use very large resistors, the current flowing into the oscilloscope can significantly distort measurements.

Before building the divider circuit:

  1. Record the resistor values you selected and the gain of the circuit, Vo / Vi.
  2. Derive the voltage Vo for the voltage divider circuit.
  3. Plot an IV curve consisting of calculated current I on the vertical axis versus Vi on the horizontal axis over the range 0 V < Vi < 15 V.
  4. Derive a formula for the power dissipated in R1 and R2 as a function of Vi.
  5. Add the power dissipation to the plot of the IV curve.
  6. Derive a formula for the change in Vo if a 1MΩ resistor is added in parallel to R2. Show the equivalent circuit and your derivation.

Build the circuit

Most electronic components look like bugs. They have a central body with a bunch of gangly legs sticking out, called leads. The leads carry current from the outside of a component to its innards. One of the first challenges facing an aspiring circuit maker is to properly connect all the bugs' legs whilst keeping the circuit robust and orderly. Solderless electronic breadboards are a convenient platform for building circuits that might require a lot of debugging or frequent reconfiguration. Breadboards have a large number of square holes in them called tie points. A single wire or component lead fits into each tie point. Spring-loaded contacts inside each tie point hold the leads in place and provide an electrical connection. The images below show examples of solderless electronic breadboards.

Top view of a solderless electronic breadboard.
Voltage divider circuit implemented on a breadboard.

Sets of tie points are electrically connected in a pattern that allows component leads to be connected in almost any arrangement. The two central grids of tie points separated by a notch are called the field. Each row of tie points in the field is called a terminal strip. The terminal strips are numbered. Columns are designated by a letter. Within a terminal strip, the five tie points A-E are connected, and tie points F-J are connected. Points A-E are not connected to points F-J. Connections between component leads are made by running jump wires between tie points that are connected to each lead, as shown in the image above on the right.

The lines of tie points to the left, right, and above the field are called bus strips. Bus strips are highlighted by red and blue lines. All of the tie points in a bus strip are connected together. Because most circuits have a lot of power and ground connections, the bus strips are almost always connected to the power supply. Using the bus strips as a power distribution network makes it easy to connect any terminal strip to power or ground with a short jump wire.

  1. Gather components to build the divider circuit:
    • solderless electronic breadboard
    • lab station with a working power supply and digital multimeter (DMM)
    • jump wires, or a few lengths of different colored wire (located near the breadboards)
    • wire strippers (located in your lab station drawer)
    • banana cables (located on the West wall)
    • resistors of the selected values (located on the bench at the North wall)
  2. Verify the value of the resistors by reading the coded bands.
    • Through negligence or malice of last semester's scholars, components occasionally end up in the wrong bin. Instructions for reading resistor markings are available at this website.
  3. Mount the resistors by pressing component leads into the tie points in the field.
    • Trim the resistors leads to keep the component body close to the board. This will also prevent long leads from shorting on the bottom metal of the board.
  4. Run jump wires to connect the divider to power and ground bus strips.
    • Keep your wiring neat, close to the board and easy to follow. A good way to do this is to route wires horizontally or vertically, making right-angle bends to change directions.
    • Use the right length of wire. The right length of wire is the shortest length of wire that satisfies the previous guideline.
    • Use the bus strips to distribute power supplies and ground.

If you are unsure whether two holes on the breadboard are connected, insert short wires in the holes. Use the resistance or continuity features of the DMM to check if they are connected.

There are a few downsides to breadboards. They have high interconnect capacitance and resistance. If you don't know why that's bad, pay attention in lecture over the next few weeks and discuss with an instructor.

Measure the resistors with the DMM

A DMM serves as a voltmeter, ammeter, ohmmeter.

The DMM serves as a voltmeter, an ammeter, an ohmmeter among other functions. The black (negative) lead always plugs into COM at the bottom of the meter while the red (positive) lead plugs into V/Ω for voltage and resistance measurements or into A for current measurements. The voltage and current measurement modes of the DMM are very different, so don't forget to reconnect the leads.

  1. If you have read ahead and already connected power to your circuit, make sure it is off.
  2. Disconnect the resistor you want to measure so that other parts of the circuit will not affect the resistance you measure.
  3. Switch the DMM to resistance mode, which is labeled with a Ω.
  4. Place the DMM leads in parallel with the resistor of interest.
  5. Read and record the value on the DMM. Repeat for the second resistor.
  6. Calculate and record the difference from the specified value.

The manufacturer's tolerance for the resistors in the lab is 5% of the nominal value. Therefore, the resistances in the circuit you build will be somewhat different than the nominal values you analyzed.

Connect the power supply

Triple-output DC power supply with dual variable output (CH1 & CH2) and fixed 5V output (CH3).

The lab power supplies provide three voltage outputs. The (+) and (−) outputs have adjustable current limits and voltages up to ±20V can be set either independently, or together (using the mode buttons located between the pairs of voltage and current knobs). While the POWER button at lower left applies power to the supply itself, the white OUTPUT button on the upper left enables power to flow to the outputs: always remember to turn this off or disconnect it when rewiring your circuits. There is also one fixed 5V output at the lower left. Use this output with care, as its current has a very high limit, noted below the terminals as 3 A.

Connecting a wire directly from the power supply to a tie point is tenuous, so the breadboard also has four colored posts, which are visible in the image above right. These are called banana terminals. Each post accepts a banana connector inserted at the top and a bare wire at the base. The wire should be passed through the hole at the base of the post and secured with the colored plastic nut. A cable with banana connectors on both ends connects the power supply to the posts. The banana terminals are not connected to any tie points, so it is necessary to run a wires from the posts to tie points on the bus strips. Then wires must be run from the bus strips to the component power and ground leads.

Note that the green GND connector is connected to the power supply chassis ground (or AC power ground); it is not ground for your circuit.

  1. Connect the power supply to the breadboard with banana cables.
    • Use the black banana connector and blue bus strips for ground. Red bus strips are almost always used for power supplies.
    • The exposed metal screws on the bottom of the banana connectors can short to the metal optical table. Cover them with electrical tape to prevent a calamity.
    • When making wire connections to the banana terminals, be sure that only bare wire touches the terminal. Insulation under the screw terminal may cause an intermittent connection.
  2. Connect the power and ground bus strips to the circuit.

Measure voltages with the DMM

The DMM has modes for measuring DC and AC signals. In DC mode, the meter reads the average value of the test signal. In AC mode, the meter reads the root-mean-square value of a time varying signal. In this lab you will use DC mode, which is labeled with a solid line above a dashed line.

Connections of test leads to DMM: Red is connected to the socket, black is connected to the COM socket.
Connections of test leads in parallel with R2. In this configuration, the voltage drop across a component is registered as a positive number on the DMM.
  1. Switch the DMM to DC voltage mode and connect the DMM test leads properly: Insert black in COM and red in .
  2. Make firm contact with the two leads across the terminals of R2.
  3. Record the votlage shown on the DMM for each input voltage Vi = 0, 2.5, 5, 10 and 15 V.
  4. Include the uncertainty of the measurement.
  5. Calculate and record the change in the measured voltage if the DMM input impedance were reduced to 1 kΩ.

Measure current with the DMM

Connections of test leads to DMM for current measurement: Red is connected to the A socket, black is connected to the COM socket.
Connections of test leads in series with R2. In this configuration, the current through the DMM is registered as a positive number on the DMM.
  1. Switch the DMM to DC current mode and connect the leads as shown in the figure above: Positive current is measured into the red lead, moved to the A socket of the DMM, and out of the black lead, remaining in the COM socket.
  2. Place the leads of the DMM in series with the circuit loop.
  3. Record the current through the circuit at each input voltage in units of mA.
  4. For the highest voltage, calculate the effect on measured current if the input impedance were increased to 1 kΩ.
  5. Using the measured current, calculate the resistance of R2 using Ohm's law and each of the currents and voltages that you measured.
  6. Calculate the percent error in the measured resistance values.
  7. Compare to the tolerance value specified by the manufacturer and to the resistance values measured earlier.
  8. On the same axes as your last figure, plot an IV curve consisting of measured current I on the vertical axis versus measured Vi on the horizontal axis.

Making and characterizing a low-pass RC filter

RC filter circuit schematic.
RC filter on a breadboard.

Most signals contain components that are changing with time. The RC filter above is one of the simplest circuits to begin to understand such time transient signals. When R2 is replaced with a capacitor and a fixed Vi is applied, the output voltage Vo is not initially constant as it is for the divider circuit. Instead the voltage Vo approaches Vi over time, quickly at first and then more slowly at an exponentially decaying rate. For this reason the circuit will filter out quickly changing inputs because the output does not respond quickly. It so happens that if we reverse the placement of the resistor and capacitor then this behavior is reversed, but we will come back to that later. For now you will build and measure the low-pass filter shown above.

To make this circuit:

  1. Turn off the power supply.
    • A different type of supply will be connected to the RC filter (see below).
  2. Remove the jump wire between the voltage divider and the +15 V bus strip.
  3. Replace R2 with a capacitor in the range of 0.1 - 10 nF, depending on the size of the resistor R1.
    • The suggested capacitance range assumes R1 in the range of 100 - 10,000 Ω.
    • Don't worry about the precise capacitor value at this time.

To investigate the behavior of the RC filter circuit, a function generator will replace the DC power supply to apply a voltage Vi that varies with time. And the voltage output Vo will be measured with an oscilloscope instead of the DMM above.

Function generator

An SFG-2120 digital function generator.

A function generator generates signal waveforms for standard functions: sinusoids, triangles, square waves. The digital function generators in the lab generate waveforms at precise frequencies in the range from 0.01Hz to 10MHz, and amplitudes ranging from ±0.1V to ±10.0V. Frequencies are entered directly on the number keypad followed by units of Hz, kHz or MHz. The knob on the upper right of the unit can fine tune the frequency.

  1. Do not yet turn on the function generator.
  2. Connect the function generator to your circuit:
    • Connect the function generator using a BNC cable at the Output connector on the front right of the function generator.
    • At the circuit end of the BNC cable, use a BNC adapter ending in either red and black clips or two 21 gauge wire leads.
    • Connect the positive lead (the center conductor of the BNC) to the Vi side of R1 and connect the negative lead (the outer shield conductor of the BNC) to the ground bus strip of the breadboard.

Oscilloscope

The Rigol digital oscilloscope.

An oscilloscope ("scope" for short) is designed for observing signals that change with time. There is a triggering mechanism by which the oscilloscope determines when to start measuring the signal. The screen of the oscilloscope displays the signal level in Volts versus time in seconds, with the trigger point near the left side of the display. The vertical scale knobs are used to set the voltage fraction per major vertical division on the display. The horizontal scale knobs are used to set the fraction of a second per major horizontal division. The trigger can be set to watch for a rising signal or a falling signal, among others, through the menu button at far right. The signal level at which the trigger is activated can be adjusted with the smaller Level knob, also at the right of the front of the scope. The 309 scopes can also perform many basic measurement tasks such as amplitude, peak-to-peak, frequency, and phase measurements. Most functions are controlled via menus. Basic functions are described below, but full manuals can be downloaded for the Rigol DS1052e and the ATTEN ADS1022c.

  1. Connect the scope to the circuit.
    • Bring two scope probes to your station. They are found on the North wall to the far right of the white board. They are attached to thin coaxial cables with BNC connectors on the end.
    • Connect the BNC connector of one probe to CH1 and connect the probe itself to Vo using a small jump wire and the retractable clip at the end. Also connect the black alligator clip to the Ground bus strip.
    • In a similar fashion connect the other probe to CH2 and Vi.
    • Set the oscilloscope vertical scale for each channel to 5 V per division. Note that the Rigol scopes have one knob for both channels, so first press the button for the desired channel, e.g. the CH2 button assigns the knob to CH2. If you have an ATTEN scope, there is a knob for each channel. However, software menu functions still require you to press the button for the desired channel.
    • Set the scope to trigger from CH2, the input channel in this setup.

Measure the low-pass RC filter

  1. Turn on the function generator and set parameters.
    • Enter a frequency of 1 kHz using the number pad and range buttons.
    • Press the WAVE button to select a square wave output.
    • Adjust the AMPL knob to a desired level by referring to the signal measurement on scope CH2, which is Vin.
    • Adjust the horizontal scale of the scope until individual signal periods can be seen clearly.
    • Play around a little with the amplitude of the function generator output level and the oscilloscope settings.
  2. Investigate the behavior of the circuit.
    • Try different combinations of resistor and capacitor.
    • Adjust the resistor and/or capacitor until CH2 shows a perfect square wave. Talk to an instructor if you have trouble here or if you want to know why this is important.
    • Adjust the frequency of the function generator until Vout fully relaxes to nearly Vin within each half period.
  3. Measure peak-to-peak values of Vin and Vout. This is the difference between the minimum level and maximum level shown on the scope display.
  4. Measure the time required for Vout to increase by 63% of the difference between the minimum and maximum levels. This is roughly the relaxation time of the circuit.
  5. Using the equation for the relaxation time τ = RC, the time measured in the last step and the previously measured resistance of R1, calculate the capacitance of C1.

Identifying unknown filter circuits

RC filters come in many flavors and each can be identified with the tools introduced thus far. All flavors can be analyzed as some combination of the low-pass filter explored and the high-pass filter. For example, a band pass filter is simply a combination of the the low- and high-pass filters, as is its sibling the band-stop filter. Both of these act as their name implies: Over a band of frequencies the signal is either passed or blocked, respectively.

To quickly analyze these filters in the lab, modify the technique of the last section. First, drive the circuit with a sine wave rather than a square wave. Second, convert the relaxation time into a characteristic frequency fc = 1/2πR1C1, referred to as the cut-off frequency (Take note of the 2π.). For the low-pass filter, if the input signal frequency is low compared to the cut-off frequency, the signal is not filtered and passes through. If on the other hand it is near, at or above the cut-off frequency, then it will be partially or completely blocked, i.e., attenuated. Well above the cut-off frequency the attenuation increases linearly with signal frequency. The response of the high-pass filter is simply a mirror image with respect to the cut-off frequency. And responses of band-pass and band-stop filters are simply the superposition of a low-pass and a high-pass filter.

There are several metal boxes with unknown filter circuits inside, labelled "A" through "D". Your goal is to determine their transfer functions.

  1. Connect the function generator and oscilloscope to one of the black boxes (which are actually blue) using BNC cables.
  2. Set the scope to trigger from the input channel.
  3. Measure Vpp of both the input and output signals from 10 Hz to 10 MHz with at least one measurement per decade.
    • Each box is a different filter type. Take enough data to confirm this.
  4. Plot the ratio of output to input Vpp versus frequency (as a log-log plot) for each black box.
  5. Repeat the the previous two steps for each box, A through D.
  6. Draw circuits to model the observed behavior of each box. Note that one box is only subtly different than a similar box.
  7. In Matlab, use the lsim function to simulate each of these functions, and fit the simulated output to input ratio by adjusting the relaxation time in the model.
  8. What happens to the energy of the attenuated frequencies?
  9. Match the box below (left) with one of your data sets.
Inside an unknown black box, showing the front of the PCB. The capacitors are identical and their values are labeled as 272 which means 27x102 pF. The resistors are identical and labeled as BROWN-GRAY-RED-GOLD.
Inside an unknown black box, showing the back of the PCB.

Characterizing a photodiode

Photodiode circuit schematic showing an AC power supply symbol to represent the function generator, a photodiode symbol and a differential op-amp symbol for the ADS622, in addition to the previous resistor R1. Power supply to the ADS622 is removed from the schematic for clarity.
Photodiode circuit on a breadboard with AD622 differential amplifier included to measure voltage across the resistor in order to calculate photodiode current. Notice the power connections to the ADS622. Discuss any questions with your instructor.

In this section the IV curve of a photodiode will be measured under varying amounts of light flux. An understanding of this phenomenon will aid in using the photodiode to measure emitted fluorescent light in the DNA Melting Lab. It will be helpful to review the Diode section of the Electronics Primer. The voltage drop across the diode, the diode bias, can be measured easily with an oscilloscope probe connected in parallel with the diode. The DMM could be used to measure the diode current as done previously with the resistor, but since this provides only an instantaneous reading a better way would allow the measurement to be shown on the 'scope. In fact there are devices that output a voltage that is proportional to current, but these are not directly relevant to the objectives of this mini-lab and the DNA melting lab. Instead, voltage will be measured across R1. Since it is in series with the diode, and $ I = V/R $ in a resistor, this approach directly provides the current through the diode. To make this measurement, a special type of operational amplifier (op-amp) will be used.

Op-amps

Basic non-inverting op-amp circuit.
The pin assignments of a typical op-amp in a DIP-8 package.

An op-amp, or operational amplifier, is a special type of integrated circuit (IC) used to construct an amplifier. It takes two inputs at its (+) and (−) terminals, subtracts them, multiplies that difference by a very large number called the open-loop gain A ~ 106 and provides the result on the output terminal. Because of the extremely large gain, by itself the op-amp is not very useful. But in a circuit topology such as the non-inverting topology at right, the op-amp is an extremely powerful tool. In this arrangement the combination of negative feedback and the very large gain of the op-amp results in an output voltage that, while a much smaller multiple of the input voltage, can be precisely controlled by the designer. In fact, for the so-called non-inverting topology pictured here, output voltage can be expressed as

$ V_{out} \approx \frac{R_f}{R_g}V_{in} $

for

$ R_f >> R_g $.

The schematic above makes use of op-amps by way of a device called a differential instrumentation amplifier. This device, an ADS622 from Analog Devices, is simply a particular arrangement of two op-amp topologies, each of which is similar to the one shown at right. The instrumentation amplifier takes two inputs and provides an output that is a small multiple of their difference. The multiple is again referred to as a gain and can be adjusted by connecting a certain resistance to one of the pins on the device. If no resistor is connected, the device has a default gain. In addition to the connection schematic shown at right, device connection and operation details can be found on the ADS622 datasheet, which should be downloaded from the Analog Devices website.

Op-amps are active circuit elements. This means that they are made up of devices that do work. Internal circuitry uses the input signals to yield the output signal. Work requires power, and so an op-amp needs DC power connections. These power connections are omitted on simple schematics like the one at right, but they can be seen on the datasheet and on the more detailed schematic at the top of this section. Typically ±15 volts is used, but different op-amps in different topologies use different power supply levels. Always check the datasheet and be aware of maximum allowable levels. The positions of the V+ and V power connections are shown on the figure at right. This is the standard arrangement of nearly all 8-pin op-amp packages and happens to be the connection diagram for the ADS622 as well, although the point of connection for the gain resistor is not shown. Every op-amp package has a marking to indicate pin 1 and the datasheet shows the positions of the other pins relative to pin 1. NC on the datasheet stands for No Connection.

Important: ICs are sensitive to static electricity discharges. Your body can easily store enough charge to damage an IC, especially on a dry winter day. To prevent this, always make sure to touch the grounded metal case of an instrument to dissipate the charge. Use caution when handling the chips.

Measure the photodiode IV characteristic using the instrumentation amplifier

  • Place devices on the breadboard to construct the circuit as shown in the schematic above.
  • Connect the power supply to power the instrumentation amplifier.
  • Check connections with the DMM to verify the amplifier is powered properly.
  • Connect the function generator to provide Vi to the circuit and configure the function generator to apply a triangle wave between ± 1-3 V at 1 kHz.
  • Use the oscilloscope to measure the diode voltage VD on CH1 and the output of the instrumentation amplifier, which is VR1 on CH2.
  • Configure the 'scope to show the data in X-Y format, where CH1 will be X and CH2 will be Y so that the display will show the IV curve of the photodiode.
  • Capture the curve to a USB memory stick, load into Matlab and plot the real IV curve by converting the resistor voltage to current.
  • Shine varying amounts of light directly on the photodiode using the supplied fiber lights in the lab.
  • Capture an IV curve for each level of light shown on the photodiode, plot all curves on the same set of axes and fit the diode IV curve model to each.
  • Comment quantitatively on the difference between these curves.
IV curves that will result from proper setup of the photodiode circuit.