# Power Expander Status port

what port do i plug the power expander status port in to the cortex?

https://vexforum.com/t/how-to-power-expander/22856/1

Seems like you can put it into any analog input. Not sure why its analog and not digital tho, I’m guessing its just a high/low state.

It’s Analog because it allows you to read the battery voltage from the battery plugged into the power expander.

I’ve done that and it’s showing 2289.0. What factor to get to Volts?

Any analog port because it gives you the voltage. Check the VEX site. They tell you what to divide by to get the voltage and what voltages are good. The divisor will vary depending on what you’re using it with.

Idk it wasn’t displaying any of those values but a factor of 300 seemed to work.

We found that there was a version change in the power expanders, and the division factor changed between versions. The easiest way to determine the division factor is just to use a volt meter to determine the true voltage, and then read the power expander status value and create the factor yourself. Use a couple of different batteries to be sure you get a good value.

I have code for showing power expander batteries for newer power expanders, I can go double check the value.

Here’s a link to the PDF instruction sheet, which includes details for all version of the Power Expander:

From the instructions:

Power Expanders, no revision, Rev NC1, A or A1:

With Cortex Microcontrollers divide the analog port value by 45.6. Example: The Cortex analog value is 297. 297 / 45.6 = 6.5
6.5v is the current voltage of your Power Expander battery.

Power Expanders of revision A2:

With Cortex Microcontrollers divide the analog port value by 70. Example: The Cortex analog value is 455. 455 / 70 = 6.5
6.5v is the current voltage of your Power Expander battery.

Ok so I used 300.0 and it gives me an accurate reading.

I believe this is similar to what we found as well.

Okay, the PDF is wrong, and the difference relates to the resolution of the A/D converter currently used in the Cortex. Here’s what we’ve used to format a text string containing the value of the battery plugged in to the power expander:

sprintf(auxBattery," %f Volts\n",(float)SensorValue[power]/270.0);

Here’s a post in the thread where we discussed an issue with @jpearman. You can look at the code we used for that last December:

https://vexforum.com/t/nimmediatebatterylevel-changes-only-at-power-off-on-cycle/38363/1