WIFI SHIELD power off

Is it possible to power off the wifi shield (seeedstudio wifi shield) via software ? Thanks in advance

Link to the hardware? There are multiple versions of that shield.

the wifi shield:

http://www.seeedstudio.com/depot/Wifi-Shield-p-1220.html?cPath=19_20

That's version 1.1 of the module. You cannot power the module completely off, but you can set it to sleep and wake it using any Arduino pin by connecting Sensor0 of the module to that pin (can be your TX pin if you want the module to wake when you send some commands).

Thank for the reply, but could you better explain your answer, please ? You wrote: 1- "you can set it to sleep and wake it - How ? 2- " using any Arduino pin by connecting" - also digital pins ? 3- " Sensor0 of the module" - which pin is sensor0 of the module?

Thanks, K

1- "you can set it to sleep and wake it - How ?

set sys sleep (Manual page 18)

2- " using any Arduino pin by connecting" - also digital pins ?

Any Arduino pin means on the UNO D0-D13 and A0-A5, just use them as digital outputs.

3- " Sensor0 of the module" - which pin is sensor0 of the module?

It’s labeled “S_0” on the board. Don’t forget to set the “set sys trigger” value before you put the module to sleep else might get problematic to wake it again.

Is this a library for sleeping the wifi module ?

You didn't tell us yet that you're using a library so I thought you're talking directly to the shield. These are commands understood directly by the shield hardware. As I don't know what library you're using, i don't know if it supports the sleep command. Did you read the shield's documentation?

Sorry about it !!! I'm using the WiFly library (# WiFi Library Using WiFly 171 for Arduino This library is for WiFi Shield from Seeed Studio.

and in the WiFly.cpp file there are the following commands:

boolean WiFly::sleep(){ sendCommand("set sys trig 1\r","AOK"); return sendCommand("sleep\r", "AOK"); }

boolean WiFly::wakeup(){ reboot(); return true;

}

Which WiFly library? There are several with that name. Provide a link to the download area where you downloaded your copy of the library from.

In the library you linked to I cannot find the posted code parts. Do you use another version of the library?

The code you posted looks quite OK for the sleep case, but wakeup will probably not work like that (depends on the shield initialization routines, though).

Please find in attach the library.

maybe I have to connect some pins … S_0 or force awake to a digital OUTPUT ???

WiFly.rar (14.3 KB)

maybe I have to connect some pins ... S_0 or force awake to a digital OUTPUT

That what I told you some posts ago: http://forum.arduino.cc/index.php?topic=228723.msg1653233#msg1653233.

The library activates S_0 as the trigger for a wakeup, so yes, you either have to connect that to a digital output or to the Arduino's TX line.

Soory for my insistence.... summarize:

1) I'm using the library I sent you. 2) I connected in the wifi shield PIN10 to S_O 3) in the sketch:

setup: {

pinMode(PIN10,OUTPUT); digitalWrite(PIN10,LOW); wifly.sleep() }

loop: { . . wifly.wakeup() ... ... void senddata() ... wifly.sleep()

}

4) what's the problem for you ? I miss something !!!

Thank you very much !! K.

maybe I have to set digitalWrite(PIN10,HIGH); before wifly.wakeup() ???

maybe I have to set digitalWrite(PIN10,HIGH); before wifly.wakeup() ???

No, you will damage the module.

You must not put 5V on the S_0 pin of the module.

It's best to leave it floating in normal and sleep state:

pinMode(PIN10, INPUT);

If you want to wake up the module, pull the pin to ground:

digitalWrite(PIN10, LOW);
pinMode(PIN10, OUTPUT);

The wakup method of the library doesn't really wake the module but it resets the module once it's awake again. Please note that from the wakeup signal until you have a working network connection it may need some time so sending the module to sleep for one second probably needs more power than just keeping the WiFi up.

I'm very sorry...but I have not understood yet ! Please could you recap the connection and the code... Sorry ...very sorry ... :~ K

Please could you recap the connection and the code…

The code is in my previous post, the connection is simply from your chosen pin (seems to be 10) to S_0 on the module.

To explain: setting pin 10 as an input results in the pin getting passive. In this state the Wifi module can go to sleep. As soon as you pull the pin to ground (that’s what my second code part is doing), you’ll wake up the module (if you sent it to sleep before). You don’t have to stay in this state for long, after a few ms you can set the pin to input mode again. If you want to be absolutely sure that your module doesn’t get damaged, you can install a voltage divider as suggested in section 10 of the chip manual.

Thank you very much pylon !!!

The code is in my previous post, the connection is simply from your chosen pin (seems to be 10) to S_0 on the module.

OK

To explain: setting pin 10 as an input results in the pin getting passive. In this state the Wifi module can go to sleep.

for going to sleep, I have to write wifly.sleep() after pinMode(PIN10, INPUT)

As soon as you pull the pin to ground (that's what my second code part is doing), you'll wake up the module (if you sent it to sleep before). You don't have to stay in this state for long, after a few ms you can set the pin to input mode again

only adding the following instructions without wifly.wakeup() instruction.....: digitalWrite(PIN10, LOW); pinMode(PIN10, OUTPUT); delay(100) pinMode(PIN10, INPUT)

. If you want to be absolutely sure that your module doesn't get damaged, you can install a voltage divider as suggested in section 10 of the chip manual.

OK