Digging the power features!

The more technical aspects of Spirit, and carry-over discussion from Kickstarter updates.
gpvillamil
Posts: 75
Joined: Fri Jan 26, 2018 5:03 pm

Digging the power features!

Postby gpvillamil » Sun Feb 04, 2018 11:27 pm

I take it powerVoltage shows battery voltage * 1000, and powerCurrent shows milliamps?

Seems very accurate - I wrote a little Arduino program to dump voltage and current values, and you notice immediately when you fire up the camera over VNC!

Any thoughts on what the critical low voltage value is? Was thinking of writing a simple battery monitor routine that flashes the mainboard LED when voltage goes below a certain level.

I'll leave the program running for a while and see how long it takes for the battery to run down. (Can't leave it plugged in to USB since it will charge from that port... and of course, the moment I plug in to check battery, it will report the input voltage...)

User avatar
esba1ley
Posts: 58
Joined: Sun Jan 01, 2017 2:15 am
Location: Pasadena, CA
Contact:

Re: Digging the power features!

Postby esba1ley » Mon Feb 05, 2018 3:30 am

Yeah, they're pretty nice. Now that I can program the AVR directly, I'm starting to play with them, too.

You can really tell when the camera is on (in this case, reading 640x480 @ 30fps, streaming to the windowing system).

See my blogpost with the plot of the power time series... when the camera is on really jumps out:

https://eriksbailey.wordpress.com/2018/ ... rit-rover/
----------
Erik S. Bailey
Entry, Descent, and Landing Aerospace Engineer
Maker, and Musician
SpiritRover Kickstarter Backer #460

gpvillamil
Posts: 75
Joined: Fri Jan 26, 2018 5:03 pm

Re: Digging the power features!

Postby gpvillamil » Mon Feb 05, 2018 4:52 pm

Yeah I noticed the jump, from 400ma to 900ma. Have you tried using rpistill -t 0? You won't be able to see it over VNC but it will give you a sense of how much power turning the camera on takes, vs encoding and processing.

esba1ley wrote:Yeah, they're pretty nice. Now that I can program the AVR directly, I'm starting to play with them, too.

You can really tell when the camera is on (in this case, reading 640x480 @ 30fps, streaming to the windowing system).

See my blogpost with the plot of the power time series... when the camera is on really jumps out:

https://eriksbailey.wordpress.com/2018/ ... rit-rover/

Kevin
Posts: 176
Joined: Tue Jul 28, 2015 12:56 am

Re: Digging the power features!

Postby Kevin » Mon Feb 05, 2018 5:06 pm

Hey guys. Yea there are lots of these little tricks in that PIC. You can also set a comparator to trigger at certain voltage levels and flip a pin. Still need to document this but it's all there.

The default values in the PIC are as follows:
volatile unsigned int voltageWarning = 3450 ; //Low voltage warning setpoint
volatile unsigned int voltageEmgShutdown = 3200 ; //Low voltage auto emergency shutdown setpoint
volatile unsigned int currentWarning = 1800 ; //High current warning setpoint
volatile unsigned int currentEmgShutdown = 2300 ; //High current auto emergency shutdown setpoint

You can change these values as well via I2C comms from the Arduino or Pi.

Check out the Arduino tab "Comms" and look at regTarget numbers 101 to 107.

gpvillamil
Posts: 75
Joined: Fri Jan 26, 2018 5:03 pm

Re: Digging the power features!

Postby gpvillamil » Mon Feb 05, 2018 6:48 pm

Cool.

So if I were to write a power monitor routine, I'd probably switch the LED to amber at voltageWarning, and fast blink red at voltageEmgShutdown?

In the short term I'll also test a little routine to treat the left wing as a voltage meter and the right wing as a current meter.

Kevin wrote:Hey guys. Yea there are lots of these little tricks in that PIC. You can also set a comparator to trigger at certain voltage levels and flip a pin. Still need to document this but it's all there.

The default values in the PIC are as follows:
volatile unsigned int voltageWarning = 3450 ; //Low voltage warning setpoint
volatile unsigned int voltageEmgShutdown = 3200 ; //Low voltage auto emergency shutdown setpoint
volatile unsigned int currentWarning = 1800 ; //High current warning setpoint
volatile unsigned int currentEmgShutdown = 2300 ; //High current auto emergency shutdown setpoint

You can change these values as well via I2C comms from the Arduino or Pi.

Check out the Arduino tab "Comms" and look at regTarget numbers 101 to 107.

gpvillamil
Posts: 75
Joined: Fri Jan 26, 2018 5:03 pm

Re: Digging the power features!

Postby gpvillamil » Tue Feb 06, 2018 6:48 am

Here's a start, attached a quick Sketch to display voltage on the left wing and current on the right wing. It's fun to fire up VNC, startup various video and 3D programs, and see the current usage climb...

gpvillamil wrote:...

In the short term I'll also test a little routine to treat the left wing as a voltage meter and the right wing as a current meter.

...
Attachments
Spirit_PowerDisplay.zip
(54.07 KiB) Downloaded 22 times


Who is online

Users browsing this forum: No registered users and 1 guest