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

Managing Peripheral Power


  • Please log in to reply
19 replies to this topic

#1 Arron Chapman

Arron Chapman

    Advanced Member

  • Members
  • PipPipPip
  • 289 posts
  • LocationOregon, USA

Posted 27 November 2012 - 04:10 AM

The Ethernet part (ENC28J60) alone on the N+2 consumes 150 mA, that along with the on-board led and potentially a uSD card could contribute to quite a bit of waste. If you plan on running your project off of a battery, you obviously want to get the power consumption down as low as you can. I've written up a small class with a single static method, and a single enum to make the process of turning off the peripherals easy.

Usage;
//Turn off the Ethernet controller
PowerManagment.SetPeripheralState(Peripheral.Ethernet, false);
//Turn off the uSD Card
PowerManagment.SetPeripheralState(Peripheral.SDCard, false);
//Turn off the Power LED
PowerManagment.SetPeripheralState(Peripheral.PowerLED, false);

//Turn On uSD Card
PowerManagment.SetPeripheralState(Peripheral.SDCard, true);


I don't have the public source code repositories up for Variable Labs just yet, so I've attached the source below.

Attached File  PowerManagment.cs   3.13KB   202 downloads
  • Gutworks , Paul Newton , Bejay and 5 others like this

When you talk EE use small words, I'm just a Software Developer :)
My Blog/Site and Everything Else

If my post helped you please consider pressing the "Like This" button in the bottom right-hand corner.

 

Oh my. So many things, so little money!!

 


#2 Lunddahl

Lunddahl

    Advanced Member

  • Members
  • PipPipPip
  • 152 posts
  • LocationEurope, Denmark

Posted 28 November 2012 - 01:27 AM

Nice Arron, i did not know ethernet used so much power. - Ulrik

#3 Arron Chapman

Arron Chapman

    Advanced Member

  • Members
  • PipPipPip
  • 289 posts
  • LocationOregon, USA

Posted 05 December 2012 - 11:05 PM

I've added support to toggle the power to the 5V and 3.3V power headers. This is useful if you need to power off a shield :)

When you talk EE use small words, I'm just a Software Developer :)
My Blog/Site and Everything Else

If my post helped you please consider pressing the "Like This" button in the bottom right-hand corner.

 

Oh my. So many things, so little money!!

 


#4 Arron Chapman

Arron Chapman

    Advanced Member

  • Members
  • PipPipPip
  • 289 posts
  • LocationOregon, USA

Posted 08 December 2012 - 02:49 AM

Quick note; I was looking through the schematic for the N+2 today and noticed that they way the power LED is turned off, there is no power savings when you turn it off, the power is just sinking to GND instead of lighting the LED. However the code can still be used to power it off if you don't want the light on :) For the curious this is the relevant part of the schematic. Attached File  powerLED.PNG   20.26KB   73 downloads

When you talk EE use small words, I'm just a Software Developer :)
My Blog/Site and Everything Else

If my post helped you please consider pressing the "Like This" button in the bottom right-hand corner.

 

Oh my. So many things, so little money!!

 


#5 Lunddahl

Lunddahl

    Advanced Member

  • Members
  • PipPipPip
  • 152 posts
  • LocationEurope, Denmark

Posted 08 December 2012 - 08:31 AM

I've added support to toggle the power to the 5V and 3.3V power headers. This is useful if you need to power off a shield :)


No you did not...:-)

- Ulrik Lunddahl

#6 Arron Chapman

Arron Chapman

    Advanced Member

  • Members
  • PipPipPip
  • 289 posts
  • LocationOregon, USA

Posted 08 December 2012 - 04:21 PM

No you did not...:-)


Yes I did.... :D

When you talk EE use small words, I'm just a Software Developer :)
My Blog/Site and Everything Else

If my post helped you please consider pressing the "Like This" button in the bottom right-hand corner.

 

Oh my. So many things, so little money!!

 


#7 Lunddahl

Lunddahl

    Advanced Member

  • Members
  • PipPipPip
  • 152 posts
  • LocationEurope, Denmark

Posted 08 December 2012 - 09:12 PM

Yes I did.... :D


Damn, how did you update the file on my PC, i'm sure PowerHeaders was not there yesterday...

:rolleyes:

- Ulrik Lunddahl

#8 JerseyTechGuy

JerseyTechGuy

    Advanced Member

  • Members
  • PipPipPip
  • 870 posts

Posted 11 December 2012 - 12:12 AM

This works extremely well. Thanks for the contribution Arron. I just upgraded my Pandora's Box device to use the Netduino Plus 2 and the first thing I noticed was the LCD's RGB Backlight was flickering and when I put it into scanning mode (basically activating all the sensors) the flickering got worse. Having the ability to turn the Ethernet Port and SD Card on when needed and off while scanning made a huge difference.

#9 Arron Chapman

Arron Chapman

    Advanced Member

  • Members
  • PipPipPip
  • 289 posts
  • LocationOregon, USA

Posted 11 December 2012 - 04:38 PM

This works extremely well. Thanks for the contribution Arron. I just upgraded my Pandora's Box device to use the Netduino Plus 2 and the first thing I noticed was the LCD's RGB Backlight was flickering and when I put it into scanning mode (basically activating all the sensors) the flickering got worse. Having the ability to turn the Ethernet Port and SD Card on when needed and off while scanning made a huge difference.


More importantly I think we need to thank SecretLabs for adding those mosfets :) Not having more control over what was going on, on the board was one of my biggest complaints about the Gen 1 devices. That and not having enough I/Os.
  • JerseyTechGuy likes this

When you talk EE use small words, I'm just a Software Developer :)
My Blog/Site and Everything Else

If my post helped you please consider pressing the "Like This" button in the bottom right-hand corner.

 

Oh my. So many things, so little money!!

 


#10 iced98lx

iced98lx

    Advanced Member

  • Members
  • PipPipPip
  • 134 posts
  • LocationSouth Dakota

Posted 03 January 2013 - 07:42 PM

Arron - Thank you very much, I'll be utilizing your great work to use the POWER LED as a crude status LED along with the already built in status LED. Having control over both of them is very nice. I didn't end up using your full class but I never would have figured out how to grab control of the power LED without it.

 

Thank you!



#11 JerseyTechGuy

JerseyTechGuy

    Advanced Member

  • Members
  • PipPipPip
  • 870 posts

Posted 04 January 2013 - 09:16 PM

Usage;
//Turn off the Ethernet controllerPowerManagment.SetPeripheralState(Peripheral.Ethernet, false);//Turn off the uSD CardPowerManagment.SetPeripheralState(Peripheral.SDCard, false);//Turn off the Power LEDPowerManagment.SetPeripheralState(Peripheral.PowerLED, false);//Turn On uSD CardPowerManagment.SetPeripheralState(Peripheral.SDCard, true);
 

 
One change I made to the usage...  If I am not mistaken you must set the PowerLED = [color=#0000ff;]true[/color] in order to turn it off.  For readability I use two constants ON / OFF representing true and false in my code... so I made a change to accomodate this.  Now it works as TRUE is on and FALSE is off.  I remove the ! (NOT) from !state.
 
                case Peripheral.PowerLED:                    if (peripheralPorts[1] == null)                        peripheralPorts[1] = new OutputPort((Cpu.Pin)Peripheral.PowerLED, state);                    else                        peripheralPorts[1].Write(state);                    break;


#12 tr0lle

tr0lle

    New Member

  • Members
  • Pip
  • 5 posts

Posted 05 January 2013 - 11:02 AM

Ok, I don't know what I'm doing wrong, but I really can't get this to work.

 

I have simply just made a new clean project with the following code:

 

namespace PowerManagementTest{    public class Program    {        public static void Main()        {            PowerManagment.SetPeripheralState(Peripheral.PowerLED, false);        }    }}

 

And I've just added the PowerManagment.cs file to my project.

 

I have tried with both true and false, and none of this is turning the PWR LED off.

 

Please help. I'm lost.



#13 tr0lle

tr0lle

    New Member

  • Members
  • Pip
  • 5 posts

Posted 05 January 2013 - 11:04 AM

Ok, I don't know what I'm doing wrong, but I really can't get this to work.

 

I have simply just made a new clean project with the following code:

 

namespace PowerManagementTest{    public class Program    {        public static void Main()        {            PowerManagment.SetPeripheralState(Peripheral.PowerLED, false);        }    }}

 

And I've just added the PowerManagment.cs file to my project.

 

I have tried with both true and false, and none of this is turning the PWR LED off.

 

Please help. I'm lost.

 

Btw, I'm using a Netduino Plus.



#14 JerseyTechGuy

JerseyTechGuy

    Advanced Member

  • Members
  • PipPipPip
  • 870 posts

Posted 05 January 2013 - 12:24 PM

Btw, I'm using a Netduino Plus.
This is a new feature only on the Netduino Plus 2. This works because there is extra circuitry added to turn off the peripherals.
  • Arron Chapman likes this

#15 Arron Chapman

Arron Chapman

    Advanced Member

  • Members
  • PipPipPip
  • 289 posts
  • LocationOregon, USA

Posted 05 January 2013 - 06:46 PM

This is a new feature only on the Netduino Plus 2. This works because there is extra circuitry added to turn off the peripherals.

Just piping up to say; "Yup".  This code will not work on the Netduino nor Netduino Plus, only the Netduino Plus 2.


When you talk EE use small words, I'm just a Software Developer :)
My Blog/Site and Everything Else

If my post helped you please consider pressing the "Like This" button in the bottom right-hand corner.

 

Oh my. So many things, so little money!!

 


#16 NooM

NooM

    Advanced Member

  • Members
  • PipPipPip
  • 490 posts
  • LocationAustria

Posted 05 January 2013 - 07:20 PM

and on the mini? :rolleyes:



#17 Arron Chapman

Arron Chapman

    Advanced Member

  • Members
  • PipPipPip
  • 289 posts
  • LocationOregon, USA

Posted 05 January 2013 - 09:57 PM

and on the mini? :rolleyes:

 

As you know this is rather irrelivant on the Mini ;)


When you talk EE use small words, I'm just a Software Developer :)
My Blog/Site and Everything Else

If my post helped you please consider pressing the "Like This" button in the bottom right-hand corner.

 

Oh my. So many things, so little money!!

 


#18 JerseyTechGuy

JerseyTechGuy

    Advanced Member

  • Members
  • PipPipPip
  • 870 posts

Posted 22 January 2013 - 08:05 PM

Odd problem I'm encountering.  Wonder if anyone experienced it yet or has any thoughts. It's network related when power cycling the ethernet.

 

When my Netduino App Starts I am turning off both Ethernet and the Power Led to conserve power due to the numerous sensors and the LCD display using the following code:

 

// POWER MANAGEMENT// Turn off the Ethernet controllerPowerManagment.SetPeripheralState(Peripheral.Ethernet, OFF);// Turn off the Netduino Power LED.  Not seen anyway.PowerManagment.SetPeripheralState(Peripheral.PowerLED, OFF);

From the menu on my Netduino App I put the Netduino into Host mode which in my case an an HTTP server that allows my windows app to exchange data and download log files.  I am turning the Ethernet Back on before setting the network settings from a cfg file then starting the web server.

 

// Turn on the Ethernet controllerPowerManagment.SetPeripheralState(Peripheral.Ethernet, ON);Thread.Sleep(1000);// Code to start webserver//...

After starting the web server I can see the network settings are correct however I cannot PING or communicate with the ND+2.  If I comment out the first line that turns off the Ethernet (never having powered it down) it runs 100% and I can PING and reach the box.

 

Is there something that needs to be done to initialize or reset the ethernet after powering it back up?



#19 ajcg1973

ajcg1973

    Advanced Member

  • Members
  • PipPipPip
  • 71 posts

Posted 08 February 2013 - 11:53 PM

Quick note;
I was looking through the schematic for the N+2 today and noticed that they way the power LED is turned off, there is no power savings when you turn it off, the power is just sinking to GND instead of lighting the LED. However the code can still be used to power it off if you don't want the light on Posted Image

For the curious this is the relevant part of the schematic.

Posted ImagepowerLED.PNG

 

Don't you get the current savings of not lighting up the LED?  That should save some MAs.



#20 Arron Chapman

Arron Chapman

    Advanced Member

  • Members
  • PipPipPip
  • 289 posts
  • LocationOregon, USA

Posted 17 February 2013 - 07:49 PM

Don't you get the current savings of not lighting up the LED?  That should save some MAs.

No, instead of the 3.33... mA being used to power the LED, it is simply sunk to GND.


When you talk EE use small words, I'm just a Software Developer :)
My Blog/Site and Everything Else

If my post helped you please consider pressing the "Like This" button in the bottom right-hand corner.

 

Oh my. So many things, so little money!!

 





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.