Sleeping the WiSheild for low power usage

Discussion about any of the included sketches (i.e. WebServer), or user-generated applications.

Sleeping the WiSheild for low power usage

Postby mikezs » Tue Sep 21, 2010 1:33 am

The specs for the WiShield mention a 250uA mode while sleeping the shield. I can't find the documentation to enable this mode, is this possible with the currently exposed API? Is there a sketch available to show putting the sheild to sleep for (example) 10 mins, then connecting and uploading data then going back to sleep? I'm making a battery powered setup that needs to last a year uploading data every 10 mins over WiFi so I'm trying to get the power usage as low as possible.
Last edited by mikezs on Tue Sep 28, 2010 5:32 am, edited 1 time in total.
mikezs
 
Posts: 8
Joined: Thu Aug 13, 2009 3:33 am

Re: Sleeping the WiSheild for low power usage

Postby GregEigsti » Tue Sep 21, 2010 1:40 pm

The API for sleep is not exposed as such but the ZeroG module docs have some info on it (you can get these from www.microchip.com); basically you would need to write the command directly to the WiShield over the SPI bus. There is no sample sketch that shows how to do this.

You must remember that for the WiShield to stay on the network it has to participate on that network. If you put it to sleep for 10 minutes it will likely be dropped off of the network. Also, while the WiShield is asleep it will not be able to receive data.

Try searching the forums for more information about sleeping; I believe that spidermonkey04 posted some good info on it at one point. As far as I can remember nobody has made a dent in this problem.

Greg
Check out the wiki!
uIP Stack Docs
Compatible Access Point List
WiShield user contrib branch - DNS, DHCP, AP Scanning, bug fixes, etc.
SlackLab.org - My geek projects blog.
User avatar
GregEigsti
 
Posts: 1067
Joined: Sun Aug 02, 2009 5:23 pm
Location: Sammamish WA USA (near Seattle)
  • Website

Re: Sleeping the WiSheild for low power usage

Postby mikezs » Tue Sep 28, 2010 5:32 am

Here is some background on my project, which I hope you can confirm is possible.

It's a simple energy monitor that monitors the blinking LED we have in UK houses (flashes once every 800 watts is used).

My hardware will:
[*] Have an LDR connected on interrupt 0 (pin 3) that will detect rising edges to monitor electricity usage. The ISR will be 4-5 clock cycles so should not disrupt timing noticeably.
[*] Connect to the internet periodically (every 10 mins, checked in the LDR ISR) to upload the amount of energy that has been used to a server, which is then graphed on google.

This will all be powered from a 9v battery in my closet so the arduino AND wisheild need to be on super-duper power-saving mode while not logging usage or uploading data to the server.

After investigating this, I will make some sketches to contribute back my findings :) (And post details of my project obviously!)

I also have another question: How much time (power) is saved by having no security when joining a network, as opposed to WEP? I know having WPA will mean having the wisheild powered up for more than 30 secs every 10 mins, so is not viable with my little power (would only last a week or so, where I would like 3-6 months on 1 battery)
mikezs
 
Posts: 8
Joined: Thu Aug 13, 2009 3:33 am

Re: Sleeping the WiSheild for low power usage

Postby mikezs » Tue Sep 28, 2010 8:35 am

OK, I've found the hack posted by spidermonkey04/uli and it brings power usage down to 50mAh which is still way too high for battery powered applications.

After doing more reading, we can connect pin 20 to... something (I'm a software engineer, so electronics isn't my strong point) and use this to get into hibernate mode. This will allow the hardware to run on 4 AA batteries for more than a year (perfect!)

Pin 20 is currently connected to ground, If I cut the trace for this pin and break it out myself can I do something with it? Can I use a digitial pin, or will I have to use some kind of transistor? I need to bring this pin high when the arduino is in sleep mode and then low to init and send data.

Hope this will pave the way for more super-low power applications :)
mikezs
 
Posts: 8
Joined: Thu Aug 13, 2009 3:33 am

Re: Sleeping the WiSheild for low power usage

Postby GregEigsti » Tue Sep 28, 2010 9:45 am

Thanks for the research and for sharing! When this is "resolved" it should definitely become a wiki entry! I too am a software eng and not an EE.

Pin 20 is currently connected to ground, If I cut the trace for this pin and break it out myself can I do something with it? Can I use a digitial pin, or will I have to use some kind of transistor? I need to bring this pin high when the arduino is in sleep mode and then low to init and send data.

My guess is no transistor/resistor would be needed - but it depends on the power requirements of the ZeroG pin connected to pin 20. And yeah, cutting the trace (and rerouting) would likely be the answer.

Good stuff! Thanks!
Greg
Check out the wiki!
uIP Stack Docs
Compatible Access Point List
WiShield user contrib branch - DNS, DHCP, AP Scanning, bug fixes, etc.
SlackLab.org - My geek projects blog.
User avatar
GregEigsti
 
Posts: 1067
Joined: Sun Aug 02, 2009 5:23 pm
Location: Sammamish WA USA (near Seattle)
  • Website

Re: Sleeping the WiSheild for low power usage

Postby spidermonkey04 » Wed Sep 29, 2010 12:01 pm

If you plan to always upload data to the same computer/server then you could hardcode that MAC address into the chip to save time on connecting. Also there are commands possible to turn off/on the radio manually, which might make it unnecessary to screw with pin 20. I'll do some experiments later, but let us know if you figure it out.

What kind of power saving are you doing on the arduino?

---Jared
spidermonkey04
 
Posts: 66
Joined: Thu Oct 29, 2009 6:45 pm

Re: Sleeping the WiSheild for low power usage

Postby mikezs » Wed Sep 29, 2010 1:17 pm

spidermonkey04 wrote:If you plan to always upload data to the same computer/server then you could hardcode that MAC address into the chip to save time on connecting. Also there are commands possible to turn off/on the radio manually, which might make it unnecessary to screw with pin 20. I'll do some experiments later, but let us know if you figure it out.

What kind of power saving are you doing on the arduino?

---Jared

The only power saving I'm currently doing on the arduino is sleep mode that (with the power regulator) brings it down to 10mAh (0.05 for the chip)

Do you know what the commands to turn the radio off are? I'm going to have to make my own proto boards for the arduino chips so I can put them into full sleep mode. They should last around 3 years on AA batteries.
mikezs
 
Posts: 8
Joined: Thu Aug 13, 2009 3:33 am

Re: Sleeping the WiSheild for low power usage

Postby spidermonkey04 » Thu Sep 30, 2010 11:10 am

Nope, I'll help look though. Like Greg mentioned, I remember seeing it in the MicroChip example code, specifically TcpIP stack ver. 5.20.

---Jared
spidermonkey04
 
Posts: 66
Joined: Thu Oct 29, 2009 6:45 pm

Re: Sleeping the WiSheild for low power usage

Postby mikezs » Thu Sep 30, 2010 4:15 pm

spidermonkey04 wrote:Nope, I'll help look though. Like Greg mentioned, I remember seeing it in the MicroChip example code, specifically TcpIP stack ver. 5.20.

---Jared


I've found the TcpIP stack application software, but as I'm not familiar with the SPI protocol, I'm not really finding how to expose the sleep API.

After re-reading the datasheet, I can see that using pin 20 would enable hibernation and would allow the chip to be in this state for almost 3000 years on AA batteries (basically forever consuming 0.1uA) but as I only want 6 months operation, sleep mode would be perfect :)

I don't need you to give me an example function or whatever, but could you point me in the right direction? ;)
mikezs
 
Posts: 8
Joined: Thu Aug 13, 2009 3:33 am

Re: Sleeping the WiSheild for low power usage

Postby mikezs » Thu Sep 30, 2010 4:27 pm

OK, after a lot of digging through code, I've found the file:
/Microchip/TCPIP Stack/ZeroG/ZG2100.c

It contains the following:
Code: Select all
/******************************************************************************
* Function:        void MACPowerDown(void)
*
* PreCondition:    SPI bus must be initialized (done in MACInit()).
*
* Input:           None
*
* Output:          None
*
* Side Effects:    None
*
* Overview:        MACPowerDown puts the ZG2100 in low power sleep mode. In
*                  sleep mode, no packets can be transmitted or received.
*                  All MAC and PHY registers should not be accessed.
*
* Note:            If a packet is being transmitted while this function is
*                  called, this function will block until it is it complete.
*                  If anything is being received, it will be completed.
*****************************************************************************/
void MACPowerDown(void)
{
}//end MACPowerDown


/******************************************************************************
* Function:        void MACPowerUp(void)
*
* PreCondition:    SPI bus must be initialized (done in MACInit()).
*
* Input:           None
*
* Output:          None
*
* Side Effects:    None
*
* Overview:        MACPowerUp returns the ZG2100 back to normal operation
*                  after a previous call to MACPowerDown().  Calling this
*                  function when already powered up will have no effect.
*
* Note:            If a link partner is present, it will take 10s of
*                  milliseconds before a new link will be established after
*                  waking up.  While not linked, packets which are
*                  transmitted will most likely be lost.  MACIsLinked() can
*                  be called to determine if a link is established.
*****************************************************************************/
void MACPowerUp(void)
{
}//end MACPowerUp


So it doesn't look like I can port any of these functions to the WiSheild library :(
mikezs
 
Posts: 8
Joined: Thu Aug 13, 2009 3:33 am

Next

Return to Sketches and Applications

Who is online

Users browsing this forum: Google [Bot] and 1 guest