LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert data received in USB port

"Value of tension".   Is this some sort of force sensor?

 

I don't see how the string you gave will convert to a string of 7 ASCII-readable digits.   If these represent binary values, so lets say the last 3 characters are the 24 bit value (odd that is wouldn't be 16 or 32-bit), then I would have expected some of the bytes to be unreadable in a string control.

 

Is it possible that the developer of the Arduino did the data in multipe lines,  Like the did a Println(timestamp) followed by a Println(data)?  If so, you might need 2 reads to get the data.  Perhaps this first value is just a ASCII-readable representation of time.  Perhaps number of seconds since the beginning of the day?  But 7 digits just doesn't seem to be enough data to represent a date AND time.

 

You're going to need to get a hold of the documentation or developer.

 

 

0 Kudos
Message 11 of 24
(1,323 Views)

The sensor is a magnetoresistive sensor that in turn will detect voltage variations on a Wheatsone bridge and the idea is through the voltage value and through spectral analysis across the frequency spectrum apply maintenance predictive , this is a prototype sensor and the idea is put it to work as an accelerometer.

 

Yes i need two reads of data, one to timestamp and another to the tension value, but my big problem is how i make the conversion of string to the values i want. I've tried with the Scan from String.vi but i got an error 85  whem i tried obtain the two values. The message is sent in 24 bits.

 

 

I attached my vi.

0 Kudos
Message 12 of 24
(1,314 Views)

Tension is probably a voltage ("tensione" in Italian).

We may suppose that 8516308 is the raw value of the ADC output. Since it's a 24 bits, the output range is 0-16777215.

Thus, 8516308 would represent 0,5076 of the full range.

For example, if the input range is 0-5 V, the measured voltage is about 5 * 0,5076 = 2,538 V.

Sounds correct? However, as RavensFan pointed out, there is no room for the timestamp here.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 13 of 24
(1,309 Views)

Yes thats correct, that 8516308 is the raw value of the ADC output in digital. 

 

 

0 Kudos
Message 14 of 24
(1,302 Views)

Can any one explain one solution for that conversion?

 

0 Kudos
Message 15 of 24
(1,260 Views)

So, IF the received data are similar to "05/12/2019 11:58:42 0,455149" , like in your second example, the right format string may be "%<%x %X>T %f". It works for me, however %x and %X depend on regional settings, so it may not work for others.

However, it seems that this is not what you get, since that string is more than 16 characters long (as you read from the serial port).

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 16 of 24
(1,256 Views)

can i asked to you if you can provide an example in code, i'm trying with the " Scan from String" but i've got an error when i run the VI file. I attached the vi file with the scan from string

smalhao_0-1575625522600.png

0 Kudos
Message 17 of 24
(1,252 Views)

We will not get out of this unless you show us what you actually receive. Try to read a long string (say 100 characters).

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 18 of 24
(1,250 Views)

the read buffer the string only shows this:

 

smalhao_0-1575628586443.png 

My code

smalhao_0-1575628783731.png

 

If not this, i don't understand how i make to read the string with 100 characters

0 Kudos
Message 19 of 24
(1,243 Views)

Temporarily, wire false to "Enable termination char" which is an input terminal of VISA Configure Serial Port. Wire 100 to the Read function.

After reading something meaningful, stop the vi. Right-click on "read buffer" and choose Create constant. Save the vi and attach it to your post. Send the vi, not a picture!

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 20 of 24
(1,239 Views)