You are reading a single comment by @Moray and its replies. Click here to read the full conversation.
  • Just a follow-up question on deep sleep - if 3.3v pin and GPIO pins stay on during deep sleep, presumably I am better powering sensors from a controllable GPIO pin so as to minimise draw during deep sleep, something like the code below.

    For larger stuff that needs more current than a controllable pin can supply, presumably I need a transistor connected to 3.3V, the controllable pin and common ground in order to switch them off during deep sleep?

    // button will be wired from 3.3V pin to A8.
    // other sensors will be wired with +ve to power pin B1 and their own ADC pin to read
    var powerPin = B1, btnPin = A8;
    var watch;
    
    function doStuffAndSleep () {
      setDeepSleep(0);
      //power up sensors 
      digitalWrite(powerPin,1);
      //check sensors...
      //...check completed
     //shutdown power and go to sleep
      digitalWrite(powerPin,0);
      setupWatch();
      setDeepSleep(1);
    }
    function setupWatch () {
      setWatch(doStuffFromSleep, btnPin, { repeat:false });
    }
    
    doStuff();
    
    
    
About

Avatar for Moray @Moray started