LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I need help with my ESP32 using VISA

Hi everyone, first of all I want to say that I am a beginner at this. I am using an ESP32 along with 3 sensors (humidity, temperature and water level) Each one gives a different value... How can I make each value be represented in a separate indicator? I tried with VISA but it gives me the 3 measurements together that I send to print to the serial monitor from the code.

0 Kudos
Message 1 of 3
(107 Views)

Depending on how often you send data, you must package it so you can reliably unpackage it properly.

 

Example,

You can send the data with a timestamp as well,

<Timestamp>,<Temperature>,<Humidity>,<WaterLevel><NewLine>

 

Now, when you read the serial in LabVIEW, you can split the data by <NewLine> and then split by comma, and knowing the order of fields, you can obtain the respective values.

 

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 2 of 3
(95 Views)

I'd recommend sending your message in the form of [ID][data][termchar]. Put a delimeter between each field, for example, a comma.

 

For example, "Reading,46,14,75" for values of 46% humidity, 14 degrees, and 75% full of water (or whatever).

 

ABSOLUTELY use a termchar. Then, you can set up VISA on LabVIEW to read until a termchar, then use Scan from String to get your values, like this:

 

Example_VI.png

 

On the ESP side (assuming you're using Arduino core), use Serial.printf(Reading:%f,%f,%f\n,humidity,temp,level)

 

(If you're not using Arduino there will be a similar printf style function you can use).

0 Kudos
Message 3 of 3
(77 Views)