How Long Does A GoPiGo3 Go When It Doesn't Go Go?

How Long Does A GoPiGo Go When It Doesn’t Go Go?

I was wondering “How long will my GoPiGo3 run if it only contemplates its navel?

The following is the report of my experiment.

Required elements:

  • GoPiGo3 with updated firmware
  • Fully charged 8x AA NiMH cell batteries in standard GoPiGo3 battery holder.
  • Configured Raspian For Robots with updated Dexter Industries software
  • Optional: Voltmeter, DC-Clamp-On Ammeter, (or special cable and in-line ammeter)


  • Make sure batteries/battery pack is fully charged
    – Each battery measures about 1.5v individually at no load
    – Battery Pack measures about 12v at no load
  • Connect battery cable
  • Press GoPiGo3 Power Button
  • About a minute after power light turns solid green,
    login to GoPiGo3 via ssh or browser terminal session
  • mkdir batterytest
  • cd batterytest
  • nano
  • copy/paste the program below into the terminal window
  • cntl-X, y to exit and save file
  • chmod 777
  • type: ./ (doesn’t shutdown properly with “python”)
  • record first battery voltage reading
  • record battery voltage reading every 60 minutes until GoPiGo shuts down
  • Wait for blinking green light, then press power button to turn GoPiGo3 off
  • Disconnect battery cable and connect to charger
  • Compute average voltage (V1+V2+Vn)/n

Questions To Answer:

  • How long will a GoPiGo3 go when it doesn’t go go?
  • What can we calculate from this knowledge?
    – Average Battery Pack Voltage (V0+V1+V2+Vn)/n
    – Estimated Available Power (Watt-Hours) in Battery Pack
    (Time * Vaverage * Iestimate=0.275A for Idle Battery Draw with Pi3B)
    – Estimated System Load at idle in watts (Vaverage * Iestimate=0.275A)
    – Given a 9.6v 2000mAh battery pack, how long might a GoPiGo3 contemplate his navel?
    (Use measured Vaverage, and Estimated system Load: Iestimate of 0.275A)


milliampere-hour (mAh): measure of battery capacity to store energy
equivalent to average milliAmperes times time
Watt (W): unit of instantaneous power, equivalent to volts times amperes
Watt-hour: unit of energy/power used over time
milliWatt-hour mWh: W-hr times 1000
Volt: unit of electrical force or charge
Ampere: unit of current or flow of electrons

Program to run to find out just how long a fully charged GoPiGo will “run” while meditating on the power of silence.

#     Controlled Battery Life Measurement
#      Run Battery down while printing status every 10 seconds
#      This test will loop reading the battery voltage
#        UNTIL voltage stays below 7.4v 4 times,
#        then will force a shutdown.
import sys
import time
import signal
import os
from datetime import datetime

import gopigo3

LOW_BATTERY_V = 7.4   # 8cells x 0.925v  # safe value, could go to 0.9

# Return CPU temperature as a character string
def getCPUtemperature():
    res = os.popen('vcgencmd measure_temp').readline()

# Return Clock Freq as a character string
def getClockFreq():
    res = os.popen('vcgencmd measure_clock arm').readline()
    res = int(res.split("=")[1])
    if (res < 1000000000):
        res = str(res/1000000)+" MHz"
    else: res = '{:.2f}'.format(res/1000000000.0)+" GHz"
    return res

# Return throttled flags as a character string
def getThrottled():
    res = os.popen('vcgencmd get_throttled').readline()
    return res.replace("\n","")

def getUptime():
    res = os.popen('uptime').readline()
    return res.replace("\n","")

def printStatus():
  global gpg

  print "\n********* CARL Basic STATUS *****"
  print, getUptime()
  vBatt = gpg.get_voltage_battery()  #battery.volts()
  print "Battery Voltage: %0.2f" % vBatt
  v5V = gpg.get_voltage_5v()
  print "5v Supply: %0.2f" % v5V
  print "Processor Temp: %s" % getCPUtemperature()
  print "Clock Frequency: %s" % getClockFreq()
  print "%s" % getThrottled()

# ######### CNTL-C #####
# Callback and setup to catch control-C and quit program


def signal_handler(signal, frame):
  print '\n** Control-C Detected'
  if (_funcToRun != None):
  sys.exit(0)     # raise SystemExit exception

# Setup the callback to catch control-C
def set_cntl_c_handler(toRun=None):
  global _funcToRun
  _funcToRun = toRun
  signal.signal(signal.SIGINT, signal_handler)

# ##### MAIN ######

def handle_ctlc():
  global gpg
  print " handle_ctlc() executed"

def main():
  global gpg


  # #### Create instance of GoPiGo3 base class 
  gpg = gopigo3.GoPiGo3()
  batteryLowCount = 0
  #print ("Starting status loop at %.2f volts" % battery.volts())  
    while True:
        vBatt = gpg.get_voltage_battery()
        if (vBatt < LOW_BATTERY_V): 
            batteryLowCount += 1
        else: batteryLowCount = 0
        if (batteryLowCount > 3):
          print ("BATTERY %.2f volts BATTERY LOW - SHUTTING DOWN NOW" % vBatt)
          os.system("sudo shutdown -h now")
        time.sleep(10)    # check battery status every 10 seconds      
                          # important to check often to catch rapid drop at the end
    #end while
  except SystemExit:
    print " exiting"

if __name__ == "__main__":

Results from my run

  • GoPiGo3, Raspberry Pi 3B,
  • 8x NiMH AA cells with 2200 mAH rating
pi@Carl:~/Carl $ ./

********* CARL Basic STATUS *****
2018-08-28  11:43:51 up 0 min,  2 users,  load average: 1.67, 0.50, 0.17
Battery Voltage: 10.56
5v Supply: 5.05
Processor Temp: 37.0'C
Clock Frequency: 1.20 GHz

... (Intermediate output removed for brevity) ...

********* CARL Basic STATUS *****
2018-08-28  18:43:13 up  7:00,  2 users,  load average: 0.12, 0.03, 0.01
Battery Voltage: 8.22
5v Supply: 5.05
Processor Temp: 50.5'C
Clock Frequency: 600 MHz

********* CARL Basic STATUS *****
2018-08-28  19:02:52 up  7:19,  2 users,  load average: 0.08, 0.03, 0.00
Battery Voltage: 7.32
5v Supply: 5.03
Processor Temp: 50.5'C
Clock Frequency: 600 MHz
Connection to X.0.0.X closed by remote host.

My Results:

  • My original guess of 4 hours (2200mAh/500mAh) was based on very wrong understanding
  • When Carl did not shutdown per first guess, I had to shut him down “early”
  • On two subsequent tests, “Carl” sat quietly meditating in his corner for 7.3 hours
  • Actual “Idle Battery Life” of 7.3hrs is within 8% of revised estimate of 7.9hrs
  • Actual life is within 5% of post experiment estimate 7.6 hrs
  • Max startup battery current seen on meter: 430ma at 10.7v
  • Beginning idle battery current: 225ma at 10.7v or 2.4wt
  • Estimated Power Used: 7.3 hrs at 9.1v ave. 260mA ave.: 17.2 Watt-Hours or 1898mAh
  • Estimate Portion of Rated Battery Capacity Used 81-85%
  • Distance Sensor draws 30mA at 10.1v battery
  • Pan Servo draws 70-100mA at 10.1v battery
  • forward() “no-load” draws ~200mA extra (~430mA total) at 9.8v
  • forward() “loaded” draws ~330mA extra (~580mA total) at 9.5v
  • Connecting with remote desktop adds 10mA
  • Each “Eye” draws about 15mA at 9.5v
  • Speaking with espeak TTS draws about 15mA at 9.1v
  • Running glances draws ~40ma ave., 80ma peak, temp +3deg to 53C, (CPU at 5%)
  • Wired speaker draws 20-50mA when charging in “on” state
  • GoPiGo PowerLED went “yellow”, then quickly red at 7:21 around 7.4v?
  • GoPiGo3 power circuit contains Schottky diode for reverse polarity protection
    (perhaps 0.3v voltage drop?) and DMP3017SFG NMOS FET power switch (0.6v drop?)
    between battery pack and the Voltage Regulator
  • GoPiGo3.get_battery_voltage() is reading 0.6v less than battery voltage measured
    at the battery pack terminals

Experiment Notes


This is fascinating! Thanks for the tests and reports. Seven hours is approximately what I get in a work day, although the robot is doing a bit more than navel gazing :slight_smile:
Now I need to find batteries that will last a full work day .


1 Like

After advice from some folks over at robotics forum, and thinking about the 168 NiMH cells in my 10 year old Prius, I have selected a shutdown limit of 1.1375v per cell, 9.1v at the battery, which is 8.5v indicated by gopigo3.volt(). This will yield a little more than 6.5 hours of mindless contemplation by my bot in its corner. (Sacrificing 45 minutes of immediate gratification for longevity.)

What I’m really happy about is that you made an actual graph of the battery voltage vs time. That really shows everyone the expected run-time of the robot in very specific conditions, like those mentioned by you. I also added the noteworthy-answer to bring awareness to this post when referred in others.

This is really great and thank you!

1 Like

Six Month Update: Carl is feeling a lack of stamina!

I put eight EBL 2800mAh AA size NiMH cells in my Raspberry Pi 3B powered GoPiGo3 six months ago. All cells initially delivered at or near rated capacity.

Initial life to 0.9v/cell cliff was a little more than 9 hours at 440ma average load, and life to 15% capacity remaining was 7h30m.


The batteries were used in 56 sessions for a total of 367 hours. Each session was terminated at or before a “safety shutdown” of 8.72v (1.09v/cell) (8.72v - 0.6v reverse polarity protection diode = 8.1v reported by volt() function). The cells were fully charged when not in use.

After 6 months the eight cell group is delivering only 1h30m life to the 15% remaining capacity safety shutdown. Carl keeps screaming "Helloooo? My battery is getting a little low here!"

I measured the cells under controlled refresh cycling to the 0.9v/cell cliff:

  • four cells are delivering 2250-2350 mAh
  • four cells are delivering 1850-1950 mAh

Eight new cells arriving today.

Further Update

To add intrigue to Carl’s current ailment, perhaps he just needed to get off the couch more (2 months with no exercise), to stretch his 'trons.

I’ve done four deep discharge cycles so far, and his stamina seems to be returning. The first two cycles did not show improved exercise capacity, but then his “run till total exhaustion” (7.4v indicated, 8.0v battery) times went up to 4 hrs, and then 7hrs for this latest exercise bout. Charging now with high hopes for a total recovery. (But then I have to manually exercise the 8 new cells - what have I gotten myself into?)