how read acceleration data for BNO055

7 Ansichten (letzte 30 Tage)
praneet amitabh
praneet amitabh am 28 Jan. 2019
I am trying to use BNO055 accelerometer and trying to integrate it with MATLAB. Since there is no library for this sensor in MATLAB, I am trying to build the code myself.
I established the I2C connection with the sensor and started to read the data for few readings and got a constant 7 numbers for every reading despite of moving the accelerometer up and down i.e. a column of [64416, 3890, 785, 21 ,0, 0, 0]. In the data sheet, there is a conversion saying that 1LSB = 0.01 m/s2. Now, I have 2 questions:
a. Why isn't the reading changing despite of the movement in accelerometer?
b. What does this column represent and how to convert it to the useful readings of acceleration? Ihave seen something written in the data sheet that it gives the data in 7 bit. Are these numbers 7-bit data..?
clc
clear all
a = arduino('/dev/cu.usbmodem14101','Mega2560','Libraries','I2C');
addrs = scanI2CBus(a);
bno = i2cdev(a, '0x28');
k =1;
tic;
write(bno, 0, 'uint16');
while (toc<=20000)
data(:,k) = read(bno,7, 'uint16');
k=k+1;
end

Akzeptierte Antwort

Guillaume
Guillaume am 28 Jan. 2019
I doubt that anybody on this forum knows your particular sensor so I'm afraid the most likely answer would be: read (or re-read) the documentation of your sensor. Possibly, contact the manufacturer. For a), the possible answer may be:
  • The sensor is not connected properly
  • You're not sending it the right command
  • You're not reading the response correctly
  • You're not providing enough acceleration to make a difference in the result (i.e the sensitivity of the sensor is too low
  • You're providing too much acceleration and thus always reading the max value (i.e. the sensor is too sensitive)
  • ...
For b), no you're not reading 7 bits. You're reading 14 bytes (7 time 16-bit values). I would think it's unlikely that the sensor actually only send 7 bits of data. Most likely it sends 8 bits, of which only 7 are used. The command to read 8 bits would be:
read(bno, 1, '*uint8') %the * is optional but it's probably easier if you store the data as uint8 instead of double

Weitere Antworten (1)

Madhu Govindarajan
Madhu Govindarajan am 28 Jan. 2019
This sensor is supported in the Simulink support package for Arduino - https://www.mathworks.com/help/supportpkg/arduino/ref/bno055imusensor.html
Have you tried using that? OR do you need it to be only from MATLAB?
  2 Kommentare
praneet amitabh
praneet amitabh am 28 Jan. 2019
I need it in MATLAB because of the nature of the project
Madhu Govindarajan
Madhu Govindarajan am 28 Jan. 2019
Then here is what you need to do.
The above link shows how to build custom add-ons when external libraries exist for Arduino sensors. You will have to find the BNO055's library and create a custom add-on using the technique above.
HTH,
Madhu

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by