6
Document Type: Example Program NI Supported: Yes Publish Date: Jul 23, 2010 Wheatstone Bridge Based Measurements with myDAQ and LabVIEW Overview This document explains using Wheatstone Bridge to make a precise measurement for sensors such as strain gauges and load cells. The data will be acquired using the DAQ Assistant that is installed into LabVIEW with the NI DAQmx driver as a voltage and converted to a strain, force, or other engineering unit using basic programming in LabVIEW. Table of Contents 1. Objective: 2. Background: 3. What You Need: 4. Wiring Instructions: 5. LabVIEW User Interface: 6. Coding Strategy: 7. How It Works: 8. Tips and Tricks 9. Related Links Objective: Measure the voltage differential across a Wheatstone Bridge with the analog input terminals of the myDAQ and and convert the voltage to the desired engineering unit in LabVIEW. Background: Certain sensors and gauges, such as a strain gauge, output a very small change in resistance; this makes the task of detecting the changes in the sensor difficult. To measure such small changes in resistance or voltage, these sensors are almost always used in a bridge configuration with a voltage excitation source. The general Wheatstone bridge, as seen in Figure 1 below, consists of four resistive arms with an excitation voltage, V EX , that is applied across the bridge. We can then calculate the change in resistance of R 3 by comparing V O to V EX , provided that the resistance of the other resistors are known, using the following equation: Improve your ni.com experience. Login or Create a user profile. 1/20/2011 Wheatstone Bridge Based Measurement… zone.ni.com/devzone/cda/epd/p/id/641… 1/6

Wheatstone Bridge Based Measurements with myDAQ and LabVIEW - Developer Zone - National Instruments

Embed Size (px)

Citation preview

Page 1: Wheatstone Bridge Based Measurements with myDAQ and LabVIEW - Developer Zone - National Instruments

Document Type: Example Program

NI Supported: Yes

Publish Date: Jul 23, 2010

Wheatstone Bridge Based Measurements with myDAQ and

LabVIEW

Overview

This document explains using Wheatstone Bridge to make a precise measurement for sensors such as strain

gauges and load cells. The data will be acquired using the DAQ Assistant that is installed into LabVIEW with the NI

DAQmx driver as a voltage and converted to a strain, force, or other engineering unit using basic programming in

LabVIEW.

Table of Contents

1. Objective:

2. Background:

3. What You Need:

4. Wiring Instructions:

5. LabVIEW User Interface:

6. Coding Strategy:

7. How It Works:

8. Tips and Tricks

9. Related Links

Objective:

Measure the voltage differential across a Wheatstone Bridge with the analog input terminals of the myDAQ and and

convert the voltage to the desired engineering unit in LabVIEW.

Background:

Certain sensors and gauges, such as a strain gauge, output a very small change in resistance; this makes the task

of detecting the changes in the sensor difficult. To measure such small changes in resistance or voltage, these

sensors are almost always used in a bridge configuration with a voltage excitation source. The general Wheatstone

bridge, as seen in Figure 1 below, consists of four resistive arms with an excitation voltage, VEX, that is applied

across the bridge. We can then calculate the change in resistance of R3 by comparing VO to VEX, provided that the

resistance of the other resistors are known, using the following equation:

Improve your ni.com experience. Login or Create a user profile.

1/20/2011 Wheatstone Bridge Based Measurement…

zone.ni.com/devzone/cda/epd/p/id/641… 1/6

Page 2: Wheatstone Bridge Based Measurements with myDAQ and LabVIEW - Developer Zone - National Instruments

Figure 1: Vishay NTCLE-100E-3103 10kΩ Thermistor

What You Need:

1. NI myDAQ

2. LabVIEW

3. A Balanced Wheatstone Bridge with Sensors

4. Wire

Wiring Instructions:

The Wheatstone Bridge is wired to your myDAQ as 2 analog inputs, one to measure VO and the other to measure

Vex. We also must connect the +5V output pin of the myDAQ to the top of the bridge to serve as the excitation voltage

high, and connect the Digital Ground (DGND) to the bottom of the bridge to serve as the excitation voltage low. This

will allow us to measure the excitation voltage in case it is not exactly at a constant 5VDC. This will serve as a

Remote Sense of the excitation voltage.

1/20/2011 Wheatstone Bridge Based Measurement…

zone.ni.com/devzone/cda/epd/p/id/641… 2/6

Page 3: Wheatstone Bridge Based Measurements with myDAQ and LabVIEW - Developer Zone - National Instruments

Figure 2: Wiring Diagram

LabVIEW User Interface:

The user interface we created shows the Voltage Drop, VO, the measured Excitation Voltage, Vex, and the ratio of the

two.

Figure 3: LabVIEW Front Panel

Coding Strategy:

In LabVIEW we need to measure the voltage drop across the terminals, as well as the excitation voltage applied to the

bridge. The voltage drop is then divided by the excitation voltage to find the ratio between the two. This value is very

useful in bridge-based measurements and more logic can be built in to tailor the application as needed. Finally, we

will output the results to numeric indicators on the front panel.

Figure 4: Coding Block Diagram

The LabVIEW block diagram looks very similar to the coding block diagram

1/20/2011 Wheatstone Bridge Based Measurement…

zone.ni.com/devzone/cda/epd/p/id/641… 3/6

Page 4: Wheatstone Bridge Based Measurements with myDAQ and LabVIEW - Developer Zone - National Instruments

Figure 5: LabVIEW 2009 Block Diagram

(The attached LabVIEW code snippet can be dragged-and-dropped to a LabVIEW block diagram, use attached PNG

file. After locating the PNG file, just drag the file icon onto a b lank b lock diagram, as if you were dragging the file onto

your desktop.)

How It Works:

Inside the while loop on the left is the DAQ Assistant. It’s configured to read a single value from the myDAQ ai0 and

ai1 terminals each time it executes. Once a value is read for each channel it is passed down the wire and then split

out into each value. Both the VO and Vex values are displayed on the front panel, and then the ratio of VO/Vex is

calculated and displayed on the front panel. All of the code inside the While Loop continues to run until the Stop

button is pressed on the front panel. The Wait VI (top right) delays execution of the while loop to every 100ms.

Therefore the sampling rate is 10 samples per second, or 10 Hz.

In this VI the DAQ Assistant is configured for on-demand sampling of the analog resistance input channel. The

following steps walk through the configuration of the DAQ Assistant from scratch:

1. Be sure your myDAQ is plugged in

2. Press Ctrl-Space to bring up the Quick Drop Window (takes a full minute to load on the first use)

3. Search for DAQ Assistant and double click on it when it appears in the list

4. Drop it on the Block diagram (white window)

5. When the Create a New Express Task configuration pane appears, select

a. Acquire Signals

b. Analog Input

c. Voltage

d. Dev 1 (NI myDAQ) *Note: If you have other NI hardware installed, the myDAQ will not be Dev1.

e. ai0 and ai1 (Use Ctrl+Click for multiple selections)

f. Finish

6. Change Timing Settings to

a. 1 Sample (On Demand)

7. Press OK

1/20/2011 Wheatstone Bridge Based Measurement…

zone.ni.com/devzone/cda/epd/p/id/641… 4/6

Page 5: Wheatstone Bridge Based Measurements with myDAQ and LabVIEW - Developer Zone - National Instruments

Figure 6: DAQ Assistant Analog Input Configuration

*Note that sample time is set by the Wait VI and is set to sample 10 times per second (every 100ms) in this VI

Tips and Tricks

You can modify the VI to log the data to file using a ‘Write To Spreadsheet File.vi’ express VI if you wish to save thedata. Be sure to place it in the loop and be sure to append new data to the spreadsheet file.

Use ‘From DDT’ to turn the blue Dynamic Data Type wire into an orange double precision number. This allows thedata from the DAQ Assistant to be used with standard LabVIEW VIs.

Expand this application by using the setup with any bridge based sensor to acquire data.

Clean up your input signal by adding a low-pass filter in software using the Filter Express VI.

Related Links

» Measuring Strain with Strain Gages

» Strain Gages and Load, Pressure, and Torque Sensors

» NI myDAQ Getting Started and Support

Reader Comments | Submit a comment »

Legal

This example program (this "program") was developed by a National Instruments ("NI") Applications Engineer.

Although technical support of this program may be made available by National Instruments, this program may not be

completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this

program with each new revision of related products and drivers. THIS EXAMPLE PROGRAM IS PROVIDED "AS IS"

WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET

FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).

1/20/2011 Wheatstone Bridge Based Measurement…

zone.ni.com/devzone/cda/epd/p/id/641… 5/6

Page 6: Wheatstone Bridge Based Measurements with myDAQ and LabVIEW - Developer Zone - National Instruments

My Profi le | RSS | Privacy | Legal | Contact NI © 2011 National Instruments Corporation. All rights reserved. | E-Mail this Page

1/20/2011 Wheatstone Bridge Based Measurement…

zone.ni.com/devzone/cda/epd/p/id/641… 6/6