LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Arduino Serial connection problems

Solved!
Go to solution

Hello, I am hoping to get some advice on a project I am working on.

Task:

I am using two microcontrollers. 1 for a serial connection to LabVIEW from Arduino which is running two libraries on the UNO; the first library is the LUX sensor and the second library is for temperature and Humidity.

 

The other  Microcontroller is for LabVIEW using LIFA to control some PWM ports for the motor, LED lights RGB, and a heater.

 

The 3 columns of data is registered in the UNO and sent to LabVIEW. When I receive the data I am using them for the following.

  • an output of the Temperature for PID control
  • Lux for the indicator on the RGB interface
  • Humidity for indicator
  • Temperature on the figure for display

Problem:

The process variables I mentioned are not updating as fast i would like hence as you notice on Arduino file 1b the updates are pretty immediate. But when i read them in LabVIEW interface the updates are not as fast. How would i go about increasing the response time?

 

Please help

I have posted 3 images.

Image (1a AND b) = arduino file

Image (2a AND b) = LabVIEW block diagram

Image (3) = Labview interface

 

 

Download All
0 Kudos
Message 1 of 3
(2,115 Views)
Solution
Accepted by topic author xxAddictionxx

1. It would be A LOT easier on everybody (including yourself) if you would have just posted the actual code (text file, VI) instead of images that get blurry when you try to zoom in to read it.  It would also have been 2 downloads instead of 5.

 

2. DO NOT USE THE BYTES AT PORT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Your Arduino is using the printLn() function, which appends a Carriage Return (0xD, CR) and a Line Feed (0xA, LF) to the message.  So we know we got the full message when that termination character is read.  And your VISA setup is already correct for this (the defaults on the VISA Configure Serial Port enable the termination character and set it to the Line Feed).  So just get rid of that Bytes At Port and just wire up a value that is greater than any message you should ever get back (I like to use 50 or 100).

 

3. You set your loop rate in the LabVIEW code to 1 second!  There is no reason for that.  In fact, I would just get rid of that wait since your VISA Read will limit your loop rate (you get a message every ~250ms).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 3
(2,093 Views)

Gday mate,

 

Your advice was harsh but muchly welcomed it all works well and fine now! I'm a bit of a noob to the LabVIEW community, will make sure next time I post VI

 

Kudos to you sir 🙂

0 Kudos
Message 3 of 3
(2,079 Views)