12-05-2019 07:55 AM - edited 12-05-2019 07:56 AM
"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.
12-05-2019 08:12 AM - edited 12-05-2019 08:13 AM
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.
12-05-2019 08:15 AM
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.
12-05-2019 08:38 AM - edited 12-05-2019 08:38 AM
Yes thats correct, that 8516308 is the raw value of the ADC output in digital.
12-06-2019 03:24 AM
Can any one explain one solution for that conversion?
12-06-2019 03:34 AM - edited 12-06-2019 03:36 AM
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).
12-06-2019 03:46 AM
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
12-06-2019 04:06 AM
We will not get out of this unless you show us what you actually receive. Try to read a long string (say 100 characters).
12-06-2019 04:38 AM - edited 12-06-2019 04:40 AM
the read buffer the string only shows this:
My code
If not this, i don't understand how i make to read the string with 100 characters
12-06-2019 04:51 AM
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!