Running arudino and 2 dc motors from liPo

Hi all, I started a project which initially I though thought would be easy but I have run into a couple of snags.

I am powering a Arduino and two dc 130 motors from a 500mAh liPo battery. My code is running both motors simultaneously at 150 with pwm and everything works well. When I however bump this to up to 255, the system runs for all of a second or two and then the entire things powers down and it appears that the battery is totally drained. If anyone could advise as to where i'm going wrong, it would be much appreciated.

I have included a fritzing jpg and my code below. The green breakout is a step-up module that converts the 3.7v from the battery to around 5v to power the Arduino. I have also included a lipo fuel gauge breakout and even just running the motors at 150 seems to deplete the battery far quicker than I estimated.

#include "MAX17043.h"
#include "Wire.h"

//Battery monitor

MAX17043 batteryMonitor;

//Motor Controles

int STBY = 10; //standby

//Motor A
int PWMA = 3; //Speed control
int AIN1 = 9; //Direction
int AIN2 = 8; //Direction

//Motor B
int PWMB = 5; //Speed control
int BIN1 = 11; //Direction
int BIN2 = 12; //Direction

void setup() {
  //battery status
  Wire.begin();
  Serial.begin(9600);
  Serial.println("MAX17043 Example: reading voltage and SoC");
  Serial.println();
  //motor output
  pinMode(STBY, OUTPUT);

  pinMode(PWMA, OUTPUT);
  pinMode(AIN1, OUTPUT);
  pinMode(AIN2, OUTPUT);

  pinMode(PWMB, OUTPUT);
  pinMode(BIN1, OUTPUT);
  pinMode(BIN2, OUTPUT);
}

void loop() {
  batteryMonitor.reset();
  batteryMonitor.quickStart();
  delay(1000);

  float cellVoltage = batteryMonitor.getVCell();
  Serial.print("Voltage:\t\t");
  Serial.print(cellVoltage, 4);
  Serial.println("V");

  float stateOfCharge = batteryMonitor.getSoC();
  Serial.print("State of charge:\t");
  Serial.print(stateOfCharge);
  Serial.println("%");
  Serial.println();

  //motor control
  
  move(1, 150, 1); //motor 1, full speed, left
  move(2, 150, 1); //motor 2, full speed, left
  delay(1000);
  move(1, 0, 1); //motor 1, full speed, left
  move(2, 0, 1);
  delay(1000);
  
}

void move(int motor, int speed, int direction) {
  //Move specific motor at speed and direction
  //motor: 0 for B - 1 for A
  //speed: 0 is off, and 255 is full speed
  //direction: 0 clockwise, 1 counter-clockwise

  digitalWrite(STBY, HIGH); //disable standby

  boolean inPin1 = LOW;
  boolean inPin2 = HIGH;

  if (direction == 1) {
    inPin1 = HIGH;
    inPin2 = LOW;
  }

  if (motor == 1) {
    digitalWrite(AIN1, inPin1);
    digitalWrite(AIN2, inPin2);
    analogWrite(PWMA, speed);
  } else {
    digitalWrite(BIN1, inPin1);
    digitalWrite(BIN2, inPin2);
    analogWrite(PWMB, speed);
  }
}

void stop() {
  //enable standby
  digitalWrite(STBY, LOW);
}

I have also included a lipo fuel gauge breakout and even just running the motors at 150 seems to deplete the battery far quicker than I estimated.

So what was your estimation of how long it should run?

What current are the motors taking? Without this you can’t calculate anything.

Remember for a 500mAh battery you can’t equate that to 500mA in an hour, it is the best capacity you can get at some “undisclosed” discharge rate. As the discharge rate changes so does the battery capacity, normally downwards.

Thanks for the reply. Judging by the numbers i am getting form the fuel gauge, it basically depletes by 1% every 20 seconds when both motors run at 150.

Below are the specs for the motors

Rated Voltage : 6.0VDC
Rated Load : 10 gcm
No-load Current : 70 mA max
No-load Speed : 9100 ±1800 rpm
Loaded Current : 250 mA max
Loaded Speed : 4500 ±1500 rpm
Starting Torque : 20 g
cm
Stall Current : 500mA max

Are the motors loaded or unloaded?

I suspect that your battery might not be good or fully charged, but we need links to the other parts.

In particular what is the efficiency of the boost converter, these are not normally as efficient as buck regulators.

For the life of me i cant figure out whats causing the problem. The motors are unloaded for the moment but once i have this running I will attach some 3d printed wheels etc.

step-up - http://netram.co.za/3327-tiny-dc-step-up-boost-module-3v-5v-1a.html
Motor Driver 1A Dual TB6612FNG
USB LiPoly Charger - https://www.riecktron.co.za/en/product/3014?search=USB%20LiPoly%20Charger%20-%20Single%20Cell

I have purchased a new 3.7 Li-ion 1000mAh battery. I am going to give this one a go and hopefully it solves the problem. If anyone has any other suggestions, please advise me as to the best solution or approach to this bizarre issue.

Replaced the other battery with a 3.7v lipo 1500mAh and it works great! Thanks for the suggestion that the battery may be faulty.