2.1 - AI0-AI7 [U12 Datasheet]
Hardware
The LabJack U12 has 8 screw terminals for analog input signals. These can be configured individually and on-the-fly as 8 single-ended channels, 4 differential channels, or combinations in between. Each input has a 12-bit resolution and an input bias current of ±90 µA.
Single-Ended: The input range for a single-ended measurement is ±10 volts.
Differential channels can make use of the low noise precision PGA to provide gains up to 20. In differential mode, the voltage of each AI with respect to ground must be between +20 and -10 volts, but the range of voltage difference between the 2 AI is a function of gain (G) as follows:
G=1 ±20 volts
G=2 ±10 volts
G=4 ±5 volts
G=5 ±4 volts
G=8 ±2.5 volts
G=10 ±2 volts
G=16 ±1.25 volts
G=20 ±1 volt
The reason the range is ±20 volts at G=1 is that, for example, AI0 could be +10 volts and AI1 could be -10 volts giving a difference of +20 volts, or AI0 could be -10 volts and AI1 could be +10 volts giving a difference of -20 volts.
The PGA (programmable gain amplifier, available on differential channels only) amplifies the AI voltage before it is digitized by the A/D converter. The high level drivers then divide the reading by the gain and return the actual measured voltage.
Figure 2.1-1 shows a typical single-ended connection measuring the voltage of a battery. This same measurement could also be performed with a differential connection to allow the use of the PGA. In general, any single-ended measurement can be performed using a differential channel by connecting the voltage to an even-numbered analog input, and grounding the associated odd-numbered analog input (as shown by the dashed connection to AI1 in Figure 2.1-1).
Figure 2.1-2 shows a typical differential connection measuring the voltage across a current shunt. A differential connection is required when neither leg of the shunt is at ground potential. Make sure that the voltage of both AI0 an AI1 with respect to ground is within ±10 volts. For instance, if the source (Vs) shown in Figure 2.1-2 is 120 VAC, the difference between AI0 and AI1 might be small, but the voltage from both AI0 and AI1 to ground will have a maximum value near 170 volts, and will seriously damage the LabJack.
Whether or not the ground (GND) connection is needed (Figure 2.1-2) will depend on the nature of Vs.
Figure 2.1-3 shows a single-ended connection used to measure the output voltage of a typical voltage-divider circuit. The voltage divider circuit is a simple way to convert a varying resistance (thermistor, photoresistor, potentiometer, etc.) to a varying voltage. With nothing connected to Va, the value of the unknown resistance, R2, can be calculated as:
R2 = Va*R1 / (Vs-Va)
where Vs is the supply voltage (+5V in Figure 2.1-3).
When Va is connected to AI0, as shown in Figure 2.1-3, the input bias current of the LabJack affects the voltage divider circuit, and if the resistance of R1 and R2 is too large, this effect must be accounted for or eliminated. This is true for any signal with too high of a source impedance.
All measuring devices have maximum analog input bias currents that very from picoamps to milliamps. The input bias current of the LabJack U12’s analog inputs varies from +70 to -94 microamps (µA). This is similar to an input impedance of about 100 kΩ, but because the current is nonzero at 0 volts, it is better to model the analog input as a current sink obeying the following rule:
Iin = 8.181*Va - 11.67 µA
Because the input bias current is known, as a function of input voltage, the simple voltage divider equation can be modified as follows to account for input bias current:
R2 = Va / [((Vs-Va)/R1) – (8.181µ * Va) + 11.67µ]
As an alternative to the equation above, Va can be buffered by a single-supply rail-to-rail operational amplifier, and the original simple voltage divider equation can be used. This solution works for any single-ended signal which stays between 0 and +5 volts. Some op-amp choices are:
TLV2462
LMC6482
MAX4166
Software
Readings from the analog inputs are returned by the functions EAnalogIn, AISample, AIBurst, and AIStreamRead.
EAnalogIn is a simplified (E is for easy) function that returns a single reading from 1 analog input channel. Execution time is up to 20 ms.
AISample returns a single reading of 1-4 channels, and takes up to 20 ms to execute, providing a maximum date rate of about 50 Hz per channel.
AIBurst acquires multiple samples of 1-4 channels at a hardware-timed sample rate of 400-8192 Hz. The acquisition can be triggered based on a change of state on IO0 or IO1. This function also returns the states of the IO pins (which are read every 4 samples).
Internally, the actual number of samples collected and transferred by the LabJack during an AIBurst call is the smallest power of 2, from 64 to 4096, which is at least as big as numSamples. The execution time of this function, in milliseconds, can be estimated as:
Turbo (default) => 30+(1000*numSamplesActual/sampleRate)+(0.4*numSamplesActual)
Normal => 30+(1000*numSamplesActual/sampleRate)+(2.5*numSamplesActual)
numSamples = numScans * numChannels
sampleRate = scanRate * numChannels
AIStreamRead is called periodically during a stream acquisition started by AIStreamStart. Each call retrieves multiple samples of 1-4 channels from the LabJack stream buffer, along with the states of the IO pins (read every 4 samples). Hardware-timed sample rates of 200-1200 Hz are available. If any function besides AIStreamRead is called while a stream is in progress, the stream will be stopped.