07-05-2023 02:25 PM
Hi, Hope all is well. I have an issue with a vi that i was trying to write that read voltages into a MyDaq on ai0 and ai1. I thought it was working as i had connected a battery pack connected to both ai0 and ai1 that read in the 3 volts, it wasn't until i disconnected the ai1 voltage that i realised there was still a voltage being shown on ai1, after trying rewriting using daq assistant i keep getting the same issue i always get a voltage showing on both inputs. This is the first time ive tried using the myDaq for multiple input voltage(im looking to set up a ldr circuit on each input and detect if two leds are on). Could someone check please if im using the array wrong or if im just not setting up multiple channels correctly. Any help will be greatly appreciated.
Solved! Go to Solution.
07-05-2023 02:35 PM
Is the voltage showing even after you disconnected the battery? And you want to read zero when disconnected, but you are reading some value. is that right?
I just want to understand your issue.
07-05-2023 02:41 PM
Thanks for the quick reply, when i have the battery connected to just aio im getting a reading from the vi on both aio and ai1 even though there is no physical wiring now to ai1,initially i had both ai0 and ai1 connected to the battery and assumed everything was ok , buit now there is only aio connected but the vi is showing a reading ai1.
So i thought either im not setting multiple channels correctly and just reading of the one or i havent set the array up and am getting the same result on both indicators.....hope im making sense
07-05-2023 03:01 PM
Those channels are multiplexed. When you leave the input open but include it in a scan the channel will usually read whatever voltage was read on the previous channel because there is no current path to discharge the tiny parasitic capacitance on the analog input of the AD converter directly behind the multiplexer. Try to shorten the open input to GND and it should read the 0V you were expecting.
07-05-2023 03:07 PM
Hi Rolf, i just tried that . I shorted agnd to 1+ and 1- and im still seeing the 3v that im inputting to only 0+ 0- (0- is shorted to agnd)
thanks
07-05-2023 03:35 PM - edited 07-05-2023 03:37 PM
I am surprised that it's still reading 3V even when you short it to GND. Now I am curious to see how you wired it. Can you share it sketch? And What NI device are you using?
Can you check that voltage with a multimeter? Just check if 3V is really 3V.
If your multimeter is not reading 3V or if it's reading around 0 V. You can modify your code so that when nothing is connected, it can read 0 instead of 3V.
07-05-2023 04:01 PM
GRCK5000, here's the thing when i measure the the voltage at ai0 i get 3.2V (expected), when i measure the voltage at ai1 i get 2v (although it is reading 3.2v on the vi).
I then disconnected the aio wiring and connected it to ai1 , i now get the 3.2 v on ai1 as expected but get 2V at aio...again the vi is reading 3.2v on both inputs, with 1 disconnected.
i tried also chasnging the input to nsre, which i couldnt do when i tried daq assistant
im using a ni myDaq
07-05-2023 04:44 PM - edited 07-05-2023 05:02 PM
Try wiring like this below, but set your device to single ended or differential as I'm showing with the code below. Each one of these has its own way of wiring as I show below.
Note:
SINGLE ENDED CONNECTION:
OR
DIFFERENTIAL CONNECTION:
Try this schematic above with the attached code. Let us know if it works.
07-06-2023 01:33 PM
HI GRCK5000, I think youve nailed it with the differential setting, i had a problem with that setting with the daq assistant as well as the Daqmx setup, it would default to default(?), but after adding a control to the Daqmx it seems to allow me to the input terminal configuration with no issues. For some reason though the RSE still reads 0v need to look into that one why (maybe try adding 100k resistor to ground), i've updated the original vi i was writing and this now allows multiple channels and outputs the corresponding values i need , just still to add in some greater than logic etc to the vi and once i make up the ldr circuits to read the voltage i can determine what voltage values are on and off. i have the possibility now to trial other circuits on the bench.
thanks for all you help and taking the time correspond, it was greatly appreciated
07-06-2023 03:49 PM
You're welcome Chizzy42. I find pleasure in helping others. Any new questions you have, please post it.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ John 14: 6 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~