Compatibility HX711 (Load Cell) and MPU6050 sensors

I'm trying to acquire, simultaneously, some data from a load cell (using the HX711 module) and the change of angle using a MPU6050, using an arduino uno (clone).

When I have both modules powered from arduino (5V), the values obtained from the gyroscope start to change and go forward (like it's counting milliseconds); while the values obtaine from the load cell are correct and not affected at all.

I've tried to achieve a stability to obtain both data simultaneously:

  • supply 5v from an external source to both the module (same errors, of angles increasing) [no combination is working]

What is "sort of working badly" is that I'm powering MPU6050 with 3.3V from arduino and the load cell with 5V. I've also changed the DOUT and CLK pin for the HX711 from (5,3) to (13,5) of the arduino.
When I connect both with this connections the X angle (what I need as a data) from MPU6050 (in a flat surface) needs few seconds to converge to a number that is not zero (it usually stops at value 6).

Here's my code:

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

HX711 scale(13, 5);    //HX711 scale(DOUT,CLK);
float calibration_factor = 5100; // this calibration factor is adjusted according to my load cell //verso il basso "aumenta il peso"..
float units;
float ounces;

float X_angle;
float Y_angle;
float Z_angle;

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

//Insert Integer
const byte numChars = 32;
char receivedChars[numChars];   // an array to store the received data
boolean newData = false;
int num2;
int oldnum2;

void setup()


  scale.tare();  //Reset the scale to 0

  long zero_factor = scale.read_average(); //Get a baseline reading

void loop() {

  //Load Cell Part
  scale.set_scale(calibration_factor); //Adjust to this calibration factor

  units = scale.get_units(), 10;
  if (units < 0)
    units = 0.00;
  ounces = units * 0.035274;

  //Gyroscope part
  X_angle = mpu.getAngleX()+2.5;                      //corrections +2.5
  Y_angle = mpu.getAngleY();
  Z_angle = mpu.getAngleZ();

      if((millis()-timer)>10)                         // print data every 10ms
        Serial.print("P: ");
        Serial.print("; R: ");
        Serial.print("; Y: ");
        Serial.print("; bilancino: ");
        timer = millis();  


I have no idea how to solve this. What can I do to acquire these data correctly? Thanks

They are two different things, they should not influence each other. They do not even share the I2C bus.

A accelerometer is noisy and a gyro drifts. They all do. Can you make a test sketch for just the gyro and only connect the DMP-6050 ? It should drift.

The MPU-6050 is a 3.3V sensor and its SDA and SCL pins should be connected to a 3.3V I2C bus. The Arduino Uno might push current into the sensor because the Arduino Uno enables its internal pullup resistors.

You could make another test-sketch with the short examples sketch instead of your library. Look at the raw values of the gyro, they always drift.

I've tried the code you suggested but with no luck...