14.0 Analog Inputs [T-Series Datasheet]
Overview
An analog input (commonly referred to as AIN or AI) uses an analog-to-digital converter (ADC) to convert a voltage level into a digital value. LabJack T-series devices have multiple analog inputs.
Common Uses
For information on measuring various analog signals such as typical analog sensors, measuring small voltages, measuring current (4-20mA), and measuring resistance see the Analog Input App Notes. There are also application specific app notes such as for temperature sensors and thermocouples.
Device Control Basics
All T-series device features are controlled by reading and writing Modbus TCP registers via Modbus TCP (either directly or through our LJM library).
We have register descriptions throughout documentation detailing relevant register names, starting addresses, types, and access permissions (read/write).
Most AIN registers have a FLOAT32 type meaning each register requires 32 bits to represent the associated data. Each entry in the device address space holds 16-bits of data, so most AIN registers take up two address spaces such as 0 and 1 (AIN0 register). See the Modbus Map for related information.
See Section 3.0 Communication for other detailed communication information.
Configuration
T-series AIN readings can be configured. See below for information
AIN Extended Features
T-series AIN Extended Features simplify operations such as:
Reading thermocouples and thermistors
Calculating RMS, RTD, average/max/min, average/threshold, and circuit element resistance
Extended Channels - T7 Only
The T7's Extended Channels range provides extra AIN channels.
Subsections
AIN Summary By Device
T4
Analog Inputs: | 4 high-voltage (±10V, AIN0-AIN3) |
Voltage Ranges: | ±10 V or 0-2.5 V ( Appendix A-3-1-3) |
Resolution: | 12-bit |
Max Data Rate: | 50000 samples/second in stream mode (Appendix A-1) |
Sampling Modes: | Single-ended |
T7
Analog Inputs: | 14 (AIN0-AIN13) |
Voltage Ranges: | ±10 V, ±1 V, ±0.1 V, ±0.01 V (Appendix A-3-2-3) |
Resolution: | T7: 16-bit |
Effective Resolution: | T7: 16 to 19 bit* |
Max Data Rate: | 100000 samples/second in stream mode (Appendix A-1) |
Sampling Modes: | Configurable as single-ended or differential |
Extended Channels: | The number of analog inputs can be extended to 84 with a MUX80 (AIN48-AIN127) |
T8
Analog Inputs: | 8 (AIN0-AIN7) |
Voltage Ranges: | ±11 V, ±9.6 V, ±4.8 V, ±2.4 V, ±1.2 V, ±0.6 V, ±0.3 V, ±0.15 V, ±0.075 V, ±0.036 V, ±0.018 V |
Resolution: | 24-bit |
Effective Resolution: | 15 to 22 bit |
Max Data Rate: | 400000 samples/second (in stream mode (Appendix A-1) |
Sampling Modes: | Simultaneous and differential |
Isolation: | 1000V |
Available AIN Channels
Each T-series device exposes:
Examples
These examples are primarily for programmatic control. If you intend to use our logging software such as LJLogM or LJStreamM, see our LJLogM Basics Guide.
To read AIN0 using LJM, read address 0 using a function such as eReadAddress.
To read AIN1 using LJM, read address 2 using a function such as eReadAddress.
Resolution Index
A higher resolution index results in lower noise and higher effective resolution but increases sample times.
A resolution index of zero instructs the device to to select the best resolution for the situation. The best resolution will depend on things like operating mode and sampling rate and will vary by device. Check the register descriptions below for device specific details.
Example
To read AIN1 with resolution index 4:
Set the AIN1 resolution index to 4 by writing 5 to AIN1_RESOLUTION_INDEX (address 41501)
Read AIN1
Remarks
For general discussion on the meaning of resolution, see the Noise and Resolution App Note.
Flexible I/O - T4 Only
Flexible I/O are I/O ports that may be configured as analog inputs, or as digital inputs or outputs.
AIN4-AIN11 are flexible I/O. To configure these channels as analog inputs:
Set the correct bit of DIO_INHIBIT to 0
Set the correct bit of DIO_ANALOG_ENABLE to 1
The bit to set of DIO_INHIBIT and of DIO_ANALOG_ENABLE is the same as the channel number. For example, to configure AIN4 (screw terminal FIO4) as an analog input:
Set bit 4 of DIO_INHIBIT to 0
Set bit 4 of DIO_ANALOG_ENABLE to 1
AIN0-AIN3 are dedicated analog inputs and cannot be configured as digital I/O.
Note that simply doing an analog read on AIN4-AIN11 automatically configures that line (FIO4-EIO3) as analog, so few people use the 2 registers mentioned above. See "Flexible I/O Auto-Configuration" in Section 13.1 Flexible I/O.
Single-ended or Differential - T7 Only
Single-ended AIN readings are read with ground (GND) as a reference point. Differential readings use a second AIN as a reference point. For more, see the Differential Readings App Note.
The AIN#(0:13)_NEGATIVE_CH and AIN_ALL_NEGATIVE_CH parameters configure whether the AIN performs differential vs. single-ended readings (not to be confused with bipolar and unipolar—the T7 is always bipolar).
When reading differential AINs, the positive AIN's configurations are used and the negative AIN's configurations are ignored. For example: when reading AIN0 with AIN0_NEGATIVE_CH is set to 1, the T7 will measure AIN0-AIN1 using the settings for AIN0 (such as AIN0_RESOLUTION_INDEX).
Example
To take a differential reading on AIN2, set AIN3 as its negative channel (AIN2-AIN3):
Write 3 to AIN2_NEGATIVE_CH (address 41002)
Read AIN2
To read AIN2 single-ended again (AIN2-GND):
Write 199 to AIN2_NEGATIVE_CH (address 41002)
Read AIN2
User software or the Register Matrix in Kipling can be used to configure any analog input as differential, or the Analog Inputs tab in Kipling can be used to quickly set AIN0/2/4/6/8/10/12 to differential.
Testing
Use 2 jumper wires to securely connect each analog inputs to VS or GND. Using the default +/-10V range the readings should be as follows:
AINpos(VS) and AINneg(GND) => 5 volts
AINpos(GND) and AINneg(VS) => -5 volts
AINpos(VS) and AINneg(VS) => 0 volts
Built-in AIN
For AIN0 through AIN13, differential channels are adjacent even/odd pairs such that the positive channel is even and the negative channel is greater than the positive channel by 1. Odd channels, such as AIN3_NEGATIVE_CH (address 41003), should not be written to because only an even channel can have an associated negative channel.
Temperature and Ground
AIN14 is the internal temperature sensor and AIN15 is GND. Neither can be read differentially.
Extended AIN
For AIN16 and greater, the rules for pairing differential channels is different. See 14.2 Extended Channels or the Mux80 datasheet for more.
Range / Gain - T7/T8
Internal Amplifier: The analog inputs are connected to a high-impedance instrumentation amplifier, as shown in Figure 4.2-2. This in-amp does the following:
T7
Buffers the signal for the internal ADCs
Allows for single-ended or differential conversions
Provides gains of x1, x10, x100, and x1000 (corresponding to ranges of ±10V, ±1V, ±0.1V, and ±0.01V, respectively).
T8
Buffers the signal for the internal ADCs
Provides gains corresponding to ranges of ±11V, ±9.6V, ±4.8V, ±2.4V,±1.2V, ±0.6V, ±0.3V, ±0.15V,±0.075V, ±0.036V, and ±0.018V.
Example:
The following example uses the T7 gain/range settings. The available gain settings vary by device.
If the voltage source connected to AIN1 has a known range of 0 to 0.7V, the appropriate range for AIN1 is the ±1V range. To read AIN1 with the ±1V range:
Write 1.0 to AIN1_RANGE (address 40002)
Read AIN1
The range registers (AIN#(0:13)_RANGE and AIN_ALL_RANGE) control the gain of the internal instrumentation amplifier.
Values written to RANGE are rounded up (except for values greater than 10.0, which are rounded down). For example, writing 0.5 to AIN_ALL_RANGE will set the analog input range to ±1 volts.
T-series devices know what the internal gain is set to and adjusts the return values to the voltage at the input terminals. If you connect a 0.8 volt signal to the input terminals, it will be amplified to 8.0 volts before being digitized, but the reading you get back will be 0.8 volts.
Settling - T4/T7
The T8 AIN do not require settling time because each AIN has a dedicated analog signal chain.
The settling registers set the time from a step change in the input signal to when the signal is sampled by the ADC, as measured in microseconds. 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 value 0 sets automatic settling, which is recommended for most applications. This "auto" settling ensures that the device meets specifications at any gain and resolution for source impedance up to at least 1000 ohms.
Example
To read AIN3 with a manual settling time of 500 µs:
Write 500 to AIN3_SETTLING_US (address 42006)
Read AIN3
Remarks
AIN#(0:13)_SETTLING_US and AIN_ALL_SETTLING_US do not apply to stream mode, though they do apply to all command-response communications, including AIN EF.
For stream mode, use STREAM_SETTLING_US to configure AIN settling. See configuring AIN for stream for more information.
The timings in Appendix A are measured with "auto" settling.
See the Analog Input Settling Time (App Note) for more details.
AIN Sampling Rate - T8 Only
The T8 temperature sensors and AIN are sampled at one consistent frequency determined by the AIN clock.
Writing to the register AIN_SAMPLING_RATE_HZ will set the sampling rate to the closest rate available to the AIN clock system.
The rate written to AIN_SAMPLING_RATE_HZ may not always match the actual sampling rate used. This is due to the AIN clock system having a limited number of valid clock base and divisor options that fit within the specifications of the T8 ADC.
The actual sampling rate used by the AIN clock system can be read from the register AIN_SAMPLING_TIME_ACTUAL_HZ.
When doing command response communications, the T8 will wait for the next set of AIN samples before returning the results. This means that it could take up to 1 / samplingRate seconds to acquire new AIN samples after requesting them. For example, if the AIN sampling rate is 100Hz, it can take 0-10 milliseconds to get new samples after requesting them.
The maximum sampling rate available depends on the resolution index used. We recommend using a resolution index of 0 (auto) to select the best resolution setting for the desired sampling rate. See Appendix A for more detailed resolution index and sampling rate information.
Due to a hardware limitation, the maximum sampling rate of the T8 temperature sensors is 250 Hz. The temperature sensors will return readings of -9999 if the sampling rate is higher than 250 Hz. See Section 18.0 Internal Temp Sensor for more information about the T8 temperature sensors.
Power - T7/T8
Some devices have the ability to power down the analog system to save power.
T7
The T7 can shut down most of its analog input system. This will save ~30 mA, see Table A5-6 for power consumption in different operating states.
When the T7’s analog inputs are disabled, the input multiplexors remain powered. This prevents the AIN system from drawing current from any connected signals.
The following registers control the power state of the T7’s analog inputs.
T8
The T8 has the ability to shut down individual AINs. This allows applications to enable only the AINs which are needed. Each of the T8’s analog inputs uses ~45 mA, see T8 Power Consumption for detailed power requirements.
Firmware 1.0033 made some changes to the way the AIN power states are controlled. Both the registers used and the way the startup is saved has been changed. The old register AIN_CHANNEL_ENABLE now behaves as an alias to POWER_AIN_CHANNEL_ENABLE.
POWER_AIN_CHANNEL_ENABLE and POWER_AIN_CHANNEL_ENABLE_DEFAULT are now the proper way to control the AIN power settings. Use the _DEFAULT to set the startup configuration. IOConfig will no longer save the enabled state for analog inputs.
Example:
To set AIN0 and AIN3 off and all other AIN on: write POWER_AIN_CHANNEL_ENABLE = 0b1111 0110 = 246.
To set AIN4, AIN5, and AIN6 off and all other AIN on: write POWER_AIN_CHANNEL_ENABLE = 0b1000 1111 = 143.
To configure the T8 to turn on AIN 0-3 when starting up, write POWER_AIN_CHANNEL_ENABLE_DEFAULT to 0b00001111 = 15.
Other Considerations
Streaming AIN
See 3.2 Stream Mode for streaming analog inputs. Some stream configurations override the normal AIN configurations:
Use STREAM_SETTLING_US instead of AIN_SETTLING_US.
Use STREAM_RESOLUTION_INDEX instead of AIN_RESOLUTION_INDEX.
Command-Response while Streaming
Command-response can be performed while a stream is active. If any of the channels in the scan list are analog inputs, then streaming needs exclusive control of the analog input system. The results is that analog inputs (including the internal temperature sensor) cannot be read via command-response while a stream is active.
Floating Inputs
The analog 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 the floating input application note.
Connections
For information regarding typical analog input connections, please see the Analog Input App Note.
Address Step Size
Addresses of the FLOAT32 type increment in steps of 2 because FLOAT32 uses two sets of 16-bits. FLOAT32 registers include AIN#, AIN#_RANGE, and AIN#_SETTLING_US.
Addresses of the UINT16 type increment in steps of 1 because UNIT16 uses only one set of 16-bits. UINT16 registers include AIN#_NEGATIVE_CH and AIN#_RESOLUTION_INDEX.
T7 Only: Duplicated Terminals (AIN0-AIN3)
AIN0-AIN3 appear on the built-in screw-terminals and also on the DB37 connector. Users 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.
Calibration
For command-response communication, analog input calibration is automatically applied by firmware and the AIN# registers return calibrated voltages. The AIN#_BINARY registers will return binary values from the converter.
For stream communication, the AIN# registers return raw binary values and calibration is automatically performed by LJM. For applications not using LJM, see the low-level Modbus streaming example.
Download To PDF
/scrollexportbutton