Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

NI USB-6218 voltage measurement issue

Solved!
Go to solution
Highlighted

Hi everyone ! I am a student and very new to this and am still getting familiar with the basics. I am working on a project with an electronic card.

I have to send some commands on the serial link of the card to activate and deactivate some I/O in order to measure different voltages on the card and to validate some tests. I want to automate these tests using python and the NI-DAQmx Python API.

 

Currently, I have 28 analog voltages to measure and 2 analog voltages to send that's why I am using the DAQ USB-6218 with its 32 analog inputs and its 2 analog outputs. Also, the input range of 10 V suits me perfectly due to the fact that most of my voltages are between 0 and 10 V.

However, I am getting some issues while measuring analog voltages greater than 5.44 V with my DAQ and the Python API ... for example, if I put a power source of 9 V on the AI4 in RSE MODE (I connected the ground to a AI GND port), when I am using the test panels, I can see my correct voltage but if I use the nidaqmx library on Python and if I am running this code :

import nidaqmx
import time

task_ai4 = nidaqmx.Task()  #port 24
task_ai4.ai_channels.add_ai_voltage_chan("Dev1/ai4",terminal_config=nidaqmx.constants.TerminalConfiguration.RSE)
time.sleep(2.0)

voltage_ai4 = task_ai4.read()
print("Tension sur le port AI 4 : ", voltage_ai4)
voltage_ai4 = task_ai4.read()
print("Tension sur le port AI 4 : ", voltage_ai4)
voltage_ai4 = task_ai4.read()
print("Tension sur le port AI 4 : ", voltage_ai4)
voltage_ai4 = task_ai4.read()
print("Tension sur le port AI 4 : ", voltage_ai4)

I get these outputs :

output_pb NI.png

 

I can't see where the problem comes from ... in fact this code is running perfectly for lower voltages ...

Here, a picture of the test I realised :

problème acquisition tension.png

I tested for different voltages and if it's greater than 5.44 V I will not get the correct voltage output on my python programm ... 

 

Any help would be greatly appreciated!! Thank you. 

0 Kudos
Message 1 of 3
(257 Views)
Highlighted
Solution
Accepted by topic author Quertsy

It sounds to me like maybe your device is defaulting to a +/- 5V input range and you're saturating it by feeding in >5V.

 

I don't know the Python syntax, but when you add your channel to the task there should be a way to specify a +/- 10V range.

 

 

-Kevin P

Message 2 of 3
(208 Views)
Highlighted

Hi Mr Price,

 

Thank you a lot for your answer, you are right, I had to add a minimum value and a maximum value in the declaration of the task, it's working perfectly now.

 

Best regards,

Quertsy

0 Kudos
Message 3 of 3
(187 Views)