BNO055 Rotation Matrix

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
DjangoTango
 
Posts: 18
Joined: Sun Oct 31, 2021 12:12 pm

Re: BNO055 Rotation Matrix

Post by DjangoTango »

Yes, I had to change my damaged cable, because the connection sda/scl was interrupted. By the way I knew that quaternions are present in a range only of-1;1. Sometimes I see also 1.99. I am not sure about the output again. I show the computed phi, after the calibration, simulating a gait with my hands it's hard to detect event. I hope that You can point me in the right solution way. thank You so much.
Attachments
QvsG.PNG
QvsG.PNG (217.73 KiB) Viewed 381 times

User avatar
jps2000
 
Posts: 811
Joined: Fri Jun 02, 2017 4:12 pm

Re: BNO055 Rotation Matrix

Post by jps2000 »

plot the quaternions and phi in one row
Then look at the data slowly rotating the sensor in distinct angles e.g. every 10 degrees
1.99 should not happen if quats are correct

User avatar
DjangoTango
 
Posts: 18
Joined: Sun Oct 31, 2021 12:12 pm

Re: BNO055 Rotation Matrix

Post by DjangoTango »

I attach you a txt of q0,q1,q2,q3,phi. Sometimes the quaternion are >1. What does it mean? I am a quite arookie about quaternions but I thought that after a calibration the library gives me the correct output. Why should they be incorrect? Anyway after the calibration with the standard movements requested, I move slightly the sensor on the table doing a real oscillation. And that's the result. What can I do? Where Am I wrong?
Really Thank you for the disponibilty that you are showing me, you are a gentleman.
Attachments
qover1.txt
(8.55 KiB) Downloaded 9 times

User avatar
jps2000
 
Posts: 811
Joined: Fri Jun 02, 2017 4:12 pm

Re: BNO055 Rotation Matrix

Post by jps2000 »

First you have to repair the quaternions.
They are not correct.
The squared sum of quaternions need to be 1.0
always!!!!!!!!
just rare rows are correct
So there are also others not correct
like this for example
-0.59,-0.01,-0.00,-0.00,

Is the I2Communication working properly?
Pullups?
Wires too long?

What do you get when you read just the accelerometer?

User avatar
DjangoTango
 
Posts: 18
Joined: Sun Oct 31, 2021 12:12 pm

Re: BNO055 Rotation Matrix

Post by DjangoTango »

The output of accelerometer is weird too I am noticing. I only try to put the 3 axis sensor and this is the result. I connect the arduino uno wifi rev GNG-GNG, Vin-3.3V, SDA-SDA,SCL-SCL. The cables are male-male because I put the sensor in a breadboard in order to do the calibration more precisely.
Attachments
accbno.txt
(21.82 KiB) Downloaded 7 times

User avatar
jps2000
 
Posts: 811
Joined: Fri Jun 02, 2017 4:12 pm

Re: BNO055 Rotation Matrix

Post by jps2000 »

ok
Then repair will effect both

so try to add 2k2 or so pullups on SDA and SCL
But the Uno is a 5V controller. The BNO is 3V3.
Is there a level converter on the I2C bus somewhere?

User avatar
DjangoTango
 
Posts: 18
Joined: Sun Oct 31, 2021 12:12 pm

Re: BNO055 Rotation Matrix

Post by DjangoTango »

jps2000 wrote:ok
Then repair will effect both

so try to add 2k2 or so pullups on SDA and SCL
But the Uno is a 5V controller. The BNO is 3V3.
Is there a level converter on the I2C bus somewhere?
Yes The arduino uno has just the pin to erogate 3.3V.
By the way after more tentatives this is the output. Is there anyway something of strange looking at the code isn'it? there are 350 like values sometimes.

Code: Select all

 imu::Vector<3> acc = bno.getVector(Adafruit_BNO055::VECTOR_ACCELEROMETER);

  /* Display the floating point data */
  Serial.print("X: ");
  Serial.print(acc.x());
  Serial.print(" Y: ");
  Serial.print(acc.y());
  Serial.print(" Z: ");
  Serial.print(acc.z());
  Serial.println("\t\t");
   uint8_t system, gyro, accel, mg = 0;
    bno.getCalibration(&system, &gyro, &accel, &mg);
Attachments
accbno_2.txt
(11.22 KiB) Downloaded 8 times

User avatar
jps2000
 
Posts: 811
Joined: Fri Jun 02, 2017 4:12 pm

Re: BNO055 Rotation Matrix

Post by jps2000 »

Phi is calculated from the acos function (arcus cosinus) that transfers a values from +1 to -1 to 0 to 180 degrees.

But that is not the point.
You get still false readings from the BNO.
I do not know why.
You need to repair that first.
Can you post a photo of your setup?
are there loose cables / poor soldering?

Your acc data are sometimes correct sometimes not

User avatar
DjangoTango
 
Posts: 18
Joined: Sun Oct 31, 2021 12:12 pm

Re: BNO055 Rotation Matrix

Post by DjangoTango »

To understand...will Phi be the angle that the inclination of the sensor in no matter which direction makes with the gravitation?
Thank You again.
These are the designes of the circuits 8the jpg were bigger) with the mode with resistor and not.
Attachments
Documento Word riconosciuto 11-01-2021 14.48.pdf
(143.45 KiB) Downloaded 11 times

User avatar
jps2000
 
Posts: 811
Joined: Fri Jun 02, 2017 4:12 pm

Re: BNO055 Rotation Matrix

Post by jps2000 »

No this is wrong placement of the resistors. You placed it in series.
The resistors should go from scl to 3v3 and from sda to 3v3. scl and sda remains interconnected of course.
A photo may show compromised soldering joints.
Did you solder the pin row properly to the BNO Board?

User avatar
DjangoTango
 
Posts: 18
Joined: Sun Oct 31, 2021 12:12 pm

Re: BNO055 Rotation Matrix

Post by DjangoTango »

Yeah all is properly soldered. I modified the circuit as you said and right now all the output are good looking at the acceleration at least(even if sometimes it can reach 10). Running the same code to convert quaternion to phi, qw is at maximum 1 like you said. Then this problem is solved. Thank you.
By the way looking at the behavior phi, considering that z axis is going away from the body (towards lateral direction), I think that the phi output is great but it is not still what I need.
Imagine to put the sensor placed on your lateral thigh and then walk. I attach you a draw about alpha. I want to measure it. Your solution way is good because is not affected by the inversion.
Attachments
Documento Word riconosciuto 11-01-2021 15.24_2.pdf
(95.54 KiB) Downloaded 7 times
accbno_V3.PNG
accbno_V3.PNG (30.8 KiB) Viewed 361 times

User avatar
jps2000
 
Posts: 811
Joined: Fri Jun 02, 2017 4:12 pm

Re: BNO055 Rotation Matrix

Post by jps2000 »

The acceleration output is in m/s^2.
For gravity 1G is 9.81m/s^2 . that is close to 10.
if the quaternions are ok now, then you can move to phi.
Depending on the orientation of the sensor you can use gx or gy instead depending omn the orientation of the sensor mounted on the leg.

User avatar
DjangoTango
 
Posts: 18
Joined: Sun Oct 31, 2021 12:12 pm

Re: BNO055 Rotation Matrix

Post by DjangoTango »

jps2000 wrote:The acceleration output is in m/s^2.
For gravity 1G is 9.81m/s^2 . that is close to 10.
if the quaternions are ok now, then you can move to phi.
Depending on the orientation of the sensor you can use gx or gy instead depending omn the orientation of the sensor mounted on the leg.
Thank you so much because I understood right now. Really thank you!!

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”