Pages: [1]   Go Down
Author Topic: WiFi.disconnect() not behaving as expected  (Read 326 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am  in the process of writing some code that is trying to be as power efficient as possible.  I am pleased with what I have written for the Arduino itself, as well as the sensors, but I am struggling with finding ways to reduce the power consumption of the WiFi shield itself.

I did noticed that even with the WiFi shield connected it doesn't seem to be powered (at least none of the LEDs are lit) until the WiFi.begin() method is run, which gave me an idea. 

For a good portion of the day, the Arduino will sit in a powered down state.  As I am putting the Arduino to sleep, I thought if I called the WiFi.disconnect() method it would put it back in the pre WiFi.begin() state.  That way the WiFi shield isn't sitting there maintaining a connection to the AP while the Arduino is sleeping (and therefore hopefully using less battery).  And when I run the command, it seems to disconnect just fine.  However after a few seconds (and while the Arduino is sleeping) it seems to re-connect to the AP all on it own.

Does anyone have any idea how to power down the WiFi shield while I am wanting to be in low power mode?  I have already had the suggestion to power the shield from an external source.  However, at this time I am not wanting to remove the shield from the Arduino itself (the compact connection is one of the reasons we bought the shield).  I am first looking for options that will work while the shield is mounted.

Thank you all for your time.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Did you find a solution to this problem?

In the project I'm working on I want my UNO to only activate the wifi shield once a sensor has registered a change. When the wifi is active I want to POST a message to a server and then disconnect. The code I have for disconnecting from the wifi shield is :

   
Code:
client.stop();
WiFi.disconnect();
       
if (client.connected())
{
 Serial.println("Client is still connected");
}
else
{
 Serial.println("Client is not connected");
}

When this is executed it reports that the client is not connected but the LINK LED on the wifi shield remains on, which tells me that the wifi shield has not been disconnected!

I'm amazed that more people aren't complaining about this issue, as surely there are loads of us who want our projects to be as energy efficient as possible.
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 73
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi guys, I'm experiencing exactly the same problems you have reported, it is really frustrating.

Have you found a solution? If yes could you please share it?

Many thanks in advance
Logged

Pages: [1]   Go Up
Jump to: