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
- Pin -1 V+ - to power rail (5v or normal Li-Ion battery 4.2v)
- Pin -2 GND - common GND
- Pin -3 DELAY - 20Kohm to Ground (~20 sec of up time)
- 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+.
- Pin -5 DRV - Gate to my MOSFET (FQP30N06 N-Channel enhancement)
- Pin -6 DONE - Done pin to MicroController D2/2 (depends on esp8266 type)
On MOSFET side
- GATE is connected to Pin 5 above, so every time i push the button TPL asserts DRV pin high which should enable the mosfet
- MC USB pin connected to V+
- MC Ground is connected Drain of Mosfet
- Source of Mosfet is connected to Common GND
- GATE and DRAIN are connected using 5K ohm resistor
Following are my doubts
- 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?
- 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
- 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();
}
}
simulate this circuit – Schematic created using CircuitLab
SW1
closes, it puts a direct short-circuit across the power supply. This is not sensible, so please check & fix the schematic (this is assuming that your real hardware is connected differently, without a direct short across the supply throughSW1
, and so the error is in the schematic only). \$\endgroup\$