Skip to main content
edited body
Source Link

schematic

simulate this circuit – Schematic created using CircuitLab

schematic

simulate this circuit – Schematic created using CircuitLab

added 268 characters in body
Source Link

schematic

simulate this circuit – Schematic created using CircuitLab

schematic

simulate this circuit – Schematic created using CircuitLab

Source Link

Powering micro controller using n-channel mosfet and tpl5111

I am trying to create home made battery saver circuit to powering on my microcontroller (nodemcu v2),

I am following http://www.ti.com/product/TPL5111/datasheet/detailed_description, and created the connection on breadboard,

TPL is connected as follows

  1. Pin -1 V+ - to power rail (5v or normal Li-Ion battery 4.2v)
  2. Pin -2 GND - common GND
  3. Pin -3 DELAY - 20Kohm to Ground (~20 sec of up time)
  4. Pin -4 EN - GND (Since i want this to be one shot and not as timer)via push button and other leg of push button to V+.
  5. Pin -5 DRV - Gate to my MOSFET (FQP30N06 N-Channel enhancement)
  6. Pin -6 DONE - Done pin to MicroController D2/2 (depends on esp8266 type)

On MOSFET side

  1. GATE is connected to Pin 5 above, so every time i push the button TPL asserts DRV pin high which should enable the mosfet
  2. MC USB pin connected to V+
  3. MC Ground is connected Drain of Mosfet
  4. Source of Mosfet is connected to Common GND
  5. GATE and DRAIN are connected using 5K ohm resistor

Following are my doubts

  1. Even when TPL DRV is low my external LED to MC on pin 13 is lit and voltage is < 0.5 volts, should microcontroller be OFF completely?
  2. My intention is to attach Reed Switch instead of push button to TPL so every time i open the door it should turn on mosfet via tpl and microcontroller should do the job and send the DONE to turn off
  3. Sending DONE via microcontroller doesnt turn off the TPL, but thats not something bothering me at this stage but still would like to know

I will upload my circuit from breadboard but i need to put labels on it.

Below is simple code which turn on LED on Pin 13/D7

    #include "AdafruitIO_WiFi.h"
    #define HUZZAH
    #ifdef HUZZAH
      #define DONEPIN   2 // TPL5100 Done signal
      #define LEDPIN    13
    #else
      #define DONEPIN   D2 // TPL5100 Done signal
      #define LEDPIN    D7
    #endif
    #define DEBUG true
    #define BAUD_RATE    115200

    const char* ssid = "wifi";
    const char* password = "password";
    #define AIO_KEY  "mykey"

    AdafruitIO_WiFi io("userId", AIO_KEY, ssid, password);

    void logMessage(String message, boolean noCRLF=false){
      #ifdef DEBUG
      if (Serial){
        if (noCRLF){
          Serial.print(message);
        }else{
          Serial.println(message);
        }
      }
      #endif
    }

    void connectAdaIo(){
      bool sendData = false;
      logMessage("Connecting to Adafruit.io");
      // connect to io.adafruit.com
      io.connect();
      int retry = 0;
      // wait for a connection
      while(io.status() < AIO_CONNECTED || retry < 10) {
        logMessage(".");
        retry++;
        delay(500);
      }
      if (io.status() < AIO_CONNECTED){
        sendData = false;
      }
      // we are connected
      logMessage("Adafruit connected:" + sendData ? "true" : "false");
      logMessage(io.statusText());
    }


    /*
     * send DONE signla to TPL5100 to shut the power off
     */
    void sendDone(){
      digitalWrite(DONEPIN, HIGH);
      delay(1);
      digitalWrite(DONEPIN, LOW);
      delay(1);  
    }

    void setup() {
      delay(10);
      Serial.begin(BAUD_RATE);
      Serial.println("Measuring Temp on DS18B20 \n");
      delay(10);
      pinMode(DONEPIN, OUTPUT);
      pinMode(LEDPIN, OUTPUT);
      digitalWrite(DONEPIN, LOW);
      connectAdaIo();
    }

    void loop() {
      io.run();
      digitalWrite(LEDPIN, HIGH);
      logMessage("I was here", true);
      delay(3000);
      digitalWrite(LEDPIN, LOW);
      while(true){
        sendDone();
      }
    }