measure strain using an analog bridge sensor -凯发k8网页登录
this example shows how to acquire bridge circuit voltage ratio data using a compactdaq module, then compute and plot strain values. this example does not apply to usb devices such as the ni usb-9219.
discover devices that support bridge sensor measurements
to discover a device that supports bridge sensor measurements, access the device in the array returned by daqlist
command. for this example use national instruments® compactdaq chassis ni cdaq-9178 and module ni 9219 with id cdaq1mod7
.
d = daqlist("ni")
d = 12×4 table deviceid description model deviceinfo ___________ __________________________________ _____________ ____________________ "cdaq1mod1" "national instruments ni 9205" "ni 9205" [1×1 daq.deviceinfo] "cdaq1mod2" "national instruments ni 9263" "ni 9263" [1×1 daq.deviceinfo] "cdaq1mod3" "national instruments ni 9234" "ni 9234" [1×1 daq.deviceinfo] "cdaq1mod4" "national instruments ni 9201" "ni 9201" [1×1 daq.deviceinfo] "cdaq1mod5" "national instruments ni 9402" "ni 9402" [1×1 daq.deviceinfo] "cdaq1mod6" "national instruments ni 9213" "ni 9213" [1×1 daq.deviceinfo] "cdaq1mod7" "national instruments ni 9219" "ni 9219" [1×1 daq.deviceinfo] "cdaq1mod8" "national instruments ni 9265" "ni 9265" [1×1 daq.deviceinfo] "dev1" "national instruments pcie-6363" "pcie-6363" [1×1 daq.deviceinfo] "dev2" "national instruments ni elvis ii" "ni elvis ii" [1×1 daq.deviceinfo] "dev3" "national instruments pcie-6363" "pcie-6363" [1×1 daq.deviceinfo] "dev4" "national instruments pcie-6363" "pcie-6363" [1×1 daq.deviceinfo]
deviceinfo = d{7, "deviceinfo"}
deviceinfo = ni: national instruments ni 9219 (device id: 'cdaq1mod7') analog input supports: 9 ranges supported rates from 0.1 to 100.0 scans/sec 4 channels ('ai0','ai1','ai2','ai3') 'voltage','current','thermocouple','rtd','bridge' measurement types this module is in slot 7 of the 'cdaq-9178' chassis with the name 'cdaq1'.
create an analog input channel
create a dataacquisition and add an analog input channel with the bridge
measurement type. there are two strain gauges connected to the ni 9219 in half bridge configuration.
dq = daq("ni"); dq.rate = 10; ch = addinput(dq, "cdaq1mod7", "ai0", "bridge");
set channel properties
you must set the bridge mode according to the bridge circuit configuration and the nominal resistance to the value specified by the strain gauge datasheet. in this example, the strain gauges used are the sgd-3/350-ly13 linear strain gauges from omega®, with a nominal resistance of 350 ohms, and the bridge is configured as a half-bridge.
ch.bridgemode = "half";
ch.nominalbridgeresistance = 350;
set adctimingmode
by default, the adc timing mode adctimingmode
of the channel is set to 'highresolution'
. set the adctimingmode
to 'highspeed'
.
ch.adctimingmode = "highspeed";
acquire data
use read
to acquire 10 seconds of data.
data = read(dq, seconds(10));
calculate strain from voltage ratio
the acquired data is the ratio of measured voltage to excitation voltage.
this data is used to compute strain values using a conversion formula (as determined by your bridge configuration).
for half bridge configuration, use
strain = -2*vr/gf
where gf is gauge factor provided in the sensor data sheet and vr is the voltage ratio output as measured by your bridge channel.
assume negligible lead wire resistance in this case. for the strain gauge used in this example, gf = 2.13.
gf = 2.13; strain = -2*data.cdaq1mod7_ai0/gf; plot(data.time, strain); xlabel('time (s)'); ylabel('strain');