What batteries should I be using for the GoPiGo?




I have a GoPiGo that I am running off of eight “high capacity” Energizer brand AA alkaline batteries.

The battery life for eight alkaline batteries is remarkably brief, getting about five to ten minutes of run time (at best) before the battery’s ability to source the required current fails.

I am making the, possibly silly, assumption that a robot designed to be used by kids - especially in a classroom environment - should be able to be used, and useful, for a fairly large chunk of a 40-or-so minute class period.

This leads me to ask a few questions:

  • Are the usual run-of-the-mill Duracell/Energizer/etc. alkaline batteries supposed to be suitable?
    • If so, how long should they be lasting?
  • If the usual alkaline batteries are not suitable, what is?

This is extremely frustrating as it is virtually impossible to do anything with this robot before the battery capacity falls below some arbitrary minimum value.

Any thoughts on this?

Jim “JR”



I don’t know what the price of alkalines are in Russia, but I’m guessing rechargeable NiMH AA cells and a charger are a small investment in the long run.

If you were in the states at the moment, I would recommend going for 2800mAH AA size, but perhaps there are 2300mAH name brand rechargeable NiMH batteries are available there.

The DI rechargeable pack and charger is really great, but I’m guessing you are wanting a quickly available solution.

Once you get on rechargeables, I suggest that you create a status program such as this MeasureBatteryLife.py and find out what the maximum life you can expect with no driving, then create a “drive in a small circle for 10 seconds once a minute” program to run in parallel to determine what a 15% duty cycle run time would be.


Most alkaline AA cells will provide around 1200mAH at a 500mA discharge rate and around 750mAH at a 1A discharge rate ( to the 7v GoPiGo3 cutoff).

From this figure, I would guess that you should see 2 hours of processor and wifi only time, and 30 minutes of “wander” time.

Your run times do seem low.

By the way, rechargeable NiMH cells typically provide two to three times longer run times due to a much flatter discharge curve.


(I’m not sure what “arbitrary minimum value” was intended to convey - your frustration leaking through?)

Are you spending most of your learning and programming time with the GoPiGo3 powered from a 2A 5v wall wart plugged into the RPi’s micro-USB jack?

One way to maximize your “run-time” on batteries, is to put some 15 to 30 second “thinking time” pauses in your programs. To make them interesting to children, write some different thinking time routines i.e.

  • Blink one LED every 5 seconds
  • Switch blinking between two LEDs every 5 seconds
  • Make the color led “breathe” by cycling intensity from off to max in one color for 5 seconds up, 5 seconds down.
  • Make the color led “breathe” in a different color each cycle
  • Choose which LED to flash using a random number, and kids can try to guess which LED will light next, or last
  • Measure the battery voltage, and blink one LED with the units value, and the other LED with the “tenths” value. Kids have to count the blinks and announce what the voltage is.

The low-drain breaks allows the chemistry in the AA cells to recover slightly and you will get more run time.

Another idea is to watch the battery voltage, and when it drops below a limit (8.75v?), run thinking only routines, with no use of the motors. The bot will not shut down with juice still in the batteries, but not enough juice to run the motors.



I like your moniker – maybe I should change mine to “OCD&FrustratedBipolar”? (grin!)

You also sound like my kind of person, guy, girl, Martian, whatever. . . . you have an attention to detail that is refreshing. Sometime when you’re in Russia, or I am where you are, we’re going to have to get together.

And yes, it is likely that my frustration is leaking, with two granddaughters on the verge of becoming teenagers having to deal with a strange chemical cocktail coursing through their blood for the first time and cursing their pituitary, (as well as everything else), to the pits of Hell – a wife who is decidedly OCD about EVERYTHING – a fresh delivery of two cubic meters of “fully seasoned firewood” (that we desperately need for the house’s wood burning stove with temps in the –11’s C), that if it were any greener it would hop and go “ribbit!” – GoPiGo instructions that, (though they appear to exist), are scattered all over Hell and half of Texas and require either the X-ray eyes of Superman or the magic of Doug Henning to find – and batteries that appear to be woefully underpowered. . .

Regarding “programming” time. I don’t think that this is the limiting factor since my testing programs already exist having been written using the last set of batteries. I made the mistake of leaving the GoPiGo plugged in overnight – though shutdown – and the batteries had taken a serious hit by the next morning. And no, I haven’t placed an ammeter in the battery leads to measure total current draw, though it would not surprise me if a pack of eight AA cells were only minimally capable seeing as the Pi3 itself spec’s to over 2 amps just to power the beastie up. I suspect that to get any decent time on this ‘bot I’m going to need an 8-pack of D cells or a small 12v gel-cell.

Any idea on what a suitable form-factor gel-cell would be?

Product enhancement request:

The SparkFun “Moto:Bit” board for their micro:bit based robot has an included slide-switch specifically for disabling, (and cutting power to?), the motors. Perhaps a future version of the GoPiGo board could use some kind of switching arrangement to take the motors out of the circuit? Maybe by biasing all four legs of the H-bridge to cutoff? (Or do you already do this, and they leak like sieves?)


One of the reasons I want the pinout of the serial port is because I have a 2x16 (or so) character LCD display that I want to attach and use as a real-time status display. Once I figure out how to get this beastie to last longer than 15 minutes per set of batteries, I want to write some batch files, Python scripts, (etc) that will run at 60 second intervals to update the status display.


Part of the problem is that after about 5-10 minutes of use and after the battery voltage drops to about 9v, the robot cannot drive for more than about 15 seconds.

Once the battery voltage – or perhaps peak current draw – drops below some unknown and arbitrary value, the GoPiGo just stops. Nothing is going on with the lights, the Pi seems to be just fine, but it just stops working until the (supposedly) running program is stopped and restarted.

Running the last script in Hardware Test, the robot moves for about 15 seconds, makes one or two turns, (maybe), and then stops. The program itself reports “running” but the ‘bot does nothing until the program is stopped and restarted.

I have a program called “drive in a square” that does:

  1. Centers the servo for the distance sensor. (turning on the system causes it to jump some small distance to the right.)

  2. Drive forward for one second.

  3. Pause for one second.

  4. Turn 90 degrees to the left.

  5. Pause for one second.

(etc. – repeat steps 2-5 three more times.)

  1. Turn the servo to “0” degrees.

  2. Pause for 1 sec – 0.5 sec – I don’t remember

  3. Turn the servo to 180 degrees.

  4. Pause again as above.

  5. Center the servo.

The expected result is a to move in a square, executing four 90 degree turns and stopping – then run the servo to both extremes and then center it.

With the battery voltage at, (approximately), 9 to 9.5 volts, (exact value is unknown), the robot executes about 15 seconds of this program and then stops without executing the servo routine.

If I “Ctl-C” out of the hardware test when it stalls, it throws a “Keyboard Interrupt” exception, showing the program stuck in one of the libraries, (I cannot tell which one from the web screen), stopped at a “pause for 0.5 seconds” statement. It ALWAYS shows being stopped at this statement, regardless of the amount of time I wait before nuking out.

In no circumstances do the LED’s on any board indicate an error or fault condition (as far as I can see) for any time the program stalls.

It generates the exact same error activity using both DexterOS 2.1.1 and 2.2.2.

I tried to SSH into the robot, but got “connection refused” when executing a SSH connection, using PUTTY, to Ergo I cannot retrieve any runtime logs on a per-session basis.

Since I do not have a second robot to compare things to, I cannot determine if the problem is software or hardware by simple visual inspection. (Though if you folks want to send me another – free - robot or two for testing purposes, I won’t object! :grin!: )

Any ideas would be most gratefully appreciated.


Not quite:

Also, as a point of reference, when you power off a Raspberry Pi (any model), it typically uses 20-30 mA (0.1W) until you physically disconnect the power.


I found the following Li-Ion battery pack at Chip & Dip (an electronics store in Moscow)
(Please open in Chrome unless you speak/read Russian)

It is a 12v 2200 mAh battery pack that is the size of four “AA” batteries - two of these stacked is the same size as the 8-cell battery pack used on the GoPiGo.

They go for about 2,000 rubles, (about $30 USD) per pack. Two would be, obviously, twice that.

I am thinking that if I get a pair of them, wire them in parallel, and stick them together with hot-melt glue, I’d get appx 4400 mAh in the same form-factor as the existing battery pack. the associated charger is about $15.

Is this reasonable? (spec-wise, not necessarily cost wise)
Will I get a reasonable, (appx 30 min or so), run time with this?
Should I build more than one set?
Does anyone have a better idea?

I can buy NiMH rechargeable batteries and an associated charger, but I don’t know what they’d cost. I’d probably need a minimum of 16 batteries along with two or three chargers, (depending on the number charged at one time), to keep a set ready while one is being used.

Correct that, I just looked it up and eight reasonably high-power batteries (2600+ mAh), cost about the same as the 12v Li-Ion pack above. Adding a charger is less expensive than the Li-Ion charger.

Additional note:
NiMH batteries have a nominal full-charge voltage of 1.2v - eight cells gives a nominal voltage of 9.6v - to get a nominal 12v I will need ten of the little beasties.

Based on the behavior I’ve been seeing, I’m not sure I want to run this much less than 12v.

Actually, I can get a Li-Ion pack almost exactly like the first one that is rated for 14.4 at 2200 mAh - hmmm, just thought of something. . .

Correct me if I’m wrong, but doesn’t a Li-Ion battery have a pretty flat discharge curve? That is, when the voltage begins to droop, you’re absolutely done and it’s time to pop in a new set, right? Therefore the 14v pack won’t buy me anything the 12v pack can’t do. . . since both will maintain their voltage until they’re pooped and need to be recharged, right?

Another question:
Given several different battery technologies:

  • LiPo
  • Li-Ion
  • Li-Zinc (1.6v nominal, cost like oil sand in Saudi Arabia)
  • NiMH
  • 12v Gel-Cell
  • (etc.)

Also assume that each battery, or battery set if more than one battery is needed, has a nominal 12v output.

Additionally, assume that all battery sets have the exact same mAh/Ah rating.

Despite the differences in the size, will all the battery sets deliver the same output power for the same period of time? i.e. Given the typical current draw of a GoPiGo, while moving and doing things, will each battery set last for substantially the same length of time, regardless of battery technology?

Jim “JR”



You keep going on about 12v; Look at what DI sells as the official rechargeable pack: an 8 cell 2000mAh NiMH pack with a 1A smart charger.

I would buy 8 of the 2600mAh NiMH AA cells and an appropriate “smart charger” that covers 6 to 12v at either 1A or switch selectable 2A. (I use 1A because it extends the cycle life of the cells by keeping the temperature down.) This is the Tenergy Recharger I use (it comes from the radio controlled hobby)

Personally, I am scared of any Li-Ion batteries exploding. I vividly remember the demonstration, over 50 years ago, in my high school physics or chemistry class where they exposed a strip of lithium to air and it started burning. Every time someone reports their phone exploded I get more convinced how much I like NiMH. It has high enough power density to be good for my robot and my Prius, but not so high as to endanger burns or my house burning down.


No, they each have a different shape discharge curve, and different energy density, meaning higher or lower weight. Where the weight gets important in a robot is the friction on the rear wheel can cause inaccurate turns, and require more power to start moving.


There’s a quick hack you can do: drop in an ssh file in the boot directory while you have your SD card plugged into your computer and then boot it up. You’ll then have access to SSH. Our policy is to disable it before releasing the image so that we can encourage people to use Bloxter or JupyterLab because it’s far easier for teachers to teach that than giving them the incentive to do hacky stuff.

In JupyterLab you are already logged in as jupyter user (with jupyter password) so you can use these credentials when SSHing in. Also, as jupyter user you’ll have full access to the Python libraries that are installed on the GoPiGo3 and the permissions to install new ones (provided you have the wheels for them), but you won’t have root access. The environment you are cocooned in is made with conda.


Yeah, I remember it once when my homemade quadcopter’s propeller hit the battery (which was a LiPo) and it started catching fire - I was kind of scared after that of using LiPos ever again. But I went back again to them because they are lighter than their counterparts - the Li-Ion, so there it is :smile:.


Another thing to consider on your chemistry choice may be cell cycle management. For NiMH the “do not discharge below this level or bad things happen” is 0.9v per cell.

The DI folks have a “powermanagement” routine that is running in the background and will gracefully shutdown the RaspberryPi when you are near the 7.2v or 0.9v/cell point. (Jerking the power from the RaspberryPi due to crossing the cells’ power knee risks SD card damage - the cards can turn into a weird “loses all writes when the power goes off again” card.)

If you discharge NiMH cells below the 0.9v they can reverse polarity and become worthless, and if you only discharge them to 15-20% remaining capacity like 8.5v for an 8 cell pack, they have nearly infinite cycles, but if you regularly take them to 0.9v/cell you get 300-500 cycles. This is why I run a status loop to shutdown even before the DI power management routine would shutdown, but I still get lots of run time.

Most guidelines I have seen suggest LiIon and LiPo battery pack life is maximized by discharging no deeper than 30% capacity, (I’m guessing that is around 12.5v for a 12v pack)

Also, the 12v LiIon batteries start out above 14v - better make sure Matt agrees the GoPiGo3 is ok that high.

That’s the extent I can help you decide. Good luck and let us know what you do end up with and please do run my measurelife.py program and report back to us.


All good points which I really appreciate.

I “go on about the 12 volts” because I am trying to figure out why my 'bot goes brain-dead after a relatively short period of time. I want to be able to take possible power issues completely off the table.

Once I know more about this issue, I can begin experimenting with the power source.

Jim “JR”

p.s. how do you do the status loop? Want to share the code for it?


I also want to include some background monitoring tasks for things like battery voltage, Pi voltage, and perhaps other useful data on a serial LCD display I have.



Where do I get the SSH file from? Is it hidden in another directory or do I scrounge a Raspbian image for it.


Just create a new file named “ssh”


Just “touch” SSH? It’s that simple?


Yeah that’s pretty much what you have to do.