U3-HV Differential inputs | LabJack
 

U3-HV Differential inputs

10 posts / 0 new
Last post
Molesy
Molesy's picture
U3-HV Differential inputs

I am trying to measure differential inputs on AIN0 and AIN2 (+/-10V). I understand that for differential channel inputs you need to convert binary reading to voltages manually using the channel calibrations.  Is there a code snippet for VB.Net (2015) which can be used as an example?

LabJack Support
labjack support's picture
You generally don't read and

You generally don't read and apply the single-ended calibration constants.  Rather you just use the nominal formula:

Volts(uncalibrated) = (Bits/65536)*Span – Span/2 (Differential)

https://labjack.com/support/datasheets/u3/hardware-description/ain/binar...

... or better yet do your own calibration.  Note the counts at 0.0 volts and 1 other voltage that you measure with a DVM or some other device, and then come up with a formula you apply to your counts.

Molesy
Molesy's picture
So, on reading the

So, on reading the calibration section I wrote the following code to read the calibration constants stored in memory, read thedifferential inputs for AIN0 and AIN2 and then to convert the resulting bits to Voltage. Is this the correct interpretation of the manual?

Dim adblCalMem(32) As Double

' The calibration memory Is passed as doubles. The memory area consists of 16 blocks (0-15) of 4

' doubles each, for a total of 64 elements. Only blocks 0-7 are used.

' Read the calibration constants from memory

LJUD.eGet(u3.ljhandle, LJUD.IO.GET_CONFIG, LJUD.CHANNEL.CAL_CONSTANTS, 0, adblCalMem)

' AIN0

adCalOffsets(CHAN_0, GAIN) = adblCalMem(12)

adCalOffsets(CHAN_0, OFFSET) = adblCalMem(16)

' AIN1

adCalOffsets(CHAN_1, GAIN) = adblCalMem(13)

adCalOffsets(CHAN_1, OFFSET) = adblCalMem(17)

' AIN2

adCalOffsets(CHAN_2, GAIN) = adblCalMem(14)

adCalOffsets(CHAN_2, OFFSET) = adblCalMem(18)

' AIN3

adCalOffsets(CHAN_3, GAIN) = adblCalMem(15)

adCalOffsets(CHAN_3, OFFSET) = adblCalMem(19)

' Request a differential read of AIN0 with AIN 1 as low reference.

LJUD.AddRequest(u3.ljhandle, LJUD.IO.GET_AIN_DIFF, CHAN_0, 0, CHAN_1, 0)

' Request a differential read of AIN2 with AIN 3 as low reference.

LJUD.AddRequest(u3.ljhandle, LJUD.IO.GET_AIN_DIFF, CHAN_2, 0, CHAN_3, 0)

' Execute the requests.

LJUD.GoOne(u3.ljhandle)

' Get the AIN0 & AIN1 voltage.

LJUD.GetFirstResult(u3.ljhandle, LJUD.IO.GET_AIN_DIFF, 0, dBits0, 0, 0)

' Get the AIN2 & AIN3 voltage.

LJUD.GetNextResult(u3.ljhandle, LJUD.IO.GET_AIN_DIFF, 0, dBits2, 0, 0)

' Convert Chan0 Bits to Volts

dChan0 = (dBits0 * adCalOffsets(CHAN_0, GAIN)) + adCalOffsets(CHAN_0, OFFSET)

' Convert Chan2 Bits to Volts

dChan2 = (dBits2 * adCalOffsets(CHAN_2, GAIN)) + adCalOffsets(CHAN_2, OFFSET)


LabJack Support
labjack support's picture
Before we dive into this code

Before we dive into this code, it really does not make sense to apply the single-ended cal constants to the differential readings.  I believe you will get values that vary from 0-7.5 volts, when in fact the actual voltages vary from -10 to +20 volts.

Molesy
Molesy's picture
Apologies, now I understand.

Apologies, now I understand.

To get two input channels, +/- 10 volt range, in differential mode - is the following code correct? Then once I have the bit values I can apply my own calibration (using controlled voltages) as you previously stated.

' Request a differential read of AIN0 with AIN 1 as low reference.

LJUD.AddRequest(u3.ljhandle, LJUD.IO.GET_AIN_DIFF, CHAN_0, 0, CHAN_1, 0)

' Request a differential read of AIN2 with AIN 3 as low reference.

LJUD.AddRequest(u3.ljhandle, LJUD.IO.GET_AIN_DIFF, CHAN_2, 0, CHAN_3, 0)

' Execute the requests.

LJUD.GoOne(u3.ljhandle)

' Get the AIN0 & AIN1 voltage.

LJUD.GetFirstResult(u3.ljhandle, LJUD.IO.GET_AIN_DIFF, 0, dBits0, 0, 0)

' Get the AIN2 & AIN3 voltage.

LJUD.GetNextResult(u3.ljhandle, LJUD.IO.GET_AIN_DIFF, 0, dBits2, 0, 0)

LabJack Support
labjack support's picture
Yes, use that code to get the

Yes, use that code to get the binary counts, then as you describe you can use a slope/offset formula you come up with.

Or you can just use the nominal formula, as least to start. A count of 0 corresponds to -10.3 and a count of 49152 corresponds to +20.1V (it can only use 3/4 of the binary span), so:

slope = 30.4/49152 = 0.000618 volts/count
offset = -10.3 volts

Molesy
Molesy's picture
Thank you. I'm confused,

Thank you. I'm confused, could you explain why 49152 is +20.1V and not +10.3V?

LabJack Support
labjack support's picture
Sorry, I was getting confused

Sorry, I was getting confused with the "special range".  The following should be right.

The differential low voltage input range of the converter is +/-2.44V.  This corresponds to 0-65535 counts.

The scaling circuitry converts the high voltage +/-10.3V to low voltage 0-2.44V.

AIN0=+10.3V   -->  +2.44
AIN1=-10.3V    -->  0.0
Diff=+20.6V    --> +2.44

AIN0=-10.3V    -->  0.0AIN1=+10.3V    -->  +2.44
Diff=-20.6V    -->  -2.44

So for differential high voltage the range is +/-20.6V.

slope = 41.2/65535 = 0.000629 volts/count
offset = -20.6 volts

OGUZHAN
OGUZHAN's picture
Hello

Hello

I have Labjack U6, for my experiment, I need calibration for kPa. Please can you write me the formulation like y=?.

Regards

LabJack Support
labjack support's picture
To convert to kPa we need

To convert to kPa we need information about the sensor you are using. Most sensors will have information in their datasheet about converting from voltage to pressure. If such information is not available you may have to do your own calibration.

 

By measuring the voltage at two or more known pressures, then produce a best fit curve. If the sensor has a non-linear response more than two points will be necessary. Depending on your equipment it may be easier to just replace the sensor with one that has good documentation.