12-24-2020 12:05 PM
I have recently created a custom PCB which includes a 16mhz atmega32u4 at 5v, a BNO055 (over i2c, with 32.768 KHz external crystal). I am having a problem with the BNO055 in that the adafruit library is not working nor the custom code written by my end. But when I use the same code on the ADAFRUIT module it works like a charm. The self-test always reports that everything works the system does not report any errors. I am attaching my Ckt diagram please do help me out here.
01-04-2021 06:03 PM
I got this from the custom board
01-05-2021 02:56 AM
Hello subhajit_sarkar,
Could you read data from sensor next step?
01-05-2021 05:01 AM
No that's the problem all I am getting Zeroes at the output
01-07-2021 07:29 AM
Hello subhajit_sarkar,
You could start capture waveform with logic analyzer before you run read sensor data code. And check if actual waveform matchs with your running code.
01-07-2021 11:48 AM
Hii BSTRobin ,
Thanks for your replies I have finally started getting data but there is still one problem that persists.. Below is the code I am using to get the data Register By register without any library but what happens is that even if I put the sensor in NDOF mode I still get the z-axis in a continuous Rotation mode from 0-360 degree which doesn't happen in the ADAFRUIT Module. Can you point me in the right direction... Thanks in Advance..
#include <Wire.h>
uint8_t Roll_HSB, Roll_LSB, Pitch_HSB, Pitch_LSB, Yaw_HSB, Yaw_LSB;
int16_t rawRoll, rawPitch, rawYaw, rawTemp;
float Roll, Pitch, Yaw, Temp;
void setup() {
Serial.begin(115200);
Wire.begin(0x28);
setupIMU();
}
void loop() {
getDataIMU();
serialOut();
}
void setupIMU() {
//Configure Power Mode.
Wire.beginTransmission(0x28); //Begins transmission with BNO IMU at devices address.
Wire.write(0x3E); //Sends for the PWR_MODE register.
Wire.write(0x00); // Sets PWR_MODE register to NORMAL MODE. This is the defualt anyway.
Wire.endTransmission(); //Ends transmission.
//Configure Operating Mode.
Wire.beginTransmission(0x28); //Begins transmission with BNO IMU at devices address.
Wire.write(0x3D); //Sends for OPR_MODE register.
//Wire.write(0b00001000); //Sets OPR_MODE to IMU only FUSION
Wire.write(0b00001100); //Sets OPR_MODE to Absolute 9dof (NDOF) FUSION.
Wire.endTransmission(); //Ends transmission.
//Configure Axis Orentation.
Wire.beginTransmission(0x28); //Begins transmission with BNO IMU at devices address.
Wire.write(0x41); //Sends for the AXIS_MAP_CONFIG register to configure the axis orentation.
Wire.write(0x21); //Sets the Axis configuration to "P0" configuration. See datasheet page 24-25.
Wire.endTransmission(); //Ends Transmission
//Configure Axis Signs.
Wire.beginTransmission(0x28); //Begins transmssion with BNO IMU at devices address.
Wire.write(0x42); //Sends for the AXIS_MAP_SIGN register to adjust the signs of the axis.
Wire.write(0x04); //Sets the axis signs. See datasheet page 24-25.
Wire.endTransmission(); //Ends transmission.
//Configure ACCEL, GYRO, MAG. When in fusion mode these are auto configured. See datasheet page 28.
//Configure Data Units.
Wire.beginTransmission(0x28); //Begins transmission with BNO IMU at devices address.
Wire.write(0x3B); //Sends for UNIT_SEL register to configure outputed units.
Wire.write(0b00010000); //Configures ACC: m/s^2; Gyro: deg/s; Euler Angles: Deg; Temp: F.
Wire.endTransmission(); //Ends transmission.
//Configure External Crystal.
Wire.beginTransmission(0x28); //Begins transmission with BNO IMU at devices address.
Wire.write(0x3F); //Sends for SYS_TRIGGER register to configure external crystal.
Wire.write(0b10000000); //Flips bit 7 in register to enable external crystal.
Wire.endTransmission(); //Ends transmission.
}
void getDataIMU() {
Wire.beginTransmission(0x28); //Begins transmission with BNO IMU at devices adress.
Wire.write(0x1A);
Wire.endTransmission();
Wire.requestFrom(0x28, 6); //Requests 6 bytes from the IMU.
while(Wire.available() < 6) {};
Yaw_LSB = Wire.read(); //Reads Euler angle about X-axis least significant byte. (EUL_DATA _X_LSB register)
Yaw_HSB = Wire.read(); //Reads Euler angle about X-axis most significant byte. (EUL_DATA _X_MSB register)
Pitch_LSB = Wire.read(); //Automatically continues to the EUL_DATA _Y_LSB & EUL_DATA _Y_MSB registers to get roll.
Pitch_HSB = Wire.read();
Roll_LSB = Wire.read(); //Automatically continues to the EUL_DATA _Z_LSB & EUL_DATA _Z_MSB registers to get Yaw.
Roll_HSB = Wire.read();
rawPitch = ((Pitch_HSB)<<8)| Pitch_LSB; //Or the Low byte with the High byte.
rawRoll = ((Roll_HSB)<<8)| Roll_LSB;
rawYaw = ((Yaw_HSB)<<8)| Yaw_LSB;
Pitch = rawPitch/16.0; //Divide by the LSB factor (16 LSB/1 Degree).
Roll = rawRoll/16.0;
Yaw = rawYaw/16.0;
void serialOut()
{
Serial.print(Roll);
Serial.print(',');
Serial.print(Pitch);
Serial.print(',');
Serial.println(Yaw);
}