MPU 6050 without powerup calibration

I need to make a device that measure an angle in one axis. I need an absolute value in deegres like in digital level. That's why I need to skip calibration on powerup. And that's where I have my issue. No matter what library I use, when I decide to skip calibration the result from 6050 is between -30 and 30 degrees. Even If the sensor is upside down.

Here is my code:

#include "Wire.h"
#include <MPU6050_light.h>
#include "Math.h"

MPU6050 mpu(Wire);
unsigned long timer = 0;

void setup() {

byte status = mpu.begin();
Serial.print(F("MPU6050 status: "));
while(status!=0){ }

//mpu.calcOffsets(true , true); // calibration line
void loop() {

If only I uncomment 'calibration line' program is working corectly and results are between -90 and 90.

Can you give me some clue how to fix this issue?

You could use the approach described here, which does not require calibration: How_to_Use_a_Three-Axis_Accelerometer_for_Tilt_Sensing-DFRobot

However, the results will be more accurate if you do calibrate the accelerometer, as described in the following link. It needs to be done only once, and the corrections are then incorporated into the program.


// minimal MPU-6050 tilt and roll (sjr). Works with MPU-9250 too.
// works perfectly with GY-521, pitch and roll signs agree with arrows on sensor module 7/2019
// Tested with 3.3V eBay Pro Mini with no external pullups on I2C bus (worked with internal pullups)
// Add 4.7K pullup resistors to 3.3V if required. A4 = SDA, A5 = SCL

const int MPU_addr1 = 0x68;
float xa, ya, za, roll, pitch;

void setup() {

  Wire.begin();                                      //begin the wire communication
  Wire.beginTransmission(MPU_addr1);                 //begin, send the slave adress (in this case 68)
  Wire.write(0x6B);                                  //make the reset (place a 0 into the 6B register)
  Wire.endTransmission(true);                        //end the transmission

void loop() {

  Wire.write(0x3B);  //send starting register address, accelerometer high byte
  Wire.endTransmission(false); //restart for read
  Wire.requestFrom(MPU_addr1, 6); //get six bytes accelerometer data
  int t =;
  xa = (t << 8) |;
  t =;
  ya = (t << 8) |;
  t =;
  za = (t << 8) |;
// formula from
  roll = atan2(ya , za) * 180.0 / PI;
  pitch = atan2(-xa , sqrt(ya * ya + za * za)) * 180.0 / PI; //account for roll already applied

  Serial.print("roll = ");
  Serial.print(", pitch = ");

Thank you for an answer. I will try it soon.