Arduino Boards and I2C Issues

Hi,

I’ve been having issues with my UNO. Its pretty old - 4 years at least. I’m trying to communicate to an MPU6050 (IMU) via I2C and it appears as though the connection keeps dropping out and resetting. The power light on the MPU6050 and UNO both stay on so wasn’t thinking it was a power issue.

My code was taking up 46% and 47% of storage space and dynamic memory when I2C was dropping out, and I reverted the code to one which was less computationally heavy and only used 29% and 36% storage space and dynamic memory. This seemed to fix the issue but don’t if this is directly related.

However I will have a lot more variables and computations that I’ll need to add so was potentially looking for a newer arduino board anyway with more memory and RAM. The project is quadcopter which I’m coding from scratch - including aerodynamic formulas.

I was looking at some of the MKR models which had better specs including wifi, however, was unsure how they connect to a battery or power source, as they don’t appear to have the DC jack from what I can see in the pictures. Do they have their own LiPo battery built in? What connections do they use to interface with your PC? Would these boards be suitable for what I’m after?

Appreciate any assistance

Lindsay

3 Likes

Do you have any photos of your wiring? This could be the problem. Depending how close it is to the motors, ESC and flight electronics there could be a lot of noise on board that’s getting picked up by your sensor wiring and causing the drop-out.

Definitely worth taking a look at some projects based on ArduPilot and the source code for that as a reference. FYI, if you’re a university student, there are packages which enable direct integration of MATLAB and Arduino which will make tuning and testing your control systems much, much easier.

4 Likes

At this stage I’m purely trying to get the IMU working. I’ve literally only got the UNO board and the 4 wires connecting to the MPU-6050 (SCL, SDA, 3.3V, GND). That being said, I do have it resting on my laptop as my board USB connection is super short - maybe its picking up something from the laptop?.

As for the projects based on ArduPilot, could definitely look at that for reference. Do you know where I could go for this?

Also, for the packages which enable integration of MATLAB and Arduino, this would be very handy as my simulations have all been done in MATLAB/Simulink

4 Likes

Also, are any of the MKR boards more suitable for this project? Do you have any more info on them?

Cheers

4 Likes

Hmm - how do you know your I2C connection is dropping out? Could it just be that serial communication between your PC and Arduino is what’s dropping?

Here’s a link to the ArduPilot home page: https://ardupilot.org/

Check out the docs here: Downloading the Code / Using Git — Dev documentation

4 Likes