Digital IMU

Hello everyone,

I am new to arduino and to this forum and was looking for some much needed help. I have searched and tried to do this for days for what seems like it should be super simple, but cannot seem to get anywhere.

I have an inertial measurement unit (IMU) with:

Vin = 4.3 to 20V, ~25 mA
Tx 3.3V Logic
Rx 3.3V Logic
baud (115200) 8-N-1

That continuously outputs packs of data at 200Hz. Each pack contains 32 bytes (256 bits) and look like this:

byte byte byte float float float float int int int int int int byte
S1 S2 ID q1 q2 q3 q4 ax ay az gx gy gz csum

each float contains 4 bytes (32 bits), and each integer contains 2 bytes (16 bits).

All I want to do with this sensor is be able to unpack the data and simply read it, collect it, stream it in real time, etc. I just want to visualize it.. I have put the Tx pin into the Rx pin of my arduino, and vice versa, the Vin into 5V and the GND to GND.

Would anyone be able to help? I would greatly appreciate it. Thanks in advance.

It would be more helpful if you could give us the exact model number and a web link rather than snippets of the specs.

Have you verified that you are receiving data? Just any data, without trying to parse it.

Is there a "start" character that lets you find the beginning of a message?

Is there any example code provided with the IMU? Even if it is another language, it helps to read that.

Have you looked at other similar parsers, such as an NMEA parser?

I actually solved the problem of reading serial from the digital IMU, however… I am getting the packets as stated before 32 bytes, with the start of each as an char = M, char = Y, then char = c, corresponding to the first, second sync bytes and ID bytes, respectively.

All I am seeing in the serial monitor are some of the MYc’s in order, but then a bunch of different and random chars. I cant seem to make sense of it at all/dont know how to parse it in the way that I want so that i recieve the data I want for processing and plotting.

Any ideas? The question really comes down to… How can I separate (parse) all the bytes (all the char’s) to something I can read or a text file (for eg. accX, accY, accZ, gyrX, gyrY, gyrZ)??..

Thank you so much for your help

How can I separate (parse) all the bytes (all the char's) to something I can read or a text file (for eg. accX, accY, accZ, gyrX, gyrY, gyrZ)?

This is explained in the IMU data sheet/user guide.

What IMU is this?

Its a "Blatchford IMU", the data sheet explains the number of bytes dedicated to each float and integer, but when I read the incoming data from the serial port I am pretty sure I am getting a bunch of different ASCII characters. But I can see that the values for the first three bytes are consistent (MYc ..then a bunch of characters..) and it continuously repeats.

I know how many bytes are allocated to each floating point and integer value and in what order, but I am really confused on how to take those characters and "bytes?" and seperate them properly into vectors or arrays that contain real number values that I can read and begin to process.

What information would be needed from the data sheet that I would need to begin knowing how to do this? Im not sure if that will help since I already know the sequence of each value I want. My problem is how to apply it in the code... does that make sense??


Why haven't you posted a link to the data sheet?

What you are seeing when you print the data are meaningless ASCII characters.

You can probably use a structure to store the incoming data bytes into slots that end up representing integers and/or floating point numbers.