3pi robot battery life

Hi I was wondering if there was some way to display the amount of battery that is being used on the 3pi robot to the screen. I’m trying to figure out the battery life of my project with the 3pi as the energy source. I heard there was a way to grab the voltage output of the battery pack (I’m trying to graph this voltage vs time, and determine at what point the system is “dead”), but we couldn’t figure out how to access it. Is there somewhere I should be looking that I haven’t stumbled across? Is there example setups and/or code that will help me on my way?


This project sounds like fun; would you be willing to post your results? If you look at the sample programs in the 3pi user’s guide, you can see an example of how to read and display the battery voltage:

// Display battery voltage and wait for button press   
    int bat = read_battery_millivolts();   
    print("Press B");   


If you want to log this data as a function of time, you could set up a loop that reads the battery voltage at fixed intervals and then transmits the result serially to your computer, which you can use to process/graph the data.

If you have an Orangutan USB programmer, you can use it as a USB-to-serial adapter if you move the jumper to short the two pins marked by a “U” on the bottom of the PCB (don’t forget to switch it back to the “P” before you try to program with it!). Just connect 3pi pin PD1 to RX on the programmer and the 3pi’s ground to G on the programmer (you can also connect 3pi pin PD0 to TX on the programmer if you want to send data from your computer to the 3pi). You might find the serial portion of the Pololu AVR library useful for this.

Lastly, make sure you don’t try to program your 3pi when the batteries are low. If the 3pi dies during programming, the microcontroller can get corrupted. If you need to tweak your code during your battery discharge test, make sure you swap in fresh batteries before programming!

Good luck with your project. Please ask if you have any further questions.

- Ben

The batteries (new Duracell AAAs) lasted over 45 mins with our setup.
I spent a few mins before starting the test programing the different microcontrollers.

Our setup involved a stepper motor that ran intermittently, 3 Arduinos, a digital compass, an ultrasound sensor, and a hex inverter.

Attached is the data and a graph.
3pi-battery.xls (28 KB)

That’s an interesting graph - you can see the different phases in the battery life very clearly!

So, is the 3pi just the power source? If so, you might be interested in our new adjustable boost regulator, which is based on the circuit in the 3pi. You could easily use that with, for example, a 6xAA pack and get a much longer battery life.

Anyway, thanks for the graph, and if you get a chance, it would be interesting to know what you are doing with all of those parallel Arduinos!


Hi Paul, yes the 3pi is the power source that is powering all the devices that I specified earlier. We might consider playing around with other batteries that would extend battery life but the current setup is good enough to meet the specifications for the project. If you would like to follow the project that I am working on, please refer to the website http://www.ecs.umass.edu/ece/sdp/sdp09/siqueira/

Essentially what the device is suppose to do is go into a room, scan it at multiple different spots and blueprint it onto a pda/computer screen as a 2d top down view of the room. We are using the 3pi robot platform to move the device from different spots in the room. The ultrasound sensor is used for scanning (laser would be better but because of budget constraints we are using an ultrasound sensor). Stepper motor to help the ultrasound sensor to sweep the room and Arduinos as the brains to control each device. If you have any questions feel free to ask and I will respond as best as I can.

I have a quick question. In our test that we posted, we got roughly a 45 minute length of battery life running off 4 aaa batteries which are rated at 1175mAH. If we have 4 of them, it is rated at about 4700mAH. We had calculated that the additional components we have running off the 3pi is drawing .2A or 200mA. This would mean that we have a 23.5 hour lifespan? Am I doing the calculation wrong? Why are we only getting 50 minutes? We have the 3pi stationary and not running it’s motors.

You can only add capacities when you have batteries in parallel, not when you have them in series. Four 1175 mAh batteries in series have a cumulative 1175 mAh capacity.

Which 3pi power bus are you using for your electronics: VBAT, VBOOST, or VCC?

- Ben


First, adding more batteries in series does not give you more mAH. Please take a look at the batteries section of the 3pi manual for a detailed explanation of what those numbers mean! So you still have the 1175 mAH. Next, are you taking the power from the boost or 5V lines? If you are taking 200mA from the 9.25 V boost line, you will be taking about 500-600mA from the batteries: that’s because if the voltage is being boosted by a factor of 2, you will need at least 2x the amount of current, and there is some inefficiency in the boost regulator. If you are taking some of it from the 5V line, there will be even more inefficiency.

So, if your batteries are really 1175 mAH, you would expect at most 2 hours. They might not actually work as well as that at 600mA, the batteries could be old, and you might be using more current than you think you are. Also, as the voltage on the batteries drops, more and more current will be required to get it up to 9.25 V.

Anyway, with all of these uncertainties, a 45-minute lifetime is not surprising at all. It would help if you could actually measure the current you are using. In any case, a 6xAAA pack with our boost regulator should give you a much longer lifetime.