Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Power Management


  • Please log in to reply
11 replies to this topic

#1 ZakieM

ZakieM

    Advanced Member

  • Members
  • PipPipPip
  • 33 posts
  • LocationIsrael

Posted 30 April 2011 - 09:56 AM

I am searching a code sample of controlling the Netduino power. My project needs to run on battery and the typical ~40mA consumption of the board is not realistic to feed out of battery. I saw some hack like code (that still did not compile) for the Arduino but I understand the Netduino is slightly different in this respect anyway.
Zakie Mashiah
Just a curious guy

#2 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 30 April 2011 - 10:07 AM

Ha!...Good question. How much should be your expected battery-lifetime and/or average current? Which model of Netduino are you using (mini, classic or plus)? Cheers
Biggest fault of Netduino? It runs by electricity.

#3 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 30 April 2011 - 11:16 AM

I saw some hack like code (that still did not compile) for the Arduino but I understand the Netduino is slightly different in this respect anyway.

.NET Micro Framework has PowerState class that could be used to control various power levels - however, the behavior is vendor-specific and it is not implemented in the current version of Netduino firmware. As far as I know, it is planned for a future release.

#4 teachop

teachop

    Advanced Member

  • Members
  • PipPipPip
  • 44 posts

Posted 30 April 2011 - 11:30 AM

I am searching a code sample of controlling the Netduino power. My project needs to run on battery and the typical ~40mA consumption of the board is not realistic to feed out of battery.

I saw some hack like code (that still did not compile) for the Arduino but I understand the Netduino is slightly different in this respect anyway.

I went through this as well. You can read about the CPU options in the at91sam7x data sheet Power Management Controller section, but the Netduino Plus board design isn't really targeting lowest power. What I found is the Netduino Plus works very well for parts of the system that are mains powered, and the portions of the system that are battery powered work better with Arduino Fio. I keep all the main application logic of the system on the Netduino, and the satellite systems for data collection / output operation only have "spinal reflex" logic. They are linked with XBee modules. What is your application?

#5 ZakieM

ZakieM

    Advanced Member

  • Members
  • PipPipPip
  • 33 posts
  • LocationIsrael

Posted 30 April 2011 - 02:53 PM

Prorotype will be with standard Netduino. Then perhaps use the smaller form factor (mini). I don't need any wireless for now either... I noticed the Atmel DS and I know about the PowerState class as well. Not sure all is implemented on the netduino and won't cause any problems. I basically need to wake every 5-10 seconds (7 sounds good), collect some data and if nothing new, go back to sleep. I figured since this is the mode of operation, power can be saved dramatically. I expect the collection of data to take no more than 10ms so think of 10mSec* 50mA + 7Sec*1mA (it should be even less). So no reason for keeping the ARM at full active mode all this time. I want the battery to last as much as possible, but needs to be at least a week. With 9V 250mA/H and 1mA average consumption, it should be more than 10 days, so that is good. I don't mind swithching to Arduino really, I am much more experienced in C then in C# :-) but wouldn't that be missing the purpose?
Zakie Mashiah
Just a curious guy

#6 Nevyn

Nevyn

    Advanced Member

  • Members
  • PipPipPip
  • 1072 posts
  • LocationNorth Yorkshire, UK

Posted 30 April 2011 - 04:19 PM

I want the battery to last as much as possible, but needs to be at least a week. With 9V 250mA/H and 1mA average consumption, it should be more than 10 days, so that is good.

I don't mind swithching to Arduino really, I am much more experienced in C then in C# :-) but wouldn't that be missing the purpose?


Is the physical size of the battery pack critical? Could you not go for a pack made of 2900mA/H AA size made up to 9V? That's the option I'm looking at for a project I'm working on. That and a solar charger but this is a stationary project in a greenhouse so light and size are not a problem for me.

Regards
Mark

To be or not to be = 0xFF

 

Blogging about Netduino, .NET, STM8S and STM32 and generally waffling on about life

Follow @nevynuk on Twitter


#7 teachop

teachop

    Advanced Member

  • Members
  • PipPipPip
  • 44 posts

Posted 30 April 2011 - 09:33 PM

I basically need to wake every 5-10 seconds (7 sounds good), collect some data and if nothing new, go back to sleep. I figured since this is the mode of operation, power can be saved dramatically. I expect the collection of data to take no more than 10ms so think of 10mSec* 50mA + 7Sec*1mA (it should be even less). So no reason for keeping the ARM at full active mode all this time.

Yes, that is a good plan. That is what I do too. IRQs wake things up as needed, or timed sleeps. Everything is programmed in C, even the Netduino Plus, which I put FreeRTOS on instead of the .net stock firmware. It is running a simple webserver, some USB, and a serial interface to the Zigbee.

wouldn't that be missing the purpose?

Depends on the purpose I guess. I thought getting native on the Netduino Plus with C and FreeRTOS, building the tools and even a custom programmer was fun, and that was my purpose. Netduino Plus is a great deal for me. Of course, 99.9% of people buy Netduino because of Visual Studio, so I understand your point!

#8 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 30 April 2011 - 10:08 PM

.NET Micro Framework has PowerState class that could be used to control various power levels - however, the behavior is vendor-specific and it is not implemented in the current version of Netduino firmware. As far as I know, it is planned for a future release.

What we are working on right now is the ability to put your Netduino into a low power mode. Obviously the onboard power LED would still take some power--and there are limited ways to get the MCU back out of low-power mode--but we're playing with options to see what works well.

Chris

#9 ZakieM

ZakieM

    Advanced Member

  • Members
  • PipPipPip
  • 33 posts
  • LocationIsrael

Posted 01 May 2011 - 08:07 AM

Can someone please drop a sample code of putting the Netduino into sleep? I can't seem to understand how to do this. Thanks, Zakie
Zakie Mashiah
Just a curious guy

#10 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 01 May 2011 - 03:26 PM

Zakie, it is clear that it is not possible at the moment. Chris informed us about the feature that is under development. Cheers
Biggest fault of Netduino? It runs by electricity.

#11 TrekRider

TrekRider

    New Member

  • Members
  • Pip
  • 1 posts

Posted 08 May 2011 - 08:22 AM

Any new developments on the low power front. These small boards would be great for remote battery powered data logging if they could achieve the low power specified by Atmel. Anybody tried removing some of the power using components from the board like the LED . Also a proper real time clock would be great for data logging.

#12 ZakieM

ZakieM

    Advanced Member

  • Members
  • PipPipPip
  • 33 posts
  • LocationIsrael

Posted 09 May 2011 - 08:08 AM

I used the following code and indeed this portion is not supported on the Netduino. The lowest it gets is about 30mA compared to typical 40mA. The program and board do go to sleep though... I guess for now, one needs to do is buy the FEZ devices from GHI that do have Sleep support (did not test it yet...) public class SleepHelper { // The below are for the sleep functionality private AutoResetEvent _wakeup; private AutoResetEvent _change; private AutoResetEvent _timerFired; private SleepEvent _wakeupEvent; private SleepEvent _changeEvent; private DateTime _timerTime; public SleepHelper() { _timerFired = new AutoResetEvent(false); _wakeup = new AutoResetEvent(false); _change = new AutoResetEvent(false); } void TimerCallback(object state) { _timerTime = DateTime.Now; _timerFired.Set(); } public void GotoSleep() { Debug.Print("Going to sleep"); Thread.Sleep(20); // to flush the serial try { const int c_Timeout = 3000; // 3 seconds in ms HardwareEvent newEvents = HardwareEvent.SystemTimer; // | HardwareEvent.GeneralPurpose; PowerState.OnSleepChange += new SleepChangeEventHandler(this.SleepChange); Timer t = new Timer(new TimerCallback(this.TimerCallback), null, c_Timeout, Timeout.Infinite); PowerState.Sleep(SleepLevel.Sleep, newEvents); // we must have received the heads-up on power change... if (_change.WaitOne(1 * c_Timeout, false)) { // and timers must still work as scheduled if (_timerFired.WaitOne(2 * c_Timeout, false)) { if (_wakeup.WaitOne(3 * c_Timeout, false)) { Debug.Print("All is good (morning)"); } } } t.Dispose(); } catch (Exception ex) { Debug.Print(ex.Message); } PowerState.OnSleepChange -= new SleepChangeEventHandler(this.SleepChange); } void SleepChange(SleepEvent ev) { if (ev.EventType == SleepEventType.ChangeRequested) { _change.Set(); _changeEvent = ev; } else if (ev.EventType == SleepEventType.WakeUp) { _wakeup.Set(); _wakeupEvent = ev; } else { Debug.Assert(false); } } }
Zakie Mashiah
Just a curious guy




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.