LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview Communication between Arduino Uno (MQ2 and DHT11 Module)

I have been attempting to create a moving vehicle. This moving vehicle is the host of two sensors which are (MQ2 and DHT11 Module). I have been successful in getting Arduino IDE to give me the data which I have shared both Arduino Code, Screenshot of the data from the Serial Monitor and also the Vi. Currently not getting any readings. Please advise on what changes are required for me to accomplish my goal of illustrating the data on Labview Front Panel. 

Download All
0 Kudos
Message 1 of 5
(162 Views)

I couldn't open your VI because I don't have the latest LabVIEW version installed, but here's a couple tips for the most common mistakes.

 

I recommend you watch this video on serial communications: Proper way to communicate over serial

 

Send all of your sensor measurement data in one line separated by commas without any text labels. (You should know what order you are sending the data) 

 

Serial.println(temperature,humidity,airQuality);

 

Serial.println adds a CR (x0D) at the end automatically so you can use that as your Termination Character.  

 

Then it will be easy to parse the text to numerics in LabVIEW using Spreadsheet String to Array

 

SS2ACapture.PNG

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 2 of 5
(143 Views)

Housejams112_0-1744923593856.png

 

 

0 Kudos
Message 3 of 5
(88 Views)

Few suggestions for you:

 

1- We can't debug pictures very well, so please attach code using File -> Save for Previous back to 2022 or so.

2- You're enabling termchars (good!) but still using Bytes at Port. You don't need Bytes at Port.

3- Watch the video. It's got a lot of great info on it on how to process the serial data.

4- I'd recommend a slight change to your format; instead of just value/value/value, I'd do something like "temp=val1,hum=val2,"... etc. You can send that easily using printf from the Arduino, and you can scan that easily in LabVIEW using Scan from String. This will make debugging easier as you don't have to remember which thing is in which slash. I can't tell right now if you're sending multiple values per "burst" or just sending each value as separate print() statements, but I'd recommend using batches of all sensor values at once, separated somehow.

5- Your termchar is usually \r or \n. (I like \r myself but it doesn't matter). This termchar indicates the end of a message, so when you look for it in your format string it won't be in there since it's an indicator of the end of the message, and VISA will strip it out for you. So, use something other than the termchar to separate your values.

0 Kudos
Message 4 of 5
(66 Views)

@Housejams112 wrote:

Housejams112_0-1744923593856.png

 

 


 

You are using "Bytes at Port" so I can tell you have not watched the video I linked to above. 

 

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 5 of 5
(34 Views)