0

Feather M0 WiFi ATWINC1500 - Turn off the Wifi module comple
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Feather M0 WiFi ATWINC1500 - Turn off the Wifi module comple

by IoTAll on Thu Jul 18, 2019 6:59 pm

Hi!
I am trying to make a low power project with the Feather M0 WiFi with ATWINC1500.

I read in the tutorial that the
#2 - used as the ENable pin for the WiFi module, by default pulled down low, set HIGH to enable WiFi


To be sure to understand, this pin is pulled low as default, meaning that when the feather turns on, the ATWINC1500 wifi chip is completely off, not consuming any energy.

When I connect it to a WiFi network, the pin is set to HIGH automatically to power the WiFi module.
So If I pulled down low this pin 2 again, the WiFi module will be again completely off and not consume any energy again.

Am I right?

Thank you!

IoTAll
 
Posts: 133
Joined: Wed May 31, 2017 6:34 pm

Re: Feather M0 WiFi ATWINC1500 - Turn off the Wifi module co

by jdelcamp11 on Sun Jul 21, 2019 11:23 am

yes that would stop the wic1500.
Are you sleeping the feather and using the other lowpower functions?

jdelcamp11
 
Posts: 155
Joined: Mon Nov 17, 2014 12:30 am

Re: Feather M0 WiFi ATWINC1500 - Turn off the Wifi module co

by IoTAll on Sun Jul 21, 2019 11:40 am

Hi!
Thanks for the answer!
I will put the pin 2 to ground then to make the ATWINC1500 to be off.
I need to test but I wonder if I can re-initiate this module without resetting completely the feather.

I am using this library to put the M0 to sleep but not sure this is not very efficient.
https://github.com/arduino-libraries/RT ... CAlarm.ino

Do you know a better solution for that?
I need to make the project sleep for 2hours.

Is there any other things I can put to sleep on this feather?

Thanks!!

IoTAll
 
Posts: 133
Joined: Wed May 31, 2017 6:34 pm

Re: Feather M0 WiFi ATWINC1500 - Turn off the Wifi module co

by jdelcamp11 on Sun Jul 21, 2019 1:04 pm

I am making a solar powered weather station that uploads data to my web page 1/min etc.
I finally a a good sleep setup that stays up (1 week + and no hiccups)
Here is my code related to sleep.
Code: Select all | TOGGLE FULL SIZE
#include <Adafruit_SleepyDog.h>
#include <SPI.h>
#include <WiFi101.h>
#include <WiFiUdp.h>
#include <WiFi101OTA.h>

#define pwrMOSFET 13    // power conrol pin - kill power to periperals
// in setup
pinMode(pwrMOSFET, OUTPUT);
 digitalWrite(pwrMOSFET, HIGH); // turn on peripherals

  WiFi.setPins(wifi_CS,wifi_IRQ,wifi_Reset,wifi_EN);     // use if not default
  startWIFI();
  BotServer.begin();
  WiFi.lowPowerMode();    // NOTE: This causes wifi failures in a short time
  WiFiOTA.begin("arduino", "arduino", InternalStorage);  // for WiFi sketch upload

void loop {
// do my stuff here

  if (slpFlag)
     { sleepnow();
       wake(); }
} // end of loop

//======================================================
//  Subroutines
//======================================================
//*******************************************
void alarmMatch()   // Do something when timer interrupt called
  {   
    rtc.disableAlarm();
    digitalWrite(LED_BUILTIN, HIGH);  // turn the LED on
    //will restart loop from sleepnow
  }

void wake()
 {
   SysTick->CTRL |= SysTick_CTRL_TICKINT_Msk;
   int countdownMS = Watchdog.enable(16000); // restart watchdog timer
   //digitalWrite(wakePin, HIGH);    // wake wifi
   digitalWrite(pwrMOSFET, HIGH);  // turn on power for peripherals
   pwrFlag = 1;
   StartSensors(); 
     //*  Re-attach the USB, will give audible sound on windows machines
   if (serFlag)
      {
        USBDevice.attach();
        Serial.begin(38400);
        delay(2000); // give time for Serial to startup
      } //*/
   StartSensors();
 }
 
void sleepnow()
  {
    Watchdog.disable();
    if (serFlag)
       { Serial.println(F("\r\nGoing to sleep - close comm window"));
         Serial.println(F("Reopen comm window when LED comes on"));
       }
    pwrFlag = 0;
    //digitalWrite(wakePin, LOW);
    digitalWrite(pwrMOSFET, LOW);
    rtc.setAlarmSeconds(30);       // Wakes on the 30th second of the minute NOT every 30 secs!
    rtc.enableAlarm(rtc.MATCH_SS); // Match seconds only
    rtc.attachInterrupt(alarmMatch);
    //USBDevice.standby();  // this doesn't work in this sleep mode
    USBDevice.detach();     // Safely detach the USB prior to sleeping
    delay(20);              // give time for everything to finish
    SysTick->CTRL &= ~SysTick_CTRL_TICKINT_Msk;
    rtc.standbyMode();      // Sleep until next alarm match
  }

//**   START Sensors   ****************
void StartSensors()
 {
  //readWind();    // will reset wind speed counts and time
  ina219.begin();
  bme.begin();
  tsl.begin();
    configureSensor();
  DS18B20.begin();   //For DS18B20 temperature
 }
//*****************  WiFi routines  *****************
void startWIFI()
 {
  Serial.println(F("Starting WIFI"));
    // check for the presence of the shield:
  if (WiFi.status() == WL_NO_SHIELD)  // don't continue:
     { Serial.println("WiFi shield not present");
       while (true){;}
     }
    // attempt to connect to WiFi network:
  while (status != WL_CONNECTED)
     {
      //Serial.print("Attempting to connect to SSID: ");
      //Serial.println(ssid);
        // Connect to WPA/WPA2 network.
      status = WiFi.begin(ssid, pass);
      delay(5000); // wait 5 seconds for connection, then try again
        // note: watchdog will timeout after 16 seconds and reboot Bot
     }
  //printWiFiStatus(); // you're connected now, so print out the status:
 }

 
 


Hope this helps

jdelcamp11
 
Posts: 155
Joined: Mon Nov 17, 2014 12:30 am

Re: Feather M0 WiFi ATWINC1500 - Turn off the Wifi module co

by IoTAll on Mon Aug 19, 2019 1:52 pm

I reused your code and it works great, thanks a lot for the help!

IoTAll
 
Posts: 133
Joined: Wed May 31, 2017 6:34 pm

Please be positive and constructive with your questions and comments.