LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview not updating from Arduino input

Solved!
Go to solution

Hi,

 

I am working in a VI that uses VISA to read the serial port from Arduino Uno at the same time as a webcam records on real time. I was testing how a bar changes its value as I change the A1 input from GND to 3.3 V but it makes weird things. First, it was oscillating continuously from maximum to a minimum (which is not 0 because of the content inside while loop, but that's not the point), then I decided to turn off my wireless mouse in case that was the origin of oscillations and it seemed to stop. However, later on it got stuck in the maximum even if I disconnected it and put it to GND. Not even restarting the execution, restarting Labview or my PC it would change. What is causing that? The real system for the application is much more complex and it seemed to work on lab but not now with the simple thing of changing A1 from 3.3 V to GND.

 

Thanks!

0 Kudos
Message 1 of 13
(315 Views)

Hi I wasn't able to open your file, can you save it for version2020 ? 

First check if the signals from Arduino are working well. connect A I to GND and then to 3.3 to see if the readings are correct. 

If it's not, then run a sanity check procedure: without Labview, run the Arduino Example AnalogInOutSerial.ino, this example will read analog input and read te serial port to check that the Arduino is working. From what you are describing it looks like thereis something wrong with the arduino (if you disconnect the A1 from 3.3. to GND). 


Check the cables, and verify that you're using the right terminals(sounds silly , but you never know what we do sometimes).

 

RKO
0 Kudos
Message 2 of 13
(302 Views)

Tell me if you can open it now, please. I opened serial monitor in Arduino and the changes DO happen. 3.2 approx in 3.3 V and 0.0 V in GND.

0 Kudos
Message 3 of 13
(298 Views)

So I tried it again and this time it worked but without the camera. I didn't restart anything. But again if I put cam1 which is none (cam0 is my PC webcam and cam2 is the external I plug in) it makes some oscillations between maximum and minimum. Why does it work so badly?

0 Kudos
Message 4 of 13
(294 Views)

Hi yes, I can open the file. 

Good that means your arduino is working fine. Now upload your original Arduino ino code, and create an indicator on the string coming out of the VISA Read and see if it changes as you change from 3.3 to GND. 

ROtake_0-1715620332073.png

 

RKO
0 Kudos
Message 5 of 13
(292 Views)

No, it doesn't change while running. And after restarting execution sometimes it changes and sometimes it doesn't. And when it changes it may return to the previous value. It can also be seen from the bar in the front panel, by the way. 

0 Kudos
Message 6 of 13
(273 Views)

Well your LabVIEW for receiving the data from the Arduino looks okay, but what about your Arduino code?

 

Are you sending the termination character?

 

If you are using Serial.print() you need to add that LF yourself as the Arduino does not automatically send a LF. 

 

If you use Serial.println() the Arduino automatically adds a LF to the end of every serial transmission. 

 

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 7 of 13
(249 Views)

yes, Serial.println(). Have a look in the picture to the code.

bitsandscience_0-1715622775938.png

 

0 Kudos
Message 8 of 13
(239 Views)

I tried with another board (Arduino Mega unofficial board) and it works but:

- It takes some seconds to update.

- It doesn't work if the camera is on. Why? Any solution for this?

0 Kudos
Message 9 of 13
(228 Views)
Solution
Accepted by topic author bitsandscience

maybe the camera code (calls from the camera) are interfering with the serial reading making it to loose data. 

for debug purposes, disable the camera code from the loop and see if the seria read works better. 

You may need to create a parallel loop with the camera. 

 

RKO
Message 10 of 13
(225 Views)