acquire temperature data from an rtd -凯发k8网页登录
this example shows how to acquire temperature data from a resistive temperature device (rtd) and display the readings. the device is attached inside a pc case to monitor the internal temperature changes.
discover devices that support rtds
to discover a device that supports bridge sensor measurements, access the device in the table returned by the daqlist
command. this example uses an ni 9219 module in national instruments® compactdaq chassis ni cdaq-9178. this is a 24-bit universal analog input module and is module 7 in the chassis.
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'.
add an rtd channel
create a dataacquisition, and add an analog input channel with rtd
measurement type.
dq = daq("ni"); dq.rate = 30; ch = addinput(dq, "cdaq1mod7", "ai3", "rtd");
set sensor properties
refer to the sensor data sheet and match the values accordingly. in this example, an sa1-rtd series sensor from omega® is used. set units to "fahrenheit"
, rtd type to "pt3851"
, configure the rtd circuit as "fourwire"
, and set the resistance to 100 ohms.
ch.units = "fahrenheit"; ch.rtdtype = "pt3851"; ch.rtdconfiguration = "fourwire"; ch.r0 = 100;
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 and plot data
use the read
command to acquire data.
data = read(dq, seconds(1));
plot(data.time, data.cdaq1mod7_ai3);
degreesign = 176;
ylabel(sprintf("temperature (�)", degreesign));