Latch Circuit - Wake up + 0 Power Consumption (useful circuit)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
i want to power on my microcontroller for a short time do a process and then to go back to sleep where it consumes 0 amps of current i've done something like that with the ultra low power mode a few months ago on a different project but even so in that mode it was still consuming around 90 microamps so if i were to use a battery after a year or so the battery would get empty i want to completely power off the system after the process is done and power up again when the new input is detected as for example i detect that somebody open the door with a vibration sensor for that we need to use a latch circuit and that's what i want to show you today a circuit that enables power with a push of a button and then could be turned off by the microcontroller itself i will show step by step how this circuit works and how to implement it and of course see the results in power consumption so guys let's get started [Music] video sponsored by pcbway if you have a pcb project you must check their services for example try the pcb prototype service for boards from one layer up to 14 layers the pcb quality is amazing nice finish good silk layer and exact sizes and the production time is measured in hours so all you have to do is to upload the gerber files of your pcb select the settings such as the color of the board the size the thickness and so on and order the pcbs for only five dollars for 10 pcbs of 10 by 10 centimeters in just a few days you receive the pcbs so you could finish your amazing project in time and with the professional look pcb what's up my friends welcome back here i have my microcontroller that i would use for a future iot project and in this case is an esp32 this here is a vibration sensor that i could place on my door so when i open the door the detector will apply a post to the microcontroller and that will use the wi-fi connection to send the information that the door was open to the internet i want to be able to use this with a battery and for a very long time because in that way you could use such a system outside without a power supply to simulate the wi-fi process for this example i make the microcontroller blink an led three times each time that someone opens the door as you can see for this example with this vibration sensor i turn on the circuit it will do a process for example blink on led and then it will go back to totally off so the entire circuit is turned off and the current flow is just 0 microamps like this with a very small battery it could last for years right so how does the latch circuit works and what components it uses well we use a mosfet to enable the current flow between the battery and our microcontroller this mosfet needs to have a pull up resistor at the gate so it won't jump around between the on and off state if i connect the switch from the door detector to the gate of this mosfet this will be turned on each time that the door is open but what if the door closes in under a second and the microcontroller doesn't have enough time to send the data to the internet well we need to make the mosfet gate to latch into the on position so let's add another bjt transistor between the gate and ground in this case we use a p mosfet so we activate it with a low signal this bjt transistor has the base connected at the output of the mosfet so now when i close the switch from the door the mosfet will activate so the output is high but at the same time that output will now turn on the bjd transistor so now even if the detector from the door turns back to open the mosfet will stay turned on but now we have a different problem how to turn off this mosfet well all we have to do is to connect the base of the bgt transistor to ground and once again that will turn off and at the same time we'll disable the mosfet so first let me show you a basic latch with a push button and then i will show the adapted one that works with the microcontroller so how about we take that button from the gate of the mosfet and place this button at the base of the bjt now if this button makes the connection to high it will turn on the circuit and if it makes the connection to low it will turn off the circuit so we add a pull up resistor to high connect it to the push button now we have the connection to high but how can we get the connection to low well for that we add a second bjt transistor with the base connected to the base of the first bjt transistor the collector to the push button and the emitter to ground in this way when i first push the button high value is connected to the first bjt transistor and that will turn on the circuit and it will stay that way but at the same time since both bases are connected together the second bjt will also turn on and connect the push button to ground and that will automatically turn off the bjt transistors and then they will turn back on and repeat this process over and over again so we don't want that we need to add some sort of delay to the turn on and off process so we have more time to remove the finger from the button for that we add a small capacitor at the collector of the second bjt transistor and in this way the voltage at the push button will stay high for a longer period of time enough for us to remove the finger from the button and open the circuit so when we press the button and turn on the circuit the first bjt transistor will enable the mosfet and the second bgt transistor will open the current pad to ground this capacitor will start discharging and now the push button will be connected to low value so when we press the button a second time now it will do the opposite it will turn off the bjt transistors and the entire circuit at the same time so there we have our latch circuit we press once we turn on the circuit we press a second time and we turn it off and we can do this how many times that we want but hey in my case i want to control the off process with my microcontroller without having to press the push button a second time so for that i propose something like this we start with the same first stage as before the high poles from the door detector will turn on the first bjt transistor so now we can supply the microcontroller now i add a second bjt transistor that has the emitter to ground and the collector to the base of the first bjt from the microcontroller i connect a digital pin to the base of the second bjt that already has a pull down so now when i apply high poles from the microcontroller to the second bjd it will pull down the base of the first one and by that it will turn off the entire circuit so guys that's how we make our simple latch circuit that will able me to create a project that could last for years with a small battery i make this simple circuit on my breadboard the push button would simulate the door open sensor on the other side i connect the arduino for example and the digital pin is connected to the second bjd transistor i push the button and the entire circuit is turned on the arduino will make three blinks and that's just to simulate the time it will take to send the data to the internet and then it will turn the digital pin to high turning off the circuit and as you can see the current value is going to zero you can power this directly from a 3.7 volts battery without problems i've made the same circuit here on this small prototyping pcb and i've made some tests with the vibration sensor and it works quite good in a future project i want to design my own pcb with small smd components that already has the circuit implemented together with a small esp32 microcontroller and make a push notification iot project using a post method so we can see when the door is open from anywhere in the world or maybe just track the humidity of your garden the temperature and so on i hope that will be interesting so guys i hope that you like this video and if so give me like or comment below that will help me a lot thanks again and see you later guys hey guys thanks for staying with me till the end of this video i hope that you like it and the most important part for me i hope that you learned something new also i would really like to thank to all those who are supporting this channel on patreon that help is very important for me and at the same time you have more links below if you want to check my facebook page my instagram or my shop where you could buy my pcbs or maybe some t-shirts and more stuff and with that also support my channel so thanks again and i'll see you in the next video
Info
Channel: Electronoobs
Views: 55,860
Rating: 4.9563684 out of 5
Keywords: latch, circuit, wake up, push notification, IOT, Arduino, ESP8266, ESP32, internet, power consumption, battery, remote, turn on latch, schematic, tutorial, detector, sensor, e-mail
Id: Er8fSoeaZD0
Channel Id: undefined
Length: 9min 16sec (556 seconds)
Published: Sun Apr 25 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.