09-14-2015 10:25 AM
Hello,
I am working on a project to make the LPMS-B accelerometer, gyro and magnetometer livestream in LabVIEW.
I managed to connect the sensor to LabVIEW and read out hexadecimal data.
I have a table to decode the hexadecimal data, but I am a little stuck with some problems.
As you can see in the attached files, '3A' is the packed start and '0A' the end, everything in between is measurement data.
But when I search for those values and put the string in an array (see attachment 'array.png') the length isn't constant.
There is a length that is most common, and it has a length of 206 characters. But when I look in the table, there should only be 134 characters in one line.
What am I doing wrong?
Here is a link to the guide: http://www.lp-research.com/wp-content/uploads/2012/05/LpmsAllUsersGuide1.3.4.pdf
I hope you understand my problem and you can help me about how I should take it further from here.
Thank you!
09-14-2015 10:52 AM
It all seems wrong (Sorry, I haven't done any Bluetooth, so my comments are more general).
Aren't there some good examples that do exactly what you want to do?
09-15-2015 04:27 AM
Thank you for your reply.
The bytes to read are 999 and mode is standard. I am not sure if this is correct, but it is working right now.
For the match pattern function, I see I made a mistake. The upper loop has to stop, when the match pattern function will not find any matching patterns anymore. In that case, it will return -1. I made the mistake, by comparing the wrong output of the match pattern function to 0. I will correct that.
I see that the property node is not necessary, I will fix that.
What exactly do you mean with the =0 primitive?
What I want to do, is livestream the accelerometer in LabVIEW and visualize it, and eventually be able to analyze the data.
Please have a look at the attached images, maybe that makes it more clear what I want to do.
In the selected section 1, I'm reading in the accelerometer, but the data that comes out of that is very scrambled (outcome.png)
In section 2 I'm converting that to hexadecimal data, which I should beable to decode with the table I have (but that is where I am stuck now)
In section 3, I am selecting everythin that starts with 3A and ends with 0A, the start and end codes according to the manual. Everything in between should be data.
But the problem now is, that the length of those lines that start with 3A and end with 0A are not always the same length. According to the table in the manual, I would expect lengths of 134 characters, which would make it easier, because then I would know which hexadecimal data belongs to which function of the sensor.
I hope that I explained it correctly, but if you have any more questions, please let me know
09-16-2015 02:52 AM - edited 09-16-2015 02:54 AM
What happens if the data string also contains the start value 0x 3A ?? Record some raw data and check your seperation routine.
And since the data length AND a check sum are included, why not use them?
(since they mentioned MODBUS, maybe have a look at the MODBUS driver as a startpoint)
Have you asked the vendor for a LabVIEW driver ? Maybe they already have one 😉