Power self-monitoring

Let us know what you think about the chipKIT, and what can be done to make it better!
Post Reply
Flywheel
Posts: 1
Joined: Mon Mar 19, 2012 1:02 pm

Power self-monitoring

Post by Flywheel » Mon Mar 19, 2012 1:12 pm

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
Posts: 79
Joined: Fri Feb 10, 2012 12:36 am

Re: Power self-monitoring

Post by Ryan K » Thu Mar 22, 2012 9:37 pm

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/D ... 61143B.pdf

Best Regards,
Ryan K

AlexanderLittle
Posts: 1
Joined: Fri Nov 15, 2013 11:23 am

Re: Power self-monitoring

Post by AlexanderLittle » Tue Nov 19, 2013 6:47 am

Flywheel wrote: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.

User avatar
majenko
Site Admin
Posts: 2164
Joined: Wed Nov 09, 2011 7:51 pm
Location: UK
Contact:

Re: Power self-monitoring

Post by majenko » Sat Jan 04, 2014 2:02 pm

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.
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".

Post Reply