Open ChiaraBolgiani opened 7 years ago
Change the address in the sketch to 0x69?
On Mon, Sep 18, 2017 at 9:16 AM, ClaireBol notifications@github.com wrote:
Hello,
I am trying to connect my MPU9250 to an Arduino Nano with I2C. Since I want to connect two sensors I want to use with the address 0x69. I managed to obtain the 0x69 address (when scanning the I2C devices, I see the 0x69 address), however when I try to read the sensor, I get unusable values. I am using the MPU9250BasicAHRS_I2C code, an example provided with the library. However I do not understand how do I have to change the code to read the sensor when using this address. When I upload the code, in the self test I obtain:
x-axis self test: acceleration trim within : -100.0% of factory value y-axis self test: acceleration trim within : -100.0% of factory value z-axis self test: acceleration trim within : -100.0% of factory value x-axis self test: gyration trim within : -100.0% of factory value y-axis self test: gyration trim within : -100.0% of factory value z-axis self test: gyration trim within : -100.0% of factory value
So indeed I obtain completely wrong data... Any idea why?
Please help a poor student with her thesis! Thanks a lot!
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/185, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qveBRy2zRPgmwGsBIRyASk8-TS8dks5sjpdVgaJpZM4PbKXx .
I already tried that. I changed the address with:
and yet it is not working. Do I have to change something else? Either in the library or in some other parts?
Thanks a lot for your help!
Replace this:
with this:
i tried doing that, but to no avail!
Tried doing what?
On Sat, Mar 31, 2018 at 8:56 AM, MitalPattani notifications@github.com wrote:
i tried doing that, but to no avail!
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/185#issuecomment-377702840, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qtcHNBjVtpqqjvQ6lLCY2aaphKBGks5tj6crgaJpZM4PbKXx .
I tried this in the library as well as in the sketch! Replace this:
with this:
It still detects the 9250 as 0×68, also i get some weird values for yaw pitch roll, i suppose that's happening because it can't detect the mag sensor properly but don't know what to do about the address!
I thought I explained this.
You have to toggle the pass through mode enable for each MPU9250, one after the other, then read from the mag, one after the other.
On Sat, Mar 31, 2018 at 11:00 AM, MitalPattani notifications@github.com wrote:
It still detects the 9250 as 0×68, also i get some weird values for yaw pitch roll, i suppose that's happening because it can't detect the mag sensor properly but don't know what to do about the address!
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/185#issuecomment-377711598, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qrsOvpXhmdkMGpg3Bp6Ewa0bUD4Fks5tj8Q0gaJpZM4PbKXx .
okay so after a bit of research i figured that this is the code to enable pass through mode
writeByte(MPU9250_ADDRESS, INT_PIN_CFG, 0x12); // INT is 50 microsecond pulse and any read to clear writeByte(MPU9250_ADDRESS, INT_ENABLE, 0x01); // Enable data ready (bit 0) interrupt
but i need reading from both the sensors simultaneously, how do you suggest i toggle between the two without putting this in the main loop!
" i need reading from both the sensors simultaneously, "
Cannot, so use an I2C multiplexer. You can only read one after another, not both at the same time. Even with a multiplexer or using two different I2C busses on one micrcontroller this is true. You will have to read one after another no matter what, I think.
First try to use two MPU9250 on the same bus and see if this can work for you. The latency (time for toggle) will be a few tens of microseconds. Maybe this is good enough.
You will have to put this:
writeByte(MPU9250_ADDRESS1, INT_PIN_CFG, 0x12); // enabl;e writeByte(MPU9250_ADDRESS2, INT_PIN_CFG, 0x10); // disable
in the main loop, of course, to enable one and disable the other, then reverse, then repeat.
On Sun, Apr 1, 2018 at 12:32 PM, MitalPattani notifications@github.com wrote:
okay so after a bit of research i figured that this is the code to enable pass through mode
writeByte(MPU9250_ADDRESS, INT_PIN_CFG, 0x12); // INT is 50 microsecond pulse and any read to clear writeByte(MPU9250_ADDRESS, INT_ENABLE, 0x01); // Enable data ready (bit 0) interrupt
but i need reading from both the sensors simultaneously, how do you suggest i toggle between the two without putting this in the main loop!
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/185#issuecomment-377810947, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qkBFb-Hpy9X9e6cLtn6X170mN645ks5tkStpgaJpZM4PbKXx .
i am getting an error saying writeByte is not defined in void loop
You have to create a function to parse this command. Like this one maybe?
// Wire.h read and write protocols void writeByte(uint8_t address, uint8_t subAddress, uint8_t data) { Wire.beginTransmission(address); // Initialize the Tx buffer Wire.write(subAddress); // Put slave register address in Tx buffer Wire.write(data); // Put data in Tx buffer Wire.endTransmission(); // Send the Tx buffer }
On Sun, Apr 1, 2018 at 12:54 PM, MitalPattani notifications@github.com wrote:
i am getting an error saying writeByte is not defined in void loop
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/185#issuecomment-377812317, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qux91P_0d-MZv3-FKbquCjU57VbEks5tkTCDgaJpZM4PbKXx .
for some reason, writeByte was yellow colored, hence the editor must read it as a defined function but still there was the error.....i guess I'll just create the function again.
Hello,
I am trying to connect my MPU9250 to an Arduino Nano with I2C. Since I want to connect two sensors I want to use with the address 0x69. I managed to obtain the 0x69 address (when scanning the I2C devices, I see the 0x69 address), however when I try to read the sensor, I get unusable values. I am using the MPU9250BasicAHRS_I2C code, an example provided with the library. However I do not understand how do I have to change the code to read the sensor when using this address. When I upload the code, in the self test I obtain:
x-axis self test: acceleration trim within : -100.0% of factory value y-axis self test: acceleration trim within : -100.0% of factory value z-axis self test: acceleration trim within : -100.0% of factory value x-axis self test: gyration trim within : -100.0% of factory value y-axis self test: gyration trim within : -100.0% of factory value z-axis self test: gyration trim within : -100.0% of factory value
So indeed I obtain completely wrong data... Any idea why?
Please help a poor student with her thesis! Thanks a lot!