Jump to content
I2Cdevlib Forums

Leaderboard

Popular Content

Showing content with the highest reputation on 01/05/2025 in all areas

  1. Hello, I use the MPU6050 with an ESP8266. I have connected it to VCC, Ground, SDA, SCL of the ESP8266. When I power the board for an amount of time the MPU6050 works perfectly. However, after some moment it returns the same values no matter moving it. I first thought it was the buffer and tried emptying it at a specific amount of time. However, this made the problem appear sooner than before. After a restart of the ESP9266 board, the MPU6050 works fine again. This is the code which I use to obtain the values from it: in setup: const int MPU_addr=0x68; Wire.begin(); Wire.beginTransmission(MPU_addr); Wire.write(0x6B); Wire.write(0); Wire.endTransmission(true); delay(10); in loop: Wire.beginTransmission(MPU_addr); Wire.write(0x3B); Wire.endTransmission(false); Wire.requestFrom(MPU_addr,14,true); AcX=Wire.read()<<8|Wire.read(); AcY=Wire.read()<<8|Wire.read(); AcZ=Wire.read()<<8|Wire.read(); Tmp=Wire.read()<<8|Wire.read(); GyX=Wire.read()<<8|Wire.read(); GyY=Wire.read()<<8|Wire.read(); GyZ=Wire.read()<<8|Wire.read(); //Applying a formula to turn raw values into Yaw, Pitch and Roll int16_t roll=atan2(AcY,AcZ)*180/PI; int16_t pitch=atan2(AcX,sqrt(AcY*AcY+AcZ*AcZ))*180/PI; If the values that repeat are important, I can provide them. They are the same every time. What am I doing wrong? Thank you in advance!!!
    1 point
  2. The problem was that the wires were not soldered properly. I resoldered them and now everything works fine !!!
    1 point
×
×
  • Create New...