MPU6050 hangs when powered with external battery [SOLVED]


I'm working on a lightsaber project, using an Arduino Nano, with a led strip (FastLed library), a DFMIniPlayer (DFPlayer_Mini_Mp3.h), a button, and a MPU6050 sensor with the following library:

I power all with a rechargeable circuit for a 18650 battery.

When I connect the arduino to the PC and upload the code, everything works fine ... until I power on the battery circuit (giving 5V via Vin). Then the MPU6050 crashes and hangs the code.

I tried connecting the MPU6050 Vcc directly to the battery circuit 5V output, also to the 5V board output, and to the 3,3V board output, and it always works fine if I just power the nano via USB. When I turn on the battery circuit it hangs.

Note: If I unplug the MPU6050, all the other components work fine with the external battery. No hangs.
It also happens with the MPU6050 library example (no leds, no mp3s, no buttons). It just works if I power the nano just with the USB cable. When I add the extra 5V power, it hangs.

Any idea what's happening? I'm getting mad with this.

thank you,

You have to supply at least 6.5V (better 7V) on the Vin pin because the 5V for the Nano is produced by a linear voltage regulator and that needs a higher voltage than it has to put out. If you put 5V to Vin, the regulator probably puts out a voltage around 3.5V which then goes to the 3V3 voltage regulator. That in turn needs some voltage difference to function correctly and will put out around 2V in the end. This is probably to low for the MPU6050. If your battery circuit produces a stable 5V, connect it directly to the 5V pin of the Nano.

Thank you for the response, I will try it!
I'm using a MT3608 (see picture) as voltage regulator, and it seems quite stable.

If I insert 7V to the Arduino, would it be harmful power with those 7V to the Leds strip, mp3 player, ...?
I think I will try first to power the arduino via 5V pin.

imagen jpg

Here a video of the project working on the protoboard and powered just by the USB:

You can power the Arduino directly with 7V (on the power connector but not on the 5V pin) but then it will use the linear voltage regulator which is much less efficient than the MT3608 you're using. It's probably best to use your current solution but put that 5V voltage to the 5V pin of the Arduino.

SOLVED: it's all about amperage. It seems that the 18650 through the rechargeable circuit does now fit the enough amperage to light the leds at their full brightness. That causes malfunction on the MPU6050, which hangs the code when asking for acceleremoter values.

I solved it reducing the leds brightness, and now everything works fine. Here a video:

Thank pylon for your support and teaching about power pins in arduino.