U3-LV read analog with FIO | LabJack
 

U3-LV read analog with FIO

5 posts / 0 new
Last post
ycyeh
Yuan-Chen Yeh's picture
U3-LV read analog with FIO

Hi,

I'm trying to read the analog out put from DAC0 with FIO0, here is my code:

 

DAC0_VALUE = d.voltageToDACBits(1.5, dacNumber = 0, is16Bits = False)

d.getFeedback(u3.DAC0_8(DAC0_VALUE))

d.configAnalog(u3.FIO0)

ainValue = d.getAIN(0)

print(ainValue)

 

I expect to get 1.5 but it gave me something different, what should I change here? Thanks

LabJack Support
labjack support's picture
Your code runs fine when I

Your code runs fine when I tried it. I would add for better accuracy that after opening your U3, make sure to add a call to get the calibration from the device.

d.getCalibrationData()

Regarding your reading, make sure to have a wire/jumper connecting AIN0 to DAC0, and that the connection is secure in the terminal (screwed down on the wire).

If that doesn't help, what readings are you getting?

ycyeh
Yuan-Chen Yeh's picture
It returns 0.4427111865952611

It returns 0.4427111865952611, also, this number doesn't change when I change the code from 

DAC0_VALUE = d.voltageToDACBits(1.5, dacNumber = 0, is16Bits = False)

to

DAC0_VALUE = d.voltageToDACBits(3.0, dacNumber = 0, is16Bits = False)

 

I do connect the wire from DAC0 to FIO0 (I assume this is equivalent to AIN0?)

LabJack Support
labjack support's picture
AIN0 is equivalent to FIO0

AIN0 is equivalent to FIO0 when you enable analog on FIO0.

If you are on Windows, I would suggest testing the same functionality in the test panel of LJControlPanel.

If you are not on Windows, try wiring AIN0(FIO0) to GND instead of DAC0. Does this print 0 in your program?

*Edited because you have an LV unit and will not get good readings wiring AIN0 to VS.

ycyeh
Yuan-Chen Yeh's picture
I tried to tighten the screw

I tried to tighten the screw and it's working now both in python and LJControlPanel. Thanks very much for the response!