Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support of 2 sensors #20

Open
76nic opened this issue Aug 10, 2021 · 6 comments
Open

support of 2 sensors #20

76nic opened this issue Aug 10, 2021 · 6 comments

Comments

@76nic
Copy link

76nic commented Aug 10, 2021

Dear Romain,
I really like the work you have done on the library MPU6050_light. Would you consider to add support of 2 MPU sensors. Basically calling all the functions you have currently implemented with "mpu0x68.xxx" and "mpu0x69.xxx".
Many thanks in advance for thinking about it!
Best regards,
76nic

@rfetick
Copy link
Owner

rfetick commented Aug 28, 2021

Hello 76nic,

As far I understand your issue as already been solved. Please have a look at the previous issue here.
You can also have a look at the release version 1.2.1 which solved the two sensors issue.

Please tell me if this helps

Cheers,

Romain

@76nic
Copy link
Author

76nic commented Sep 8, 2021

Dear Romain, many thanks for your responds and pointing me to the mpu.setAddress() functionality. I have a question regarding the mpu.calcGyroOffsets() function using 2 sensors in parallel. Is the calibration done for both sensors and stored if I call that function? Basically like the following:

MPU6050 mpuA(Wire);
MPU6050 mpuB(Wire);
void setup()
    Wire.begin();
    mpuA.setAddress(104);
    mpuA.begin();
    Serial.println(F("Calculating gyro offset, do not move MPU6050"));
    delay(1000);
    mpuA.calcGyroOffsets();
    Serial.println("Done.");
    
    mpuB.begin();
    Serial.println(F("Calculating gyro offset, do not move MPU6050"));
    delay(1000);
    mpuB.setAddress(105);
    mpuB.calcGyroOffsets();
    Serial.println("Done.");
void loop()
    mpuA.update();
    currentAngleX_A = mpuA.getAngleX();
    currentAngleY_A = mpuA.getAngleY();
    currentAngleZ_A = mpuA.getAngleZ();

    mpuB.update();
    currentAngleX_B = mpuB.getAngleX();
    currentAngleY_B = mpuB.getAngleY();
    currentAngleZ_B = mpuB.getAngleZ();

Many thanks,

  • 76nic

@76nic
Copy link
Author

76nic commented Sep 8, 2021

sorry - the code format turned out weird by uploading - it is meant as continues code.

@rfetick
Copy link
Owner

rfetick commented Oct 20, 2021

Hello 76nic,

If you have two different MPU6050 cpp objects they evolve independently, so the calibration is independent.

Cheers,

Romain

@eiffelblithe
Copy link

"Dear Romain, many thanks for your responds and pointing me to the mpu.setAddress() functionality. I have a question regarding the mpu.calcGyroOffsets() function using 2 sensors in parallel. Is the calibration done for both sensors and stored if I call that function? Basically like the following:

MPU6050 mpuA(Wire);
MPU6050 mpuB(Wire);
void setup()
    Wire.begin();
    mpuA.setAddress(104);
    mpuA.begin();
    Serial.println(F("Calculating gyro offset, do not move MPU6050"));
    delay(1000);
    mpuA.calcGyroOffsets();
    Serial.println("Done.");
    
    mpuB.begin();
    Serial.println(F("Calculating gyro offset, do not move MPU6050"));
    delay(1000);
    mpuB.setAddress(105);
    mpuB.calcGyroOffsets();
    Serial.println("Done.");
void loop()
    mpuA.update();
    currentAngleX_A = mpuA.getAngleX();
    currentAngleY_A = mpuA.getAngleY();
    currentAngleZ_A = mpuA.getAngleZ();

    mpuB.update();
    currentAngleX_B = mpuB.getAngleX();
    currentAngleY_B = mpuB.getAngleY();
    currentAngleZ_B = mpuB.getAngleZ();

Many thanks,

  • 76nic"

Hello thank you for this code but may I know how would the code be like if it is for 5 sensors and not only 2 sensors? For this code 2 registers were used but what if it is for 5 sensors? Thank you so much.

@Mo-Alsehli
Copy link

"Dear Romain, many thanks for your responds and pointing me to the mpu.setAddress() functionality. I have a question regarding the mpu.calcGyroOffsets() function using 2 sensors in parallel. Is the calibration done for both sensors and stored if I call that function? Basically like the following:

MPU6050 mpuA(Wire);
MPU6050 mpuB(Wire);
void setup()
    Wire.begin();
    mpuA.setAddress(104);
    mpuA.begin();
    Serial.println(F("Calculating gyro offset, do not move MPU6050"));
    delay(1000);
    mpuA.calcGyroOffsets();
    Serial.println("Done.");
    
    mpuB.begin();
    Serial.println(F("Calculating gyro offset, do not move MPU6050"));
    delay(1000);
    mpuB.setAddress(105);
    mpuB.calcGyroOffsets();
    Serial.println("Done.");
void loop()
    mpuA.update();
    currentAngleX_A = mpuA.getAngleX();
    currentAngleY_A = mpuA.getAngleY();
    currentAngleZ_A = mpuA.getAngleZ();

    mpuB.update();
    currentAngleX_B = mpuB.getAngleX();
    currentAngleY_B = mpuB.getAngleY();
    currentAngleZ_B = mpuB.getAngleZ();

Many thanks,

  • 76nic"

Hello thank you for this code but may I know how would the code be like if it is for 5 sensors and not only 2 sensors? For this code 2 registers were used but what if it is for 5 sensors? Thank you so much.

To what pins should the other MPU connected to?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants