I am trying to establish serial communication between DASYLab and an MPU sensor (MPU 9050). From what I've read, DASYLab handles serial communication through the RS-232 serial protocol whereas the sensor seems to use the I2C communication protocol. Is the only fix to use and I2C RS232 adapter or is there a workaround within DASYLab?
Solved! Go to Solution.
If it's not straight serial, then you would need to write a driver
If, when connected to the PC, it enumerates a COM port, then the DASYLab RS232 Input can read it.
I connected the sensor to an Arduino which enumerates a COM port. Now I just have to parse the signal.
Thank you for your help.
I currently have a continuous data string stream as the sensor is continuously outputting. This is shown below. I am now trying to have 6 channels within a single RS232 module with each reporting one of the six numerical values. Following a bit of research, I know this can be done using the “Measurement data format” field. I have been playing around with it but have not been able to figure it out.
Note that I have control over the formatting of the string and can therefore remove the RX, RY…. labels if needed.
Well done! You're almost there.
each value has a two character identifier.
For each channel, enter "RX " a\x20
where the quoted string matches the next value.
The last channel will be "AZ " a \r\n
DASYLab will look for the quoted string, so the channels should be in order, RX, RY, RZ, AX, AY, AZ
Once it has found the string, it will interpret the next characters as number values until the delimiter -- the space character.
So, accounting for all of the characters on the line, up to and including the <CR><LF>, this is the channel string.
Ch 0: "RX " a\x20
Ch 1: "RY " a\x20
Ch 2: "RZ " a\x20
Ch 3: "AX " a\x20
Ch 4: "AY " a\x20
Ch 5: "AZ " a\r\n
I did as you instructed and it seems to identify the strings correctly and the associated values (I did have to delete the space between the string identifier and numerical value).
Could you explain the data format a little more. I understand the string identifier, but I do not understand where a\x20 and a\r\n come from. Also, what exactly do you mean by channel string?
Thank you so much for the help.
a tells DASYLab to look at the characters and make them into numbers, delimited by some other character -- space, comma, return, etc.
DASYLab has short cut notation for tab \t, return \r and linefeed \n, but not for comma or space. So, you have to use the hex value for that character -- 0x20 is space, 0x2c is comma.
So, a\r\n tells DASYLab to identify the first number on the line that ends in <CR><LF>
a\x20 tells DASYLab to identify a number followed by a space.
Your string is space delimited until the end of the line.
DASYLab is scanning the buffer, from left to right of the line. For your string, we need to anchor each value with the two character text field -- that's the search string and then tell it what characters to interpret as a number.
If you had valueRX,valueRY,valueRZ,valueAX,valueAY,valueAZ<CR><LF> the data format would have been simpler...