I am having trouble reading data from a pressure sensor using MATLAB. The pressure sensor is connected to an NI 9219 Analog Input Device. Firstly, i tested the device to make sure it is working using NI DAQmx (Measurement and Automation Explorer) software and below is a waveform of an output received : So i have tried a couple of things based on comments below, i have done 2 runs of the code changing only the addAnalogInputChannel settings:
1) First Run is using Voltage in the addAnalogInputChannel, i have attached a picture of my workspace and Waveform below:
2) Second Run is using Bridge in the addAnalogInputChannel, i have attached a picture of my workspace and Waveform below:
My previous code is shown below:
%% NI UST-9162 Interface %%
devices = daq.getDevices;
% disp(devices) %Identify devices (NI USB-9162 as 'Dev1')
s = daq.createSession('ni');
ch0 = addAnalogInputChannel(s,'Dev1','ai0','Current'); %Honeywell pressure sensor
%ch0.BridgeMode = 'Full'; %Configures the bridge mode property of Honeywell
%ch0.NominalBridgeResistance = 5000; %Honeywell datasheet suggests 5 kOhm
ch.Coupling = 'DC';
ch.ADCTimingMode = 'HighSpeed';
ch.ExcitationVoltage = 2.5;
s.Rate = 2; %Scan rate per second
s.DurationInSeconds = 2; %Set data collection for S seconds
[data,time] = s.startForeground; %Start test data collection
%% Plot Captured Data %%
figure(1)
clf(figure(1))
grid on
plot(time,data,'-.','linewidth',2)
xlabel('Time (s)')
ylabel('Voltage')
legend('Honeywell')
xlim([0 s.DurationInSeconds])
ylim([-0.03 0.03])
I have listed the equipment below with links to datasheet:
1) Pressure Sensor(Mine is Port Type B with 6G)
2) NI-9219 Analog Input Module
3) MATLAB 2017b with Data Acquisition Tool Box
4) NI DAQmx