[SOLVED] Powering arduino Nano from a battery

I have a Nano project that works fine when powered from the usb port but I can't seem to find a battery that will work. My latest attempt is two 4000mah batteries in series connected to the vin/ground pins.

The project includes a dfplayermini mp3 player, an hw-104 amp and a hall effect sensor. when powered from the usb port it makes a sound only when the hall effect sensor is triggered. When powered from the battery is seems to be stuck in some kind of loop in setup, never getting to the main loop. it just repeatedly make a short squeak from the speakers.

code:


#include "SoftwareSerial.h"
#include "DFRobotDFPlayerMini.h"

// Use pins 2 and 3 to communicate with DFPlayer Mini
static const uint8_t PIN_MP3_TX = 2; // Connects to module's RX
static const uint8_t PIN_MP3_RX = 3; // Connects to module's TX
SoftwareSerial softwareSerial(PIN_MP3_RX, PIN_MP3_TX);

// Create the Player object
DFRobotDFPlayerMini player;

int hall_pin = 6;


void setup() {
   pinMode(LED_BUILTIN, OUTPUT);
   pinMode(hall_pin, INPUT);
  // Init serial port for DFPlayer Mini
  softwareSerial.begin(9600);
  // Start communication with DFPlayer Mini
  if (player.begin(softwareSerial)) {
    // Set volume to maximum (0 to 30).
    player.volume(20);
  } 
}

void loop() {
    
  if (!digitalRead(hall_pin)){
     player.playMp3Folder(1); delay(1000);
     player.playMp3Folder(2);delay(1000);
     player.playMp3Folder(3); delay(1000);
  
  }  

  
      
     digitalWrite(13, HIGH);  // turn the LED on (HIGH is the voltage level)
     delay(100);                       // wait for a second
      digitalWrite(LED_BUILTIN, LOW); 
        delay(100);  
      
}

A schematc or wiring diagram are helpful when asking a hardware question. Show all power supplies.

Links to technical data for components are also helpful.

I have a similar project. It works great from a 3.7 LiPo (18750) and a 2A boost converter.

Are all grounds connected?

Is there any change if you don"t use the amp and drive just one speaker from the DF Mini?

Welcome to the forum What is the voltage of the two batteries ?

Is the driver made for those two "speakers?"

Try the DFPlayerMini in stand-alone mode (without the microcontroller).

the batteries are 3.7 lipo cells fully charged about 4.2 each. the pair is reading 8.39 volts on my meter.

I'll work on a wiring diagram but I believe all the grounds are correctly connected since it works with the power from the USB port.

I removed the amp and used just one speaker on the mini player and it works correctly.

I'm guessing that the batteries can't supply sufficient amps to run all thee components or more likely that the 5v pin on the Nano can't supply the required amps?

I believe the amplifier is adequate for the two speakers. The speakers are 2w,3ohm speakers and the amp can supply 3w, with a 5ohm load.
https://www.mouser.com/datasheet/2/115/PAM8403-247318.pdf

So is the amp supplied by the 8.4V battery pair you described? That seems to be above the datasheet’s max of 6.0V.

And what voltages are then supplying the Arduino and DFR module respectively?

I can’t quite follow some of your wiring, but are you sure the Rx/Tx connections are correct?

The SPKR 1/2 is not a ground-referenced output.
You should use the DAC L/R outputs for this (not the SPKR outputs).

Also, when powered by USB, "5V" is from USB.
When powered by your battery, "5V" is from the Nano's wee, and likely inadequate, 5V regulator.

Those tiny speakers can be handled by the player itself, that amp is adding nothing.

The amp and the DFR player are both supplied from the 5v pin on the Arduino. the 8.4volt battery is attached to the vin pin on the Arduino.

I'm pretty sure the Rx/Tx connections are correct since it works when powered by the USB port. I'll verify it as I make the wiring diagram.

Using the DAC outputs make sense. I'll make that change.

I was starting to realize that the problem was with the internal regulator and am planning on rewiring to run independently from a external regulator powered by the battery.

I realize the speakers are small. they're just for testing. I'm planning on replacing them with larger speakers when I have things working. I want to make a flying ghost Halloween prop and intend to imbed the project in the ghost's head. That's what the hall effect sensor is for, to trigger the sounds when the head starts moving.

Thanks for your input, it helps.


Thanks everyone for your comments and help. I've seperated all of the components so they're powered independantly instead of all powered from the 5v pin on the nano. Also changed the inputs for the amp to use the DAC outputs on the mini player. Everything is working now.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.