Jump to content

As of July 17, 2015, the LabJack forums here at forums.labjack.com are shut down. New registrations, topics, and replies are disabled. All forums are in a read-only state for archive purposes.

Please visit our current forums at labjack.com/forums to view and make new posts. To post on the current forums, use your labjack.com login account. Your old LabJack forums login credentials have been retired. There are no longer separate logins for labjack.com and LabJack forums.


Photo

Logging data with Mux80


  • Please log in to reply
14 replies to this topic

#1 Gavin

Gavin
  • Members
  • 9 posts

Posted 06 June 2012 - 10:24 AM

I recently purchased a labjack U6 along with the Mux80 and 2 CB37 boards. I am trying to log data but am not sure if I am able to do so with LJLogUD or LJStreamUD or if I have to build a custom program. My inputs are 8 x K-type Temperature sensors 3 x Voltage sensors ( using voltage dividers to reduce voltage to range U12 can handle) 4 x Pressure sensors ( run on a 0.5-4.5 Output and 5V-6mA input) 2 x Flowmeters (pulsed output 5V-2mA input, using 2 of the input timers) 3 x Current Sensors (0-5V output 5V 10mA input) If I am unable to use the basic programs can you assist me in the development of a custom one?

#2 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 06 June 2012 - 01:38 PM

See the software options discussed at labjack.com/u6. LJStreamUD and LJLogUD do work with Mux80 channels, but those programs are limited to 16 total channels. If you need more channels, consider DAQFactory. Flowstone is another software package you could check out. If you want to write your own software, follow the link for UD programming examples and start with whatever language you are most comfortable with.

#3 Gavin

Gavin
  • Members
  • 9 posts

Posted 13 June 2012 - 07:17 AM

I have chosen to work with MATLAB but am having issues with the TCVoltsToTemp() function. I am using the simple logging function in order to get a k-type thermocouple voltage but am unable to get an output voltage from this function. The code I am using is below: clc %clear the MATLAB command window clear global %Clears MATLAB global variables ljud_LoadDriver; % Loads LabJack UD Function Library ljud_Constants; % Loads LabJack UD constant file [Error ljHandle] = ljud_OpenLabJack(LJ_dtU6,LJ_ctUSB,'1',1); % Returns ljHandle for open LabJack Error_Message(Error) % Check for and display any Errors % Resets Labjack Error = ljud_ePut(ljHandle, LJ_ioPIN_CONFIGURATION_RESET, 0, 0, 0); Error_Message(Error) time = 10 dt = 1 % Pre-initalize arrays Error(1,1:time/dt)=0; AIN0(1,1:time/dt)=-0; AIN48(1,1:time/dt)=0; TC1(1,1:time/dt)=0; % Enable 1 Timer Error = ljud_AddRequest(ljHandle,LJ_ioPUT_CONFIG,LJ_chNUMBER_TIMERS_ENABLED,2,0,0); Error_Message(Error) % Timer Mode 1: FLOWMETER 1 Error = ljud_AddRequest(ljHandle,LJ_ioPUT_TIMER_MODE,0,LJ_tmFIRMCOUNTER,0,0); Error_Message(Error) % //Configure AIN48 for +/- 1 volt range. Error = ljud_AddRequest (ljHandle, LJ_ioPUT_AIN_RANGE, 48, LJ_rgBIP1V, 0, 0); Error_Message(Error) for n = 1:time/dt % For loop for time/dt iterations x(1,n) = n; % Call eGet function to get AIN value %[Error(1,n) AIN0(1,n)] = ljud_eGet(ljHandle,LJ_ioGET_AIN,0,0,0); %Error_Message(Error) %Call eGet function to get TC voltage [Error(1,n) AIN48(1,n)] = ljud_eGet(ljHandle,LJ_ioGET_AIN,48,0,0); Error_Message(Error) %convert TC voltage to Temperature [TC1(1,n)] = ljud_TCVoltsToTemp(LJ_ttK,AIN48(1,n),0,0) Error_Message(Error) % plot data plot (x,AIN0(x),x,AIN48(x),'r',x,TC1(x),'g') xlim([(n-(dt*10)),n]) legend('AINO','AIN48','TC1') drawnow pause (dt) %pause dt before next iteration end % display data in tabular format clear table table(:,1) = x'*dt; table(:,2) = AIN0'; table(:,3) = AIN48'.*1000; table(:,4) = TC1'; disp(' Time AIN0 AIN48 TC1') disp(table)

#4 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 13 June 2012 - 08:32 AM

So you are having trouble with:

%Call eGet function to get TC voltage
[Error(1,n) AIN48(1,n)] = ljud_eGet(ljHandle,LJ_ioGET_AIN,48,0,0);
Error_Message(Error)
What is it returning for the voltage? Is it giving an errorcode? What if you test with a basic channel like AIN1 right on the U6? What if you use a jumper to VS or GND rather than your signal?

#5 Gavin

Gavin
  • Members
  • 9 posts

Posted 13 June 2012 - 09:29 AM

from: %Call eGet function to get TC voltage [Error(1,n) AIN48(1,n)] = ljud_eGet(ljHandle,LJ_ioGET_AIN,48,0,0); Error_Message(Error) I get a voltage of 0.000348, I tested the system without the multiplexer on AINO and I get the same issue. I can get an output to AINO but the TCVoltsToTemp just gives me an output of 0. The lines I believe I am having issues with is the conversion of the voltage to the temperature: %convert TC voltage to Temperature [TC1(1,n)] = ljud_TCVoltsToTemp(LJ_ttK,AIN48(1,n),0,0) Error_Message(Error)

#6 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 13 June 2012 - 09:50 AM

I am not a Matlab wiz, but does Error(1,n) mean you have a 2-dimensional array of errors? Does the error handler know how to handle that? Perhaps try a simple test such as:

[Error Temp] = ljud_TCVoltsToTemp(LJ_ttK,0.002,300,0)
Error_Message(Error)


#7 Gavin

Gavin
  • Members
  • 9 posts

Posted 13 June 2012 - 09:59 AM

My understanding of the [Error(1,n) AIN48(1,n)] code is that you get two output matrices, the first is an error check and should be a value of zero throughout, the second is the AIN value. This was the code I received from your file so I presume it is a check to ensure there is nothing wrong with the system. When running your test code, I receive the following: >> [Error Temp] = ljud_TCVoltsToTemp(LJ_ttK,0.002,300,0) Error_Message(Error) ??? Error using ==> ljud_TCVoltsToTemp Too many output arguments. I also had an issue when attempting to load my directory which I have not had before the error is: Warning: Directory access failure: C:\progra~1\LabJack\drivers\LabJackUD.h. > In path at 110 In addpath at 87 In ljud_LoadDriver at 11 Could my issue be related to the directory path rather than the actual code? I tried to rectify this last night but was unable to make any progress.

#8 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 13 June 2012 - 02:22 PM

My understanding of the [Error(1,n) AIN48(1,n)] code is that you get two output matrices, the first is an error check and should be a value of zero throughout, the second is the AIN value. This was the code I received from your file so I presume it is a check to ensure there is nothing wrong with the system.

When running your test code, I receive the following:

>> [Error Temp] = ljud_TCVoltsToTemp(LJ_ttK,0.002,300,0)
Error_Message(Error)
??? Error using ==> ljud_TCVoltsToTemp
Too many output arguments.

I also had an issue when attempting to load my directory which I have not had before the error is:

Warning: Directory access failure:
C:\progra~1\LabJack\drivers\LabJackUD.h.
> In path at 110
In addpath at 87
In ljud_LoadDriver at 11

Could my issue be related to the directory path rather than the actual code? I tried to rectify this last night but was unable to make any progress.


For the directory issue, try specifying the full path where the header file exists, i.e. C:\program files\Labjack, etc. If it's a 64-bit machine that might be C:\program files (x86)\labjack\, etc.

It looks like the other error might be a bug in our code. If you look in the MATLAB_LJUD folder, and go to the functions, you will see a file called ljud_TCVoltsToTemp.m. I believe that file should read:

function [ljError, pTCTempK] = ljud_TCVoltsToTemp(TCType, TCVolts, CJTempK,pTCTempK)
[ljError, pTCTempK] = calllib('labjackud','TCVoltsToTemp',TCType, TCVolts, CJTempK,pTCTempK)

instead of

function [ljError] = ljud_TCVoltsToTemp(TCType, TCVolts, CJTempK,pTCTempK)
[ljError] = calllib('labjackud','TCVoltsToTemp',TCType, TCVolts, CJTempK,pTCTempK)

I think making that change to the .m file will fix this.

#9 Gavin

Gavin
  • Members
  • 9 posts

Posted 13 June 2012 - 06:05 PM

That has helped to get the correct output. Thanks for the assistance.

#10 Gavin

Gavin
  • Members
  • 9 posts

Posted 28 June 2012 - 01:01 PM

I am now having issues with my voltage dividers. When I connect them to the board at various points I get erroneous values. When nothing is connected I get a voltage of -10.58, when I hook up a jumper cable I get a voltage of 4.87 but when I hook up the voltage divider I get a voltage of -1.47(no voltage applied) and 0.44 when the voltage is applied. My R1 is 10k-ohm and R2=2.5k-ohm. I have two other spots that read a voltage of 0 with the divider hooked up and the correct applied value. When I measured the system voltage with a multimeter I get ~12.1, I have attempted to alter the offset so it moved from -1.47 to 0 but this does not output the correct value. The voltage applied is pure DC, I put a scope on the signal and there is no oscillations so the output from the labjack should be almost uniform. I am confused as to why the system reads correct at certain locations and is inaccurate at others. Any assistance to fix this problem would be appreciated.

#11 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 29 June 2012 - 10:31 AM

I am not totally following. You are connecting 12 volts to your 10k/2.5k voltage divider, and so expect 2.4 volts at the U6 input. Are you saying that a DMM confirms the divider is giving 2.4 volts, and some U6 channels read 2.4 volts, but other channels read something else? One comment, is that 10k can be too much source impedance for some combinations of gain and resolution. Up to 1k is fine for all combinations, but 10k might not be.

#12 Gavin

Gavin
  • Members
  • 9 posts

Posted 03 July 2012 - 08:14 AM

Yes, for the test I was trying to use 10k/25.k divider from 12V. The multimeter confirmed that it was 2.4V at the connection but the software was not reading this value. I have one channel (71), which can read to correct voltage when a 12V signal is applied, but this is the only one. I have tried to use two 900ohm resistors to reduce the impedance, but it still does not give me an accurate reading. I am currently using the 1x gain on the system with resolution of 8. I chose 10K as a start point as that is what the manual recommended, should I continue to reduce the value of my resistors? One thing I am confused by is the negative reading when no voltage is applied. If the voltage divider is not connected I get a value of -10.58 but as soon as I connect the divider it jumps to around -0.40(900/900 resistor) and -1.46(10k/2.5k resistor). Would this indicate the source impedance is still too high? If so what would you recommend as a size for the resistors?

#13 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 03 July 2012 - 09:37 AM

I updated Section 2.6.3.6 of the U6 User's Guide. The 10k stuff was a copy/paste error from the U3 User's Guide. The U3 only has to settle to 12-bits, so 10k is no problem.

For the U6, 1k is fine for all gain/resolution combinations.

Your reading of the negative rail voltage with nothing connected is not unusual, and floating readings are generally meaningless:

http://labjack.com/s...s-guide/2.6.3.8

However, when you connect your divider resistors with no signal connected to them, you essentially have just connected the AIN to ground with 1800 ohms. That should read pretty close to 0. Your readings do not seem right.

If you just use AIN0-AIN3 on the U6 itself, without the Mux80, do you see any of these problems? Do you see these same readings in LJLogUD? Does it depend on the order of the channels?

#14 Gavin

Gavin
  • Members
  • 9 posts

Posted 03 July 2012 - 10:39 AM

I think I have a faulty Mux80. when I disconnected the CB73's I got accurate readings. When I connected a CB37 into the X2 port I got accurate readings (2.45V) at AIN0-3 & AIN120-127. When I connected the second CB37 to X3 the readings are all accurate except for AIN57-59 & AIN61-62 which read 0.5V, and AIN60 which will not give a reading. When the board is connected to X3 or X4 I get accurate readings at AIN72-119. A coworker is also using a Mux80 board which I borrowed to test the system, when connected I get to correct readings at AIN57-62 when boards are connected at X1 and X2. This leads me to believe that there is an issue with the Mux80 board that was originally shipped to me. Would you agree that this is a logical assumption?

#15 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 03 July 2012 - 11:07 AM

Agreed, it appears that a mux chip is damaged on that board. Send an email to [email protected] with contact information, plus a short description of the problem, and we will create an RMA. It is possible that the damage was caused during shipment, or an ESD event to one of the analog input lines.


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users