Asked — Edited

Give A Report On Battery Level?

I received my JD Humanoid a few days ago, and I have to say that so far I am very impressed! My idea was to be able to ask something along the lines of "whats your battery level" and have JD give me a response. The response either in the form of percentage or number or whatever. I know that anything is possible in programming, but I know there may be limits with the robots right now. However, I thought I would ask and see if anyone had ideas or if this has already been done.


*As a note, I do know that the humanoid alerts you when the battery is low. That is how I started to think about this idea.


Upgrade to ARC Pro

Your robot can be more than a simple automated machine with the power of ARC Pro!


There should be a variable which holds the battery level. Add the variable watcher and connect to a ez-b and you will see the variable pop up. Then make a simple say script:


Add that to the speech recognition control as a response to "what is your battery level".


Wow, that was a quick response! The only thing I don't understand is do I have to find the variable that is already build in to the system or do I have to set it up? You meantioned something about variable watcher. The rest of that you shared makes complete sense to me though.


Yeah - that's exactly right. It's a function but not a variable. Do this..

  1. load ARC

  2. load your JD project

  3. press PROJECT -> ADD CONTROL -> AUDIO -> SPEECH RECOGNITION from the top menu

  4. press the ? question mark on the speech recognition control and read the tutorial to understand it before continuing

  5. now press the GEAR icon on the speech recognition control

  6. add your phrase "what is your battery voltage?"

  7. press the multi line script edit button, as you learned from the activities in the learn section and paste this code...

$voltage = getVoltage()

sayezb("My battery is " + $voltage + " volts")


I actually did this already. The answer was given about 7.4 volts. So that's the battery life left? And I understand the speech recognition and such, just didn't know about the variable.


As a random side note, it is super amazing to have you, DJ, post on the forums. It shows you have a huge passion for the robots and I respect that a lot. Thanks for the great product!



Yes - the battery capacity is rated at 7.4 volts. If your robot is returning that voltage, the battery is quite charged. A freshly charged battery will start at around 8.2 volts... The battery saver will kick in at 7 volts, because using a battery below 7 volts has too high of a discharge rate and damage will be done to the lipo. Lipo batteries use a similar but different approach with the chemicals over a traditional battery. Where a traditional battery can be completely discharged, a lipo can not. Also, a lipo can provide a huge number of amperage while operating within it's efficiency charge capacity. Meaning, each battery has a chart displaying efficiency and the ez-robot lipo's are above 7v for optimal efficiency.

If an ez-robot lipo is used below 7v, the discharge is too quick due to poor efficiency and the battery will be damaged.

So, back to your first question - how to turn this value into a percentage? Let's play with math!

$voltage = round( ( ( getvoltage() - 7 ) / 1.2 ) * 100, 1 )

SayEZB("I have " + $voltage + " percent remaining")

Here's what i'm doing...

  1. get the voltage and subtract 7
  2. divide the value by 1.2 to get a percent (this is because 8.2 is the max, so subtracted by 7 means it's 1.2).
  3. multiple the value by 100
  4. round the response to 1 decimal place

Battery voltage subtracted by 7, divided by 1.2, multiplied by 100 and rounded to the first decimal place.

*note: if your freshly charged battery is showing a voltage of 8.5, for example, change the 1.2 to 1.5.


Awesome! Thank you Maze for the post earlier and especially thank you DJ for all information and explanations! Exactly what I was looking for and a lot more! I love learning extra things so thank you.:)


About how long will the 1300mah lipo power an ezb with camera, some LEDs and a servo hooked to it.


I will fully charge, then let it run, and get back to you when its complete.


@vonjet How long will a car run on a tank of gas?... Depends... How fuel efficient the car is, is the driver a lead foot. are the tires properly inflated, carrying a lot of weight, uphill or down hill, in the cold or hot...etc... You get the picture...

You can do a simple guess-timate, however...... The ezb4 and camera use about 180mA... a servo can use anywhere from 20MmA to 1 - 2amps depending on how much it is used and how much load is on it... LEDs maybe 20Ma... so

X = hours of operation X = 1300/ (180 (ezb)+500mA (servo)+ 20mA(LEDS)) X = 1.85hrs (this will vary widely though as it depends on what the servo is doing)


Excellent. This is good info. Thank you.