« Close

Datasheets and User Guides

App Notes

Software & Driver

 

2.6 - AIN

AIN Overview

The LabJack U6 has 14 user accessible analog inputs built-in. All the analog inputs are available on the DB37 connector, and the first 4 are also available on the built-in screw terminals.

The analog inputs have variable resolution, where the time required per sample increases with increasing resolution. The value passed for ResolutionIndex is from 0-8, where 0 corresponds to default resolution, 1 is roughly 16-bit resolution (RMS or effective), and 8 is roughly 19-bit resolution. The U6-Pro has additional ResolutionIndex settings 9-12 that use the alternate high-resolution converter (24-bit sigma-delta) and correspond to roughly 19-bit to 22-bit resolution.  The default value of 0 corresponds to 8 (U6 command-response), 9 (U6-Pro command-response), or 1 (stream mode).  See Appendix B for more details about ResolutionIndex.

The analog inputs are connected to a high-impedance instrumentation amplifier. This in-amp buffers the signal for the internal ADCs, allows for single-ended or differential conversions, and provides gains of x1, x10, x100, and x1000 (corresponding to ranges of ±10V, ±1V, ±0.1V, and ±0.01V).

Differential channels are adjacent even/odd pairs only, such as AIN2-AIN3. Thus the positive channel must be even and the negative channel must be +1. The Windows UD driver has different IOTypes for single-ended or differential reads, but the differential IOType can always be used as a negative channel (x1 parameter) of 0/15/199 equates to a single-ended reading.

The inputs are not artificially pulled to 0.0 volts, as that would reduce the input impedance, so readings obtained from floating channels will generally not be 0.0 volts. The readings from floating channels depend on adjacent channels and sample rate and have little meaning. See Section 2.6.3.8.

Settling time is the time from a step change in the input signal to when the signal is sampled by the ADC. A step change in this case is caused when the internal multiplexers change from one channel to another. In general, more settling time is required as gain and resolution are increased. The default “auto” settling time ensures that the device meets specifications at any gain and resolution for source impedances up to at least 1000 ohms. In command/response mode, the effect of the SettlingFactor parameter is 0=Auto, 1=20us, 2=50us, 3=100us, 4=200us, 5=500us, 6=1ms, 7=2ms, 8=5ms, 9=10ms. Stream mode has its own settling parameter which is multiplied by 10 microseconds to determine settling time. The timings in Section 3 are measured with “auto” settling.

 

Duplicated Terminals (AIN0-AIN3)

AIN0-AIN3 appear on the built-in screw-terminals and also on the DB37 connector.  You should only connect to one or the other, not both at the same time.

To prevent damage due to accidental short circuit, both connection paths have their own series resistor.  All AIN lines have a 2.2k series resistor, and in the case of AIN0-AIN3 the duplicated connections each have their own series resistor, so if you measure the resistance between the duplicate terminals you will see about 4.4k.

 

10 comments

Hi,

I am trying to get the voltage difference from a load cell between AIN0 and AIN1. Could you look at some of my code and tell me where I went wrong? I only get a voltage reading of 0V between the two inputs.

//Request a differential read of AIN0-AIN1.
intErrorcode = LJUD.AddRequest (intHandle[0], LJUD.LJ_ioGET_AIN_DIFF, 1, 0, 0, 0);
ErrorHandler(intErrorcode, 0, new Exception());


intErrorcode = LJUD.GetNextResult(intHandle[0], intIOType, intChannel, dblValue, dummyInt, dummyDouble);
load_in = dblValue;

 

The voltage into the LabJack is in the mA. I tried adding in the gain but I am not quite sure if that changed anything because I still got a voltage reading of 0V.

 

                //Configure AIN0 for +/- 0.01 volt range.
                intErrorcode = LJUD.AddRequest (intHandle[0], LJUD.LJ_ioPUT_AIN_RANGE, 0, LJUD.LJ_rgBIPP01V, 0, 0);
               
                //Configure AIN1 for +/- 0.01 volt range.
                intErrorcode = LJUD.AddRequest (intHandle[0], LJUD.LJ_ioPUT_AIN_RANGE, 1, LJUD.LJ_rgBIPP01V, 0, 0);


Do I need to do anything before I try to get the AIN difference?

 

Thank you for your help!

The first thing that stands out to me is this line:

intErrorcode = LJUD.AddRequest (intHandle[0], LJUD.LJ_ioGET_AIN_DIFF, 1, 0, 0, 0);

Should be 

intErrorcode = LJUD.AddRequest (intHandle[0], LJUD.LJ_ioGET_AIN_DIFF, 0, 0, 1, 0);

 

These two sections of the guide explain why:

http://labjack.com/support/u6/users-guide/4.3.3

http://labjack.com/support/u6/users-guide/4.2.5

In the Python u6.py code I see the following:

#    SettlingFactor : 0=5us, 1=10us, 2=100us, 3=1ms, 4=10ms

Which does not seem to match the indicated numbers (plus, there's no 'auto' selection).  Why is this?

Older U6 firmware (< v1.03) had these settling factors.  Current U6 firmware has the settling factors on this page.  Update your version of LabJackPython for up to date documentation in u6.py.:

http://labjack.com/support/labjackpython

Hi,

I'm trying to read Ain0, Ain1 and Ain2, Ain3 in differential on a U6.

I've found the following python code that works for Ain0, Ain1:

>>> import u6

>>> d = u6.U6()

>>> d.writeRegister(3000, 1)

>>> d.readRegister(0)

Could you please help me with writing the equivalent for Ain2, Ain3?

(I tried d.writeRegister(3002, 3) then d.readRegister(2) but it doesn't seem to work).

Thanks.

For reference, please read over the UD Modbus page:
http://labjack.com/support/modbus/ud-modbus

Analog input channels are separated by 2 registers and the AIN negative channel configuratinos are separated by one so try:
d.writeRegister(3002, 3) // Configure AIN2 negative channel
d.readRegister(4) //Read from AIN2

For clarification, reading AIN's:
d.readRegister(0) // Read from AIN0
d.readRegister(2) // Read from AIN1
d.readRegister(4) // Read from AIN2
d.readRegister(6) // Read from AIN3

Configure negative channels:
d.writeRegister(3000, 1) // Configure AIN0 negative channel to be AIN1
d.writeRegister(3002, 3) // Configure AIN2 negative channel to be AIN3

Hello,

I'm trying to understand how to configure AIN2 for +/- 0.01 V range for a differential reading on a U6.

I'm using the LabJackPython library but I can't find the python command that would help to setup this.

I would be happy to get some help on that.

Thank you.

Using the low-level protocol, you specify the range and differential settings when reading from the AIN. Here are two ways to configure and read AIN2 using the AIN24 Feedback command or getAIN method with the settings you mentioned:

#Look at the u6.py source code or use the help function on the class or method for documentation.

ain2Bits, = d.getFeedback( u6.AIN24(PositiveChannel=2, ResolutionIndex=0, GainIndex=3, SettlingFactor=0, Differential =True ) )
ain2Value = d.binaryToCalibratedAnalogVoltage(gainIndex=3, bytesVoltage=ain2Bits, is16Bits=False, resolutionIndex=0)

or

ain2Value = d.getAIN(self, positiveChannel=2, resolutionIndex=0, gainIndex=3, settlingFactor=0, differential=True)


Alternatively, using the Modbus protocol it would be:

d.writeRegister(1502, 3) #Configure gain/range
d.writeRegister(3002, 3) #Configure AIN2 negative channel (needs to be positive channel + 1)
ain2Value = d.readRegister(4) #Read from AIN2

For Modbus addresses take a look at the UD Modbus page:

http://labjack.com/support/modbus/ud-modbus

jthurbs's picture

The above documentation states that "0 corresponds to default resolution". I have not been able to find mention of what the default resolution is or how it is set. Assuming it is settable, does it revert to a standard value on power cycle?

Thanks much

LabJack Support's picture

It does say above that the default of 0 corresponds to 1 on a normal U6 and 9 on a U6-Pro, but it does not say anything about changing the default.  This is a setting where you cannot change the default on the U6.  You can't change the default value to anything besides 0 (you can on the newer T7), and you can't change the meaning of 0 to anything besides 1/9.

The reason can be found by looking at the low-level function used for a standard read.  See the AIN24 iotype for the Feedback function in Section 5.2.5.2 where you will find that ResolutionIndex, GainIndex, and SettlingFactor are passed in each time with the function call.