banner

Data Acquisition: Voltage Divider

Preparation

Read this whole page in advance.

Read the SoftScope Tutorial.

Read the Intro. to Data Acquisition, and don't forget the appendices.

You'll work in pairs, so buddy up. Each team gets a kit of materials, instruments and tools.

Safety and Lab Practices

We take SAFETY seriously and so should you. Intentionally risky behavior rates a visit with the judicial council.

  1. No food or drink in the lab. Don't want to gum up the equipment.
  2. Remove jewelry on or near your hands. Don't want electrical shorts.
  3. Keep your work area clean: nothing but your kit, whatever hardcopy reading and writing media you'll use (e.g. printouts and a pen).
  4. Take care when wiring. Make sure you understand what connects to what, where positive and ground voltages are, which polarity diodes are in. We don't want surprises, even though we should not see more than 6 volts in our labs.
  5. If you get surprised, see or smell smoke, or anything weird happens, back off and call for help.

Equipment

You need:

  1. The USB-6009 D/A and A/D converter.
  2. A screwdriver
  3. A breadboard
  4. The transformer-resistor unit with a 120 line-voltage plug on one end and two clip output wires on the other end.
  5. 4 Resistors (470, 560, 680 ohm all work), 1/4 watt (tiny) or 1/2 watt (small) are fine. You probably have 4 470-ohm resistors. It would be more fun if some of your resistors were different resistances but we bet they're not. You can check using Resistor Color Codes .
  6. Four wires about 6" long, insulation stripped from ends.

From your reading you know what resistors do. The transformer is our source of (alternating current) voltage. That means its output is a sinusoidal current that varies between + and - some constant value. It already has a 10-ohm resistor attached (the rectangular ceramic component) to keep the current down to a safe level.

The Job

Verify (or hope) that your four resistors are equal in value.

Using Softscope, you are to measure four (peak-to-peak) voltages in your circuit. The circuit diagram looks like this:
circuit
You are to measure the voltage between points I and X, I and Y, I and Z, I and O.

Come up with a simple 'theory', a very short prose or mathematical description relating your four measurements to the circuit.

(Optional) Look at the "Theory" section below and relate it to your own theory of the observations.

Extra Credit: extend your observations by changing your circuit to have parallel resistances. If you don't know how to calculate parallel resistance, use the theory you've developed about your voltage divider to compute the combined resistance of 2 or 3 resistors in parallel.

Hand In: Write down your team members' names, your four measurement values (e.g. "I-O: XXX volts", I-X: YYY volts, ..."), and your theory prose (or math) as enhanced by your understanding from the "Theory" section. Also of course any extra measurements and experiments you did.

Setup

If you have problems identifying components or finding bits, ask for help.

Find two 6" (or so) plastic-insulated wires (red, blue, violet...) with their ends stripped of insulation, so you see at least 1/4" of copper wire on each end. (In the direst extremity, strip some wire yourself with the wire tool).

On the 6009, find the "Analog Input" side with labels that look like "GND AI0 AI4 GND AI1 AI5...". Use the screwdriver counterclockwise looking down to open the jaws of AI0 and AI4 ("leftie loosie"), insert one end of a 6" (or so) wire from the last bullet above each of the jaws and tighten them "up" with the screwdriver ("rightie tightie").

You've just created a "differential analog input" to the 6009.

Plug the 6009 into a USB connection ON THE CHASSIS (NOT THE SCREEN) of your computer.

Start Matlab

The breadboard is used to connect components together.
breadboard

The idea is quite simple: Each horizontal row of 5 holes (A-E, and F-J) is tied together electrically, and can be used as a connection point for up to 5 wires or leads. All the holes in each red and blue column are also electrically connected columnwise. These columns are generally used as power source and ground repectively.

You'll need two more 6" wires we'll misleadingly call call "input" and "output".

For this lab we want to implement the circuit above, with "extra holes" so we can insert probe wires from the 6009 that connect to pairs of points in the circuit: I and X, I and Y, I and Z, I and O.

Do that any way you like: one idea is to use only columns A-E of the breadboard. Recall each half-row of holes A-E is electrically connected.

  1. top row has 'input' wire that will be clipped to one transformer lead, and one end of resistor R1. That leaves 3 holes for plugging in a probe for point I.
  2. some lower row has the other end of R1, an end of R2, and also leaves 3 possible holes for probe to point X.
  3. ditto for R2, R3 and Y.
  4. ditto for R3, R4 and Z.
  5. some lower row is like the top row: it has the end of R4, the 'output' wire that is clipped to the other transformer lead, and three holes that could take a probe for point O.

Matlab Code

You don't even need a script. You can type the three lines that start Softscope directly from the Softscope tutorial into the command window.

How To Measure

Following the procedures below will leave you with a sinusoidal wave in Softscope's channel 1: CH1. You want to measure the wave's ('peak to peak') height. The numbers in the scope's lower left show how many volts per division are being used for each channel display. The default is probably 1, which means you'll want to decrease the vertical scale to something like 5 to fit your wave onto the screen. You want to see the whole wave as large as possible on the scope and to relate its height easily to volts. Choose CH1 in the middle of the Channel Scaling section of the scope. The "Scale" knob can be moused around to change the scale and the "Offset" knob to move the signal up and down. Chances are you can't get a nice even vertical scaling (like 5.00 volts/division) since the dial's so goosey.

For an exact scale setting, go to the Edit tab at upper left of scope, choose Edit Channel, then Channel Properties, then CH1, and look down the menu for "Vertical Scale". The reading there should agree with the value at the lower left. The number is editable...just type in your new desired scaling and make sure to klik OK at the bottom of the editor window. The right thing should happen.

xkHaving fixed a convenient scale, now you can use the Offset knob to put the bottom of the wave on a convenient horizontal line and read the voltage off as the height (in scaled divisions) of the top of the wave.

Doing The Job

Put one of your 6009 leads into your chosen hole for I and the other into that for O. You're now measuring the voltage across all four resistors. Call that Vin. Write it down.

Leave the probe lead at point I and measure and record three Vout voltages at points X,Y, and Z.

To repeat from above, verify that your four resistors are equal in value. Come up with a simple 'theory', a very short prose or mathematical description relating your measurements to the circuit.

(Optional) Look at the "Theory" section below and relate it to your theory of the observations.

Extra Credit: extend your observations by changing your circuit to have parallel resistances. If you don't know how to calculate parallel resistance, use the theory you've developed about your voltage divider to compute the combined resistance of 2 or 3 resistors in parallel.

Hand in your answers (see "What to hand in" below).

Trouble Shooting

If Matlab can't find the 6009 (e.g. you get errors on ai = analoginput('nidaq', 'Dev3')), and daqhwinfo('nidaq') doesn't show a device with a real name (e.g. could be Dev4), then make sure 6009 is plugged into the chassis, not the screen, of computer. Probably best to kill and restart Matlab if this happens. At least delete('daqfind'); clear.

If you hook everything up correctly, you'll see a sine wave voltage on Softscope when you connect points A and B, C, D, or E to the differential inputs for channel 0. A common problem is to see a flat line. Almost certainly there's a wiring problem (for us, we poked a wire into the wrong hole) or a bad connection (didn't poke it in all the way). A sanity check is to connect the output of the transformer directly to the two 6009 inputs, which should also give you a sine wave.

The 6009 and Softscope have internal state that sometimes gets mysteriously set and can render them "crazed".
IF you get strange errors involving timeouts, lack of timeouts, operations not finished, or samples missed, if get(ai) (for instance) shows the object in the 'Running' state when it shouldn't be, if you're told to kill off other jobs or set SampleRate lower, or you get other mysterious whining, AND your code seems OK, then do the following:

  1. delete(daqfind);
  2. clear;
  3. Turn off connections into the 6009 that may have voltages on them.
  4. Disconnect the 6009 from its USB cable and reconnect.
  5. That should fix things. If the 6009 goes unrecognized after its driver has loaded, kill and restart Matlab.
  6. If MatLab is in a loop and you can't stop it with CTRL-C, then you may have to CTRL-ALT-DEL (hold down all at once). Select Task Manager, find and select the Matlab process, and click 'End Process' or whatever to kill it. If necessary, call for help.

Theory

voltage divider
From Wikipedia's Voltage Divider article.

Ohm's law says that the total voltage drop between the input and ground is
Vin = I * ( R1 + R2)
for some current I. Either of R1 and R2 may be made up of other resistors in series or parallel. Likewise
Vout = I*R2.
The first equation gives
I = Vin / (R1 + R2)
And substituting that into the second equation we get
Vout =Vin * [ R2 / (R1 + R2)] .

What to Hand In

Before you leave, leave us one sheet of paper per team, with your team members' names, your four measurement values (e.g. "A-E: XXX volts", A-B: YYY volts, ..."), your theory prose (or math) as enhanced by your understanding from the "Theory" section, and any extra experiments and results. For the basic lab, half a page of writing is too much.
Last Change: 05/02/2011: CB