MPU6050 appears to have lost functionality

I purchased an MPU6050 a few months ago and it worked perfectly fine however recently something peculiar has happened. The MPU6050 is connected to an Arduino Nano which is connected to my laptop. A Tower Pro SG90 servomotor is connected to the Arduino as well. The problem is that when the Arduino is plugged into the laptop, rather than the Green LED on the MPU turning on as it had before it turns on very dim. When the code uploads the LED turns off. Once the code uploads completely the LED turns on then fades. The IMU then doesn’t return any acceleration or gyroscope values. Not only does the accelerometer not work but also when it isn’t the code doesn’t write the initial setup value to the servo.


This is that I had been using, it had been fine until recently.

#include <basicMPU6050.h> 
#include <Servo.h> 

// Create instance
basicMPU6050<> imu;
Servo myservo;

int servopin = 2; 


void setup() {
  // put your setup code here, to run once:
  imu.setup();

  imu.setBias();

  // Start console
  Serial.begin(38400);

  myservo.attach(2);
  myservo.write(90);
  

}

void loop() {
  // put your main code here, to run repeatedly
  imu.updateBias();


 

  float pitch = 180 * atan (imu.ax()/sqrt(imu.ay()*imu.ay() + imu.az()*imu.az()))/M_PI;


  
  Serial.println(pitch);

  float angle = 90 + pitch;

  //myservo.write(pitch); //currently actuation is fluttering.
  myservo.write(angle); //didn't realize that I wasn't testing angle, attempt to see performance.
  //noticing flutter significantly at certain intervals between actuation, integrate a low-pass filter to accelerometer data BEFORE applying it to pitch.
  

  

}

This is the code that I use to check if the IMU is actually functioning.

/*
 Get scaled and calibrated output of MPU6050
 */

#include <basicMPU6050.h> 

// Create instance
basicMPU6050<> imu;

void setup() {
  // Set registers - Always required
  imu.setup();

  // Initial calibration of gyro
  imu.setBias();

  // Start console
  Serial.begin(38400);
}

void loop() { 
  // Update gyro calibration 
  imu.updateBias();
 
  //-- Scaled and calibrated output:
  // Accel
  Serial.print( imu.ax() );
  Serial.print( " " );
  Serial.print( imu.ay() );
  Serial.print( " " );
  Serial.print( imu.az() );
  Serial.print( "    " );
  
  // Gyro
  Serial.print( imu.gx() );
  Serial.print( " " );
  Serial.print( imu.gy() );
  Serial.print( " " );
  Serial.print( imu.gz() );
  Serial.print( "    " );  
  
  // Temp
  Serial.print( imu.temp() );
  Serial.println(); 
}
3 Likes

I apologize if the writing is hard to read or bad quality.

3 Likes

Hi Nich, firstly welcome to the forum! :smiley:

Just to get some more info - can I confirm what has changed in this setup since it was last working (if anything)? It was a little unclear from your post whether you were always supplying power for the project via USB (which then suddenly stopped working) or whether you were originally supplying power externally and then tried it via USB?

Have you tried another USB port and/or USB cable? Ensuring of course that your USB cable is data-capable if using the USB to also download your project to the Nano.

3 Likes

Hey Nich,

Welcome to the forum! Thanks for posting.

Sounds like it may be a hardware failure. Do you have a multimeter with you? If so, can you please check the voltage that is making it to your board? Just want to make sure that there aren’t any continuity issues or similar problems related to the power supply that’s causing your MPU6050 to run into low voltage issues.

3 Likes

Hey Nich,

(Adding to the Chorus :stuck_out_tongue: ) Welcome to the forums :slight_smile:

I see a few potential issues - but I think your fastest way to a solution is to get a second Nano and a second MPU6050 to test with, so you’ve got some known good hardware.

First up, that Servo motor alone can quite easily pull more current (650mA stall) than is available from a USB port (500mA available max), or that the Nano can provide. You’ll need to provide it with an external source of power.

Have you tried disconnecting the Servo motor while testing? And have you tried the Nano on its own? It’s possible something is damaged on the Nano and it’s no longer able to provide a stable power supply.

Secondly, the MPU-6050 is ESD and shock sensitive. Have you ever dropped it? It’s rated to withstand up to 10,000g, which can quite easily be exceeded with a drop as the fibreglass in the PCB is extremely stiff. It can also be damaged by handling, and the difficulty with ESD damage is that it’s cumulative, so there might not be a single event that’s resulted in the failure.

Also, try moving things around on the breadboard. Sometimes issues like this can result from just a dodgy connection.

It’s also possible (though not particularly likely) the Charge Pump capacitor on the MPU-6050 has gone bad.

PS. Here’s the datasheet:

2 Likes

I can confirm that nothing has changed in the setup or code, It simply ceased to work. I had been supplying power through the USB cable and had not originally been supplying power externally. I unfortunately don’t have access to another USB to test however I will try another port.

1 Like

I can probably get access to a multimeter. Excuse my lack of knowledge but how do I check the voltage making it to the board?

1 Like

Hey Nich,

Checkout our article on how to use a DMM here:

They’re indispensable whenever you’re working with any electronics.

1 Like

I don’t think I’ll be able to get another MPU6050 and another Nano unfortunately. To provide the servo with external power do I just wire a battery directly to the GND and Power on the Servo? I don’t believe I have ever dropped the IMU. I’ll disconnect the servo whiles testing and report back on the results.

1 Like

You’ll need to make sure the grounds of all components (including the negative terminal of your battery) are connected together. Check out the ‘Large Servo’ sections in @Tim’s video:

2 Likes

I watched the video and I believe I now understand how to power the servo. I as well unplugged the servo from the circuit, I made sure the Nano was working by wiring up an LED and turning it on and off. I then tried to use the IMU with it being the only thing connected to the Nano and the LED turned on correctly however when I open the Serial Monitor to observe the acceleration values it remains blank. From what I’ve seen it seems any code I’ve tried that attempts to communicate with the MPU6050 doesn’t work at all. Uploading code that just tells the servo to move works, but the code that starts by telling the servo to move and then retrieves IMU values doesn’t in any way.

3 Likes

That’s good intel. If it used to work, then something has changed in between. When you experiment with another, approach with caution as the fault likely still exists (be it wiring, handling, etc).

3 Likes