03-07-2017 03:38 AM
Hi, I have 3 sensors measuring, humidity,temperature,lightintensity and soli moisture that I need to represent in different Numeric Indicators on the front panel. I want to represent the measurements in a PI&D that I drwa on the front panel.
I have built a simple labview program that recieves the Serial data from Labview by using VISA Serial and VISA Read Blocks.My problem is that the data comes as a stream of numbers , somtehing like this:
Time_Temperature_Himidity_Moisture_Light intensity
1s 20 20 4 3
2s 20 20 4 3
.
.
.
.
. etc
I just dont know how to split this String into several strings and show them in separate Numeric Indicators so that I have overview of the measurements from each of the instruments?
I tried String Split/Search Block, but didnt manage to achieve it.
Need some tips here.
03-07-2017 03:51 AM
Assuming you are using the PrintLn() command, you can just use the Spreadsheet String To Array to parse the string. You can then use Index Array to get your individual measurements.
03-07-2017 01:51 PM
I tried your tips but not getting there
This is my code from arudino sketch that generates the serial data measurements:
Serial.println(String(hours) +" " + String(moistureValue) +
" " + String(pResistorValue) + " " + String(humidity) +
" " + String(temperature));
I have attached the blockdiagram and frontpanel.
I am not completely certain how this Spreadsheet String To Array works? I am getting only one value, the value showing elapsed time.The sensor value I am not able to see
What is this delimiter tab and Array type. I dont know how I can change or expand the array size?
03-07-2017 02:18 PM
The delimiter is the character that separates the values in your data string. The default is tab, but in your case it appears to be a space, so you need to wire a single space character to that input so Spreadsheet String to Array knows how to break your string apart.
03-07-2017 02:39 PM
1. It looks like your delimiter (the character you use to separate your measurements) is a space. So use the Space Constant and wire that up to the Delimiter input.
2. Since you are processing a single line, change that array type to a 1D array (shrink the array index to 1 item).
03-07-2017 02:51 PM
I have tried as you suggested to add a space " " in the delimiter , but it hasnt changed anything.I am only getting one value after the Spreadsheet to Array function block and that is elapsed time. I dont know how to pull the others?
I need to get the front panel to something like the attached image of the frontpanel.
This is my goal.As you can see on the P%ID the indicated sensor values on the P%ID drawing are normal sensor values coming from arudino serial monitor and getting read in Labview.
03-07-2017 06:01 PM
You need to attach your actual VI in order for us to help. But my current thought is that you are not letting the termination character stop the read and you are therefore only getting part of the message. But that is just a complete guess without seeing the code.
03-08-2017 02:44 PM
I have managed to get the data from Serial measurements in Arduino in the individual indicators representing each sensor.Please view the attached JPG files. I have also added the VI file now.
What is bugging me now is that measurements are not updated continuously. It seems like I" lose" the measurement data , and the indicators show zero "0" even though the measurements are not suppose to change.
The Labview is not updating the measurement data every 0,5s as specified, but has a lag.
I dont understand why
03-08-2017 04:54 PM
How often is your Arduino sending the data? LabVIEW can only get the data at the rate it was sent.
03-16-2017 01:19 PM
@crossrulz wrote:
How often is your Arduino sending the data? LabVIEW can only get the data at the rate it was sent.
My arduino sketch sets the data to Serial.begin(9600);, means 9600 bps for Serial communication between arduino and labview I guess.