VEX Forum RobotC Power Expander Status Battery Voltage
 Portal Register Gallery Wiki Members Calendar Search Today's Posts Mark Forums Read Rules

 Technical Discussion Open Technical Discussion of the VEX Robotics System.

#1
04-11-2012, 08:52 PM
 StephenDsDude Senior Member VEX # 675B Join Date: Jan 2012 Location: Buford, GA Posts: 138 Images: 17
RobotC Power Expander Status Battery Voltage

I wish to view the voltage level in the battery attached to the power expander in RobotC. I have this quick calculation:

Code:
`    string exp_bat = (float)SensorValue[in6]/45.6;`
(for the LCD display) but it returns me a value of about 4.8. Am I doing something wrong? I am using the VEX Cortex.

Thanks
__________________
• Team Leader of Team 675B
• Excellence Award at GSMST Qualifier (1-28-2012)
• Tournament Champions and Excellence Award at Ola Mustangs Qualifier (1-19-2013)
• Tournament Champions at Carrollton Qualifier (2-9-2013)
#2
04-11-2012, 10:02 PM
 jpearman Senior Member VEX # 8888 Join Date: Apr 2011 Location: Los Angeles Posts: 2,822 Images: 2
Re: RobotC Power Expander Status Battery Voltage

The numbers on the Wiki were assuming a 10bit A-D conversion, the code I use with my power expander is as follows.

Code:
`battery2Level = (int)((float)SensorValue[ BATERY_2_PORT ] * 5.48);`
Why 5.48 ?

Well I wanted the battery level in mV not V. As I said, the number 45.6 was for a 10 bit A-D conversion so for ROBOTC with 12 bit A-D the number would be 4 times larger, 45.6 x 4 = 182.4 so

V = AnalogValue / 182.4

but I want mV so

mV = AnalogValue / 182.4 * 1000

1000 / 182.4 = 5.48

Now having said that if you use 182.4 then you will get an even smaller value, so there are two possible explanations.

1. You have something connected wrong, you should have analog input 1 connected to the status port on the power converter. 4.8 x 45.6 gives an analog value of 219, this feels like you are reading an unconnected analog input as it is about the value of a floating input. Does the value on analog in1 change when you connect and disconnect the power expander battery?

2. There is a theory that there are two versions of power converter, I know the one I have is an older model, it has an issue that when the status port is connected then the led flashes red indicating an error even when there is not one. If there is indeed a new model then the calibration may have changed and different numbers needed, I have not been able to test this as the new unit I ordered is still on backorder.

There is some discussion in this thread

and also this one

#3
04-12-2012, 04:13 AM
 StephenDsDude Senior Member VEX # 675B Join Date: Jan 2012 Location: Buford, GA Posts: 138 Images: 17
Re: RobotC Power Expander Status Battery Voltage

Thank you for the reply; I will test out the new conversion tonight and respond back with results.

As for the 4.8 number, it does fluctuate when the arm and only the arm is being moved (which are the 4 motors in the expander) and I do believe it went to 0 when the battery was removed, but I am not fully certain of this. I'll respond back later today.
__________________
• Team Leader of Team 675B
• Excellence Award at GSMST Qualifier (1-28-2012)
• Tournament Champions and Excellence Award at Ola Mustangs Qualifier (1-19-2013)
• Tournament Champions at Carrollton Qualifier (2-9-2013)
#4
04-12-2012, 07:44 PM
 StephenDsDude Senior Member VEX # 675B Join Date: Jan 2012 Location: Buford, GA Posts: 138 Images: 17
Re: RobotC Power Expander Status Battery Voltage

Okay, so after testing, it actually gives a value of 48.[something] normally. Multiplying by 5.48 gives me 118[something]. However, I am certain this is tied to the battery because it fluctuates whenever the arm is moved.

(sorry I don't have the [something]s for you; I shorten the number to a 3 character string so I can view the battery, the power expander battery, and the backup batter voltage in one line on the LCD)
__________________
• Team Leader of Team 675B
• Excellence Award at GSMST Qualifier (1-28-2012)
• Tournament Champions and Excellence Award at Ola Mustangs Qualifier (1-19-2013)
• Tournament Champions at Carrollton Qualifier (2-9-2013)
#5
04-12-2012, 07:55 PM
 jpearman Senior Member VEX # 8888 Join Date: Apr 2011 Location: Los Angeles Posts: 2,822 Images: 2
Re: RobotC Power Expander Status Battery Voltage

Quote:
 Originally Posted by StephenDsDude Okay, so after testing, it actually gives a value of 48.[something] normally. Multiplying by 5.48 gives me 118[something]. However, I am certain this is tied to the battery because it fluctuates whenever the arm is moved. (sorry I don't have the [something]s for you; I shorten the number to a 3 character string so I can view the battery, the power expander battery, and the backup batter voltage in one line on the LCD)
Ok, well that sounds like they did change the hardware. 48 * 45.6 gives 2189, this would be about 2.67V on the AD converter.

V = Analog Value / 275
#6
04-13-2012, 08:34 PM
 StephenDsDude Senior Member VEX # 675B Join Date: Jan 2012 Location: Buford, GA Posts: 138 Images: 17
Re: RobotC Power Expander Status Battery Voltage

Thank you, that number works great. Perhaps VEX just has yet to update the wiki page on the Power Expander.

Either that, or I overread the page. Either way, thanks.
__________________
• Team Leader of Team 675B
• Excellence Award at GSMST Qualifier (1-28-2012)
• Tournament Champions and Excellence Award at Ola Mustangs Qualifier (1-19-2013)
• Tournament Champions at Carrollton Qualifier (2-9-2013)

 Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home VEX News Official VEX Technical Support     OFFICIAL Answers - Ask the VEX Staff!     UNOFFICIAL Answers - Ask the Community!     Official VEX Technical Support FAQs     VRC Toss Up Official Rules Q&A Other Technical Support     EasyC Technical Support Q&A     EasyC Technical FAQs     ROBOTC Technical Support Q&A     ROBOTC Technical FAQs Community     General Forum     Technical Discussion     CAD Discussion     VEX IQ     VEXpro     VEX Robot Showcase     VEX Compatible Products     New VEX Product Ideas     VEX Product Announcements     VEX in the Classroom     Chit-Chat / Rumor Mill Competitions     BEST     VEX IQ Challenge     VEX Robotics Competition         E-Mail Blast Archive         VRC Toss Up (2013-2014 VRC Game)             Official VRC Toss Up Q&A             Official VRC World Championship Q&A (2013-2014)         VRC Sack Attack (2012-2013 VRC Game)         VRC Gateway (2011-2012 VRC Game)         VRC Round Up (2010-2011 VRC Game)         VRC Clean Sweep (2009-2010 VRC Game)         VRC Elevation (2008-2009 VRC Game)         Bridge Battle (2007-2008 VRC Game)         Team Surveys     TSA VEX Robotics Competition     Online Challenges Discussion     Online Challenges Official Q&A Website Support     Forum & Website Support

All times are GMT -6. The time now is 11:05 AM.

VEX and VEX Robotics are trademarks or service marks of Innovation First International, Inc.