MPU6050 Peculiar Problem

Hi Everyone,

I am working on an artificial horizon project using a TFT display (ST7735), an MPU6050 and an Arduino Nano/Teensy3.5.
I have a really odd problem: when I wire everything up to the Arduino Nano, the MPU6050 gives genuine accurate data and the artificial horizon shows up nicely on the TFT display. Because of the slow 16MHz clock speed on the nano, I get a lot of flickering on the screen as it updates a few times each second.
So, I switched to a much faster Teensy 3.5, but now the MPU6050 gives super weird data on the artificial horizon.
If I leave it for a while the values eventually stabilize in roll (though 180deg rotated), but the pitch is
constantly changing in a random seeming manner.

I went back to the raw data read sketch I was using previously (with the arduino nano) to get the angles off the MPU 6050, and found that I was successfully connecting to the MPU6050 but the serial monitor was left hanging on waiting for first interrupt... Why would this be?

I thought this might be a problem with the fact that the teensy 3.5 accepts 5v but prefers 3.3v logic, so I got a bidirectional voltage converter to solve this.
But, to my dismay, it did nothing.

Any help is appreciated and maybe this is a common problem that I have somehow missed...

Thanks,
Thomas

Attached are my wiring chart, the MPU6050 raw data read that works with the nano & teensy (jeff rowberg's code) and the artificial horizon code that works with the nano but not the teensy (this is an adapted version of Stanislav Trofimov's code).

SuccessfulDataRead.ino (15.7 KB)

Thomas_AHI.zip (8.55 KB)

For informed help, please read and follow the directions in the "How to use this forum" post.

jremington:
For informed help, please read and follow the directions in the "How to use this forum" post.

I would've thought that the sensors section was a reasonable place to put this, but I guess I'll move it to the Project Guidance section.

Thomas

The section you chose was not the problem.

The complete lack of useful information is the problem. Please read the "How to use this forum" post again.

Hints: post the code, using code tags. Post a complete, hand drawn wiring diagram (not Fritzing). Post a link to the exact sensor module you have, so we can determine whether you are observing the voltage restrictions (you may have already destroyed the sensor module by improper wiring).

I thought this might be a problem with the fact that the teensy 3.5 accepts 5v but prefers 3.3v logic, so I got a bidirectional voltage converter to solve this.

No as you find this will do nothing. However the MPU 6050 chip can only accept a supply voltage of 2.375 to 3.46V, it sounds like you are trying to power it from 5V or give it 5V signals, so you might have damaged it.

The MPU6050 I have has a voltage regulator on it, it accepts 5V per the datasheet.
Plus it has been running on 5V with the arduino nano so I don't know why this would change between the nano and the teensy.

I think it has to do with the way each program is using the MPU6050 I2C data, but I'm not exactly sure how to fix it or why it's happening.

Any help is appreciated.

The MPU6050 I have has a voltage regulator on it,

So you don't have just a MPU6050 but some sort of board with a MPU6050 on it. This is vital information that you failed to provide. Only with correct information can we give you correct advice. You need to post a link to the board you have.

Plus it has been running on 5V with the arduino nano so I don't know why this would change between the nano and the teensy.

So you need to post a schematic for both circuits, along with the code you are using.

Grumpy_Mike:
So you don't have just a MPU6050 but some sort of board with a MPU6050 on it. This is vital information that you failed to provide. Only with correct information can we give you correct advice. You need to post a link to the board you have.
So you need to post a schematic for both circuits, along with the code you are using.

Mike,

You are correct. I am using a cheap chip I bought off Amazon, HiLetgo GY-521. Attached here is the wiring diagram for the board.

I have also drawn a circuit diagram which you can find attached, though the wiring chart attached above is probably going to be more helpful. I attached the code to my original post earlier today.

IMG_5665.jpg.pdf (1.73 MB)

That board is 3.3V ONLY for I/O.

If you have connected it to a 5V Arduino, it is probably dead.

It's not dead, because it still works with the Arduino Nano.
But, when I switch from the Nano to the Teensy 3.5 the MPU6050 gives unstable data.
Please see the attached video.

It is possible that I may have damaged it, but why would it work flawlessly with the nano and not at all with the teensy in that case??
As you can see the blinking in both cases is pretty bad...

Thomas

https://drive.google.com/open?id=1X3sNtBsKZy_OifgtDc7NvFOKJF8kFxUj

tgreenhill:
It is possible that I may have damaged it, but why would it work flawlessly with the nano and not at all with the teensy in that case??

Probably need to do testing of that board -- just to make sure it's behaving properly. Test it with an arduino that is working well for this MPU6050 module. Observe/monitor/log results --- to make sure the sensors are behaving properly.

It's not unusual for 1 of the sensors inside the module to fail. That's why testing can help, and having spare modules can help too.

It looks like the pins used for I2C and the libiary used on the Teensy 3.5 is different from the Nano. See this post:- Struggling with I2C on Teensy 3.5

why would it work flawlessly with the nano

It might continue to work for a while, but it is pretty much guaranteed that you have damaged it by violating the manufacturer's specifications.

tgreenhill:
It's not dead, because it still works with the Arduino Nano.
But, when I switch from the Nano to the Teensy 3.5 the MPU6050 gives unstable data.
Please see the attached video.

It is possible that I may have damaged it, but why would it work flawlessly with the nano and not at all with the teensy in that case??
As you can see the blinking in both cases is pretty bad...

Thomas

AHI project - Google Drive

Hi, Did you test your artificial horizon already in a real plane ? What were the results ? Did you receive a readout for the Pitch and Roll ?
FYI, I'm working on a similar project, based on the BNO080. Working OK on mu hobby table, but not in real flight. Any suggestions ?
Regards, Marc