Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Different read out analog value if read out in separate task than in a task together with other channels [Python]

Hi all,

 

This is my first post, but sure, this is the reason I'm here 🙂

 

So I have a problem which I cannot explain myself as it applies only to certain inputs. I give you an example with ai5.

Depends if I read it out together with other inputs within a single task I get different value than reading it out in dedicated task.

 

If I read ai5 together with other inputs within single task:

with nidaqmx.Task() as task:
task.ai_channels.add_ai_voltage_chan("cDAQ9188-1D87353-ADCMod1/ai0", max_val=1, min_val=-1,
terminal_config=TerminalConfiguration.DIFF)
task.ai_channels.add_ai_voltage_chan("cDAQ9188-1D87353-ADCMod1/ai1:7", max_val=0.2, min_val=-0.2,
terminal_config=TerminalConfiguration.DIFF)

task.ai_channels.add_ai_voltage_chan("cDAQ9188-1D87353-ADCMod1/ai16", max_val=0.2, min_val=-0.2,
terminal_config=TerminalConfiguration.DIFF)
voltage_drops = task.read()

voltage_drops = [0.1845248855733148, 0.012216625546014387, 0.16293956708634108, 0.16425462933430135, 0.0916508606613959, 0.05050356282466653, 0.00584533844987022, 0.009796982909236565, 0.0665666268943908]

ai5=0.05050356282466653

 

if I read it out in a dedicated task:

with nidaqmx.Task() as task_:
a_diff_inputs_batt=task_.ai_channels.add_ai_voltage_chan("cDAQ9188-1D87353-ADCMod1/ai5" , max_val=0.2, min_val=-0.2,
terminal_config=TerminalConfiguration.DIFF)
voltage_drops[5] = task_.read()


ai5=0.024150463222692115

 

I attached the scope view of the same input. As you see reading it out separately gives correct result, but reading out together with others gives way different result, and I have no idea where to look.

 

Till now I observe the same issue with ai5, ai6, ai7, ai19 ai27.

 

0 Kudos
Message 1 of 13
(724 Views)

What kind of signals are connected to those channels?

Note that NI does not specify what voltage a device will read when there is no signal connected. (Incorrect Readings on Unconnected or Open Channels of DAQ Device)

-------------------------------------------------------
Control Lead | Intelline Inc
0 Kudos
Message 2 of 13
(707 Views)

Hi ZYOng

All those signals read the voltage drops across shunt resistors.

As mentioned above, if I read the signals in TestPanel of NI tool, or if I read them sequentially in separated tasks all is correct.

However if I create a task with multiple signals then the value of few of them is not as expected.

0 Kudos
Message 3 of 13
(657 Views)

You're experiencing ghosting - read this article https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000YHy6CAG&l=en-US

The best fix is to use a current shunt amplifier in-between the shunt and DAQ

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
Message 4 of 13
(634 Views)

wow, I must say I really did not expect that 🙂 Thanks for the hint

 

Maybe you could propose how should I proceed? I would like to rather avoid modifying HW.

In my system I measure current consumption of different components by measuring the voltage drop over shunt resistors and then multiply it by a voltage measured on the inputs of all components.

ai0 - voltage drop over shunt (-1:1)

ai1:7, ai16 - voltage drop over shunt (-200m:200m)

ai19:ai23, ai27:ai30 - input voltage at the component side (-10:10) (measured via 2M:1M voltage divider as my system is working with 24VDC)

 

I did some tries with task creation in NI-MAX to try to understand the issue, however even going as low as 10Hz I couldn't get the correct read out on ai5.

Can it be related to the fact that via ai5 I measure the shunt current on the input of a Lithium battery?

 

0 Kudos
Message 5 of 13
(621 Views)

High-side current shunt measurement is tricky, what is your common-mode voltage for this AI5 measurement?

 

If you tried all the proposed software methods to fix ghosting and still didn't, then your only option is to add an OPAMP buffer for voltage

dividers and a current shunt amplifier for your current shunts.

 

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000P84RSAS&l=en-US

https://www.ni.com/en/support/documentation/supplemental/12/using-a-unity-gain-buffer--voltage-follo...

 

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
Message 6 of 13
(616 Views)

I'm okay with some delay before sampling or ignoring few samples but I believe I didn't find yet correct python function and parameters.

I'm using AnalogMultiChannelReader() method to get the samples from all channels in the single stream. 

My understanding is that the inputs are multiplexed after each sample taken. I'm looking for how to make the switching after few samples or how to delay them to allow for some settling time.

 

 

Common mode for all shunts is in range of 23-28V

I checked and if I create every time a new task to get a sample from each channel separately the values are correct, but I guess it's not the most optimal way, as it takes 22ms to get just one sample.

 

0 Kudos
Message 7 of 13
(611 Views)

FYI - you're operating the 9205 outside its specification, and permanent damage is possible.

 

As per the specs, any analog input must be within 10.4V of COM. In your current shunts, the signal is up to 28V from COM.

 

santo_13_0-1705413403771.png

 

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 8 of 13
(607 Views)

Sorry, my mistake, COM is tied to 24V. 

The signals are up to 28V from the GND

0 Kudos
Message 9 of 13
(601 Views)

I could not solve the problem, I guess I need a help from somebody proficient in Python API.

 

I'm looking for one of 2 solutions:

- Introducing kind of settling time between choosing the channel and sampling the analog value (while keeping the streaming method)

- While keeping the round robin read out cycle, reading multiple samples from single channel before switching to the next one i.e. ai0, ai0, ai0, ai0, ai0, ai1, ai1, ai1, ai1, ai1, ai2, ai2, ai2, ai2, ai2 and so on instead of ai0, ai1, ai2, ai0, ai1, ai2, ai0, ai1, ai2, ai0, ai1, ai2, ai0, ai1, ai2

 

0 Kudos
Message 10 of 13
(486 Views)