Germany
Asked — Edited
Resolved Resolved by Steve G!

My Battery Is Low

hi there, Im working with the EZB-4 and 21x servos + a lot leds, camera and sensors.. the robot needs a lot power in action. in the same second If my robot says: "my battery is low", he collapse.. I have no time for a reaction. its not good for the optical look.. I dont want scratches.. or a broken arm.. you know. So I need to find a way to programming a better "battery is low warning". or a optical LED.. the best and coolest way is a live status inside the EZ-Robot Software..

thanks Marty


ARC Pro

Upgrade to ARC Pro

Become a Synthiam ARC Pro subscriber to unleash the power of easy and powerful robot programming

United Kingdom
#1  

ARC has a "live status" on-screen battery monitor that displays the voltage of the battery connected to your EZ-B.

Press the Project tab from the top menu bar of ARC.

Press Add Control from the button ribbon bar.

Press the General category tab and then press the EZ-B v4 Info icon to add the control to your project.

You can also write a script using the $GetVoltage variable to give you battery voltage warnings and program what you want your robot to do (such as a verbal warning only, or power down gracefully, and not collapse) by setting the minimum voltage slightly higher than the main warning, or disable the main warning all together and use your battery warning script.

GetVoltage() Returns the EZ-B v4 Battery Voltage Example: $x = GetVoltage()

Hope that helps. :)

PRO
Belgium
#2  

hi guys

you can set the batt warning higher.insteadt the normal 6.6 volt. set it at excample 7.5 volts.on the web page.

United Kingdom
#3  

If you set the low voltage warning higher it wont stop the EZ-B going to low power mode and shutting down servos etc. connected. That solution will not work and will not avoid the robot going limp.

Follow Steve's advice and use the variable for the battery voltage and monitor it, when it drops below a set voltage, high enough to move things still, have the robot move to a safe position where going limp will not cause any damage.

PRO
Belgium
#4  

rich

dont you get a warning when the batt is at 7.5 volts then?

United Kingdom
#5  

@nomad.

What Rich is saying is that changing the voltage setting (in your example, to 7.5v), will be no different to what is being experienced now and won't help @Smarty out, as it will still cause the robot to go limp when the low voltage warning fires off, weather it be 6.6v or 7.5v.

Germany
#6  

thank you guys :-) I will try it today.

PRO
Belgium
#7  

steve g

thanks for explaining.

Germany
#8  

@Steve G

can you post a script to go into auto-position if the battery is low? it would be easier for me and saves time.

because I dont understand:

GetVoltage() Returns the EZ-B v4 Battery Voltage Example: $x = GetVoltage()

What kind of data should I enter there ?

thank you :-)

United Kingdom
#10  

I'm not near a computer right now as I'm out of town and didn't bring it with me, but something like what I posted below should help...


#This script will trigger when the battery hits 6.9 volts. 
#Change the voltage to what you want it to be. 

:Loop

If($GetVoltage()<6.9)

#Enter your  ControlCommand for your  Auto Position action here. 

EndIf

Sleep(500)

GoTo(loop)

I'm not 100% sure of the syntax in the code above (maybe Rich could confirm), but it should be close enough.

EDIT. Looks like Rich beat me to it. :)

United Kingdom
#11  

The If condition needs wrapping in the brackets, you only have half in it. So

IF($voltage = 6.9)

However, a less than is better in case something drains it below 6.9 before the script spots it.

Looping the script with a sleep to constantly monitor would help. Or a waitforchange()

You don't need to assign the GetVoltage() to a variable. You can use it by itself.

See post #10 :)

United Kingdom
#12  

@Rich.

Yeah, I just saw your post. Thanks for clearing that up. I changed the code above to reflect what you said. I have a hard time as it is scripting with a computer, never mind doing it from memory, lol. :P

@Smarty.

Rich has you covered on this one with the script example he posted. That will get you sorted. Just to explain, in the example, the "x" in "$x" is where you can name a variable to anything you want and use it in your scripts, but not always nessasery. :)

Germany
#13  

yahoooo! perfect :-))

thanks a lot

Germany
#14  

variable not defined in line 2.. sick

IF($voltage = 6.9) or If($GetVoltage<6.9)

is not working

United Kingdom
#15  

$voltage needs defining first.

$voltage = GetVoltage()

Or, use GetVoltage() correctly

IF(GetVoltage() &lt; 6.9)
Germany
#16  

hmm.. it says always: variable not defined for both. can you explain what you mean with: $voltage needs defining first. please for dummies :D

United Kingdom
#17  

In the example...

GetVoltage() Returns the EZ-B v4 Battery Voltage Example: $x = GetVoltage()

In the $x part, the x is replaced with "voltage". This equals to the GetVoltage variable. So basicly your giving the "GetVoltage" variable the name "Voltage" which is called upon within the script. This is defining the variable. But as Rich said, this is not needed as $GetVoltage is already an existing variable code so you can simply use this without having to define a variable.

#18  

Smarty, This is what I use. You can add commands you want.

$voltage=GetVoltage() print($voltage) $cputemp=GetCPUtemp() print($cputemp) if (GetVoltage() < 7.0) say("EZB voltage now less than 7 volts") endif

if (GetVoltage() <= 6.7) say("My EZB positronic brain voltage is " + $voltage + " volts, temperature is " + $cputemp + "degrees C") say("Steve, Voltage is now dangerously low, starting automatic shutdown soon, which may result in a neuralnet failure because I will lose the ability to send serial commands to my IRobot drive system. ") endif if (GetVoltage() > 6.7) Say(" I am operating within normal parameters, Thank you father for asking ") say("My EZB positronic brain voltage is " + $voltage + " volts, temperature is " + $cputemp + "degrees C") Say("Steve hope you are doing ok on this " + $dayname + " in " + $monthname ) sleep(1500)

endif

United Kingdom
#19  

So this won't work for you?...

$voltage=GetVoltage()
:loop
If($voltage&lt;6.9)
#Your command code for auto position
Endif
Sleep(500)
GoTo(loop)
#20  

Minor error in Rich's code. $getvoltage() is not a system variable, it is a command which retreives a value..

code should be:


if (getvoltage() &lt; 6.9)
#do something
endif

(with the loops and sleeps etc....)

Alan

United Kingdom
#21  

Alan spotted my deliberate mistake ;)

Edited post to reflect this.

#22  

heh... lessons for the students..

Alan

Germany
#23  

@Steve G I misunderstood.


$voltage=GetVoltage()
:loop
If($voltage&lt;6.9)

is working fine :-) thanks I thought I have to use $voltage=GetVoltage() or If($voltage<6.9):D:D :D

@Steve S thanks for the script, really cool :-)

United Kingdom
#25  

@Smarty.

No worries. :)

United Kingdom
#26  

@Smarty.

I forgot to add a sleep() command in post #24. It just helps give the processor time to think. You can change the value to what you want. I put it as 500 milliseconds and Rich done it for a 1000 which essentually runs the script loop every half a second of sl1 second, so you can change this to what you want.

#27  

Also in post #24 you need to put $voltage=GetVoltage() inside your loop or you are only reading the battery voltage just once....


:loop
$voltage=GetVoltage()

If($voltage&lt;6.9)
saywait(&quot;warning, battery voltage is low&quot;)
endif
sleep(1000)
goto(loop)

PRO
Synthiam
#28  

If your battery is low and you run the battery less than the warning - it may explode. There are dozens of warnings all over the website and in the EZ_B. The message is there for a reason. LiPo batteries CANNOT run less than the specified voltage. The battery is low is there for a reason. It's a lot of code with a great deal of testing to ensure LiPo battery life expectancy and safety.

This warning message cannot be ignored.

Germany
#29  

thanks for the warning @DJ