chipKIT® Development Platform

Inspired by Arduino™

Power self-monitoring

Created Mon, 19 Mar 2012 12:12:48 +0000 by Flywheel


Flywheel

Mon, 19 Mar 2012 12:12:48 +0000

I wonder if the chipkit board already has self-monitoring for it's own powersource built-in. I am thinking along the line where it is powered by an independant source, like solar panels and batteries and is able to switch itself to power preservation mode on time. Maybe in a few stages, like preservation, status save and waiting to be woken again. The simplest way of doing this now is by using a port to sample the (halved) voltage input power in a routine, I was thinking. Even if there is a steep decline in voltage input, there still would be enough time to act.

Thought anyone? Already built-in or?


Ryan K

Thu, 22 Mar 2012 20:37:15 +0000

Hello,

I don't believe this is built in but you could input the voltage into one of the analog pins and monitor that until it reaches below a point and go into sleep mode. Sleep mode is set up using

OSCCONSET = (1 << 4);

and sleep mode is entered using

asm("wait");

There is a section on power saving in this document for the PIC32 devices:

http://ww1.microchip.com/downloads/en/DeviceDoc/PIC32MX_Datasheet_v2_61143B.pdf

Best Regards, Ryan K


AlexanderLittle

Tue, 19 Nov 2013 05:47:43 +0000

I wonder if the chipkit board already has self-monitoring for it's own powersource built-in. I am thinking along the line where it is powered by an independant source, like solar panels and batteries and is able to switch itself to power preservation mode on time. Maybe in a few stages, like preservation, status save and waiting to be woken again. The simplest way of doing this now is by using a port to sample the (halved) voltage input power in a routine, I was thinking. Even if there is a steep decline in voltage input, there still would be enough time to act. Thought anyone? Already built-in or?

Nice thought.. It is the ideal way to preserve energy and make best use of renewable sources.


majenko

Sat, 04 Jan 2014 13:02:34 +0000

The PIC32 has brown-out detection. When the power dips below a certain threshold it resets the chip when the power comes back to the right level. It also sets a flag to indicate the reset was caused by a brown-out.

Not necessarily what you are after, but could be useful.

The chipKIT boards generally (at least, the UNO32 and MAX32) have dual supply with auto switchover - USB supply and barrel jack supply. The Vin pin on the header is linked to the barrel jack. When there is power coming in through the barrel jack a P-channel MOSFET is switched (using a comparator) off to stop current flowing back through the USB port. Without that power the MOSFET conducts through its internal diode to provide enough power for the comparator to turn the MOSFET on and provide the full 5V from the USB port.

Have the USB port provide your backup power, and the main power coming in through the barrel jack, then add a voltage divider between Vin/GND and an ADC input. You can then sample the ADC to determine the incoming voltage, and if it drops below a threshold (where it would be switching to the USB supply) then switch to a low-power mode.