5 Soft Latching Power Circuits For Arduino Or Any Microcontroller!

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 พ.ย. 2024

ความคิดเห็น • 89

  • @EmbraceMaking
    @EmbraceMaking  2 หลายเดือนก่อน +1

    If you're looking to prototype your own circuits, check out the breadboarding super kit below. As an Amazon associate I may earn a small commission (at no extra cost to you)
    ► amzn.to/4ddDPiD
    Get even more sensors, displays, servos, LEDs, jumpers, resistors, etc:
    ► amzn.to/4dghz7w

  • @tyborg970
    @tyborg970 10 หลายเดือนก่อน +1

    Great work putting this collection together, I appreciated the effort to capture your results and ask for help when something did not make sense. It shows humility and willingness to continue learning. A client I work with implemented the 2nd circuit option with similar results. With proper biasing circuit 1 is a champ!

  • @tookitogo
    @tookitogo 4 ปีที่แล้ว +5

    I assembled circuit 2 with an Arduino (using discrete MOSFETs and a Schottky diode, since I had them on hand) and it worked straight away. So I’m not sure why it’s not working for you. This circuit doesn’t rely on the MCU to latch. And in fact, the 10uf cap on the right (between the drain of the p-chan and the gate of the n-chan) isn’t what _latches_ the circuit, it’s what _releases_ it. (If you remove the cap entirely, the circuit cannot turn off.) The 100K is a pull-up. When the MCU I/O pin is held low (or the button is held down), the cap is able to discharge through the 300K*, turning off the n-chan, releasing the latch. (The value of the 10uF determines how long you have to hold the button or I/O pin low for the latch to release. I preferred a 1uF there in my experiments.)
    As for the code, initially set the I/O pin as an input, and read the input as an active low to determine a button press. Then to initiate shutdown, change the I/O pin to an output and hold it low.
    *or something. I don’t fully understand the circuit’s operation. Scoping the gate of the n-chan shows that once the I/O pin or button is held low, the cap discharges slowly to 0V, at which point the latch releases, and then jumps to -5V and recharges back to 0V.

    • @tookitogo
      @tookitogo 4 ปีที่แล้ว

      I wonder if it’s because you powered it with 12V, meaning the release cap could discharge much faster, resulting in even a brief button press being enough to release it. Also, just to be sure, you do realize it’s a 10 (or 1) uF, not nF? I don’t see any large caps in your circuit.

  • @astangeland
    @astangeland 4 ปีที่แล้ว +12

    In circuit 5, the microcontroller input A0 is being pulled up to 9V through a 100k. The reason you measured 5.5V is because the only reason it isn't 9V is because the internal protection diodes are clamping it. Pulling it up to 5V (after the LDO) will solve this problem.

    • @markpurcell8075
      @markpurcell8075 ปีที่แล้ว

      Yes, worse still the Arduino is being parasitically powered through its IO pin. The solution as you say is connect the pull-up to +5V from the LDO.

    • @SPSGRG
      @SPSGRG 9 หลายเดือนก่อน

      ​@@markpurcell8075I chose the same solution in my circuit but something is not right. My battery is a 1 cell Lipo with a maximum voltage of 4.2V. I am pulling up the GPIO of the MCU with a 3V3 LDO after the mostet, the same LDO that powers the MCU. Before pressing the switch, the MCU appears to be powered via the GPIO (I measure 4.2V on the GPIO) or perhaps via the pull-up resistor to the 3.3V rail. The MCU (ESP8266) isn't happy with this. Shouldn't this be controlled by D1? Are we missing something here?

    • @markpurcell8075
      @markpurcell8075 9 หลายเดือนก่อน

      @@SPSGRG I assume you mean the circuit here but with a 3.3V LDO instead of 5V, and the pullup to the D0 is from the 3.3V rail, the same one that powers the MCU. I can't see how you can get anything other than a max of 3.3V on that pin which is used in input mode to read the switch state, or on A0 which is an output used to latch on the power and if driven low power down the circuit. If it's A0 are you sure you've used an NPN transistor not a PNP for that, or for D0 the pullup is still connected to 4.2V as well?
      th-cam.com/video/7D9L9oS4AJM/w-d-xo.html

  • @Lossanaght
    @Lossanaght 5 ปีที่แล้ว +2

    On the last circuit, I believe the internal pin pull up resistor (datasheet: RPu I/O Pin Pull-up Resistor 20kΩ to 50kΩ) is forming a voltage divider with the 100k pull up. 9V supply - 5V supply = 4V across divider. 4V/(100kΩ + 20kΩ) = 33mA. 33mA*20kΩ =0.66V across the Arduino pull up. 5V supply + 0.66V internal pullup = 5.66V Assuming your ATmega328 is on the lower end of the specified resistance range it is not far off from what you measured.

    • @EmbraceMaking
      @EmbraceMaking  5 ปีที่แล้ว

      Thanks for pointing that out! Makes sense now!

  • @rklauco
    @rklauco 3 ปีที่แล้ว +1

    The second schematic - the 300k next to theinput pin needs to be 30k, otherwise the voltage divid3r with the diodemwill never reach voltage to keep the mosfet. Try to simulate in circuitJS, very useful.

  • @HerrHeisenheim
    @HerrHeisenheim 5 ปีที่แล้ว +3

    I've used a circuit similar to the first one for a project involving turning on and off a microcontroller with a soft latch, but the high-side pmos was used to pull up the EN pin of the regulator (its quiescent current is low enough for my application). It should allow for a lower dropout because there is no transistor in series with the power line. This might also be useful for high-power applications.

    • @EmbraceMaking
      @EmbraceMaking  5 ปีที่แล้ว

      Also a great application for a circuit like this :) Thanks for sharing!

  • @notenoughtech
    @notenoughtech 5 ปีที่แล้ว +5

    Actually just what I have been searching for! Love the explanation!

    • @EmbraceMaking
      @EmbraceMaking  5 ปีที่แล้ว

      Glad it helped! Thanks for watching!

  • @ch94086
    @ch94086 5 ปีที่แล้ว +3

    It's not a voltage divider in the last circuit. The 9V is going into the input protection diode in the micro. (There is an internal diode between the IO pin and power supply). The .66V is the forward voltage of a diode. It's injecting ~90uA (when powered down). There isn't an explicit limit on Arduino injection current in the data sheet, but my handwritten note has a limit of 1mA (I think from an Atmel app note).
    The 100K pullup is only for the microcomputer input, so should be after the regulator, but in an Arduino the 100K is unneeded if using the internal pullup (as in the other circuits).
    The third circuit works fine with a regulator as well (required with 12V battery), and requires only 1 IO pin. The 1ms time constant on the 10nF gate capacitor gives enough time for the IO input pullup to charge up the nmos gate after a button press. Use a 1M resistor instead of 100K and the gate capacitance of the PMOS gives about the same result. But I assume it would still work with 100K and no 10nF capacitor since the NMOS gate capacitance is 10X less than the PMOS.
    Note in one of the mosaic industries schematics with an Raspberry PI, they hook the 100K 5V pullup to the 3.3V IO pin-- not a great idea.

    • @EmbraceMaking
      @EmbraceMaking  5 ปีที่แล้ว

      Thanks for clearing that up regarding the last circuit!

  • @koospieterse3379
    @koospieterse3379 2 ปีที่แล้ว +1

    Hi. I build the circuit no 4. I work up to the point where the ESP32 switches of. The High signal (on the 3rd FET) from the ESP that keeps the Power On then goes off and the Power is then switched off. Also, if I reset the ESP the same thing happens. The power goes off. If I test without the ESP it works 100%

  • @tomasalar
    @tomasalar ปีที่แล้ว +1

    Very nice flow of the video and explanations, glad to have came across it.

  • @DustinWatts
    @DustinWatts 9 หลายเดือนก่อน

    It has been a long time ago so the breadboard is probably also long gone but, it is a dual MOSFET, but one of them is NPN and the other is PNP. My first guess would be the MOSFET's are switched :) Anyway... nice video with some nice circuits!

  • @ishubansal265
    @ishubansal265 5 ปีที่แล้ว +2

    The press on/controlled shut off/hold off is working fine; thought took some efforts. Actually it is the best from all 5 circuits

    • @unitechmarine8076
      @unitechmarine8076 5 ปีที่แล้ว

      Were you be able to put at work with an AVR? or did you use a Pi?

    • @ishubansal265
      @ishubansal265 5 ปีที่แล้ว

      @@unitechmarine8076 i used it with arduino(connected to that switch so it can sense a button press) to turn pi on or off

    • @EmbraceMaking
      @EmbraceMaking  5 ปีที่แล้ว

      Thanks for trying it out. What kind of efforts did it take to get it to work?

  • @brickstuffcorp
    @brickstuffcorp 5 ปีที่แล้ว +1

    Great info! So nice to have all of these in one place. A couple of questions: 1: will these run with a 5V input? 2: what is the voltage drop of each circuit? I'd be looking to run a 5V circuit with a 5V input. Thanks!

    • @EmbraceMaking
      @EmbraceMaking  5 ปีที่แล้ว +1

      Thanks! to run on 5V I would check the specs on the MOSFETS used for the circuit you're interested in. Just make sure that with whatever voltage you're using the MOSFET is sufficiently "on" for the amount of current you're looking to flow through. This will prevent excessive resistance.

  • @Hardwyre
    @Hardwyre ปีที่แล้ว

    So I used circuit #1 without a microprocessor for another project by just tying the Drain to the Base through the resistors, and then tapping power at the Drain. I changed the 1M resistor near the capacitor to a 10k because I was getting an interesting phenomenon where, if I cycled the main power rapidly, it would turn on without pressing the button. Using a smaller resistor seems to have remedied that. I'm testing and messing around with it, but as far as I can tell, it doesn't seem like the 10k is having any complications. I'll try a 100k just to be closer to your spec. I know enough about electronics to get myself in trouble, but not enough to understand all the theory of "why".

  • @ranikeev
    @ranikeev 9 หลายเดือนก่อน

    You can use TPS27081A ic for the last schematic. It can work from 1.2V (single AA battery)

  • @chandanpiku
    @chandanpiku ปีที่แล้ว +1

    Make a video on latching IC circuits

  • @3WerksJ
    @3WerksJ 5 ปีที่แล้ว +3

    What about testing these circuits at lipo battery voltages (3.7-4.2V)?

    • @EmbraceMaking
      @EmbraceMaking  5 ปีที่แล้ว +1

      I disassembled the circuits now, but I don't see why they wouldn't work at lower voltages. You may have to check the specs on the MOSFET to see how much current you can flow at lower gate voltages though

  • @isharasampath
    @isharasampath 5 หลายเดือนก่อน

    Great explanation, thank you very much.

  • @lynnfliger1856
    @lynnfliger1856 2 หลายเดือนก่อน

    Question on the first circuit, what happens if you continue to hold the switch on until after the micro fully turns off? (greater than 3 seconds ) Wouldn't it just turn back on.

  • @carlosdasilva4347
    @carlosdasilva4347 2 ปีที่แล้ว

    Great video! I built circuit 3 to latch on and control an ESP-01 module, but running into a simple issue and wondered if you can help, please... 😭😭
    Basically, using the GPIO0 pin with internal pull-up and the issue is that with ESP-01, when GPIO0 is pulled LOW on boot-up it goes into Flashing mode, so the program doesn't run (but power does stay latched).
    To prove this was the reason, if I leave GPIO0 of the ESP-01 disconnected, it boots up fine (whilst holding the pushbutton) then I connect that pin and it works as intended, it receives the signal low and if I press and hold the push button for 3secs or more, it powers down.
    So the latch circuit works beautifully, just the ESP-01 has this bug with it...
    I've tried adding a RC delay circuit to delay a the turning on of a NPN transistor between the GPIO0 and the 330ohm resistor to pushbutton, but it didn't seem to work.
    I even tried a similar circuit, but using a PNP transistor between Vin and 330ohm resistor to pushbutton, so that it keeps the GPIO0 high through the boot up until the capacitor on this RC delay is charged and leaves only the GPIO0 pin of the ESP-01 to keep the power latched. The ESP-01 still went into Flash mode.
    So I presume it is pulling the GPIO0 so soon in such a short amount of time that all of these circuits don't counteract it.
    Can't find a way to disable the GPIO0 flash mode, thought maybe through a HVProgrammer I could change some fuses that enable it...?
    I am only a hobbyist and starting to doubt whether I have built my RC delays/transistor switch correct or wired it the right way around. Do you have any suggestions?
    Thanks

    • @carlosdasilva4347
      @carlosdasilva4347 2 ปีที่แล้ว +1

      SOLVED: I used GPIO2 on ESP-01 to keep another PNP MOSFET, as used already in the circuit to cut the pull down to GPIO0 until the program booted long enough about 200ms to turn GPIO2 LOW and allow GPIO0 to be pulled down by the power latching circuit to stay on, the ESP-01 also sees the pushbutton grounding.
      I had tried with a more basic PNP transistor, and though it latched, the voltage output was too low and the circuit would eventually turn off on it's own and the ESP-01 would not see the button presses.

    • @EmbraceMaking
      @EmbraceMaking  2 ปีที่แล้ว

      Glad to hear you got it solved, sorry I couldn't respond faster, lots going on right now but I appreciate you following up! Someone will surely find this useful!

    • @carlosdasilva4347
      @carlosdasilva4347 2 ปีที่แล้ว

      @@EmbraceMaking One issue I still get that I'm not sure why, Is if the circuit has been on for a while say about 5mins.
      with my circuit, I have a usb cable attached to Vin and GND in parallel to the ESP-01, this is to power a small device I need the ESP-01 to communicate via Serial.
      When I press and hold the power button it tries to power down, but either:
      1) it powers down the EPS-01 but does not appear to turn off the MOSFET M1, if I attach the cable back to my separate device, it still get powered up and running; the MOSFET doesn't appear to ever switch off.
      2) or the MOSFET appears to cycle rapidly, as the ESP-01 LEDs flickers and does not appear to come out of it.
      I added a switch in parallel to the 1Meg resistor to function as a reset button, it does turn off the circuit, but sometimes I need to press and hold the reset button for about 5secs before it truly shuts down.
      Could this be simply the 10nF Cap needs to discharge completely?
      Wouldn't explain why the ESP-01 is off but the separate device still gets power.
      Could this be an issue with ESP-01, that it has a Cap on it that keeps the ESP8266 chip enabled or disabled spite the presence of power?
      Hope that makes sense...

  • @goosenp
    @goosenp 5 ปีที่แล้ว +3

    Did you test the current consumption of these circuits?

    • @EmbraceMaking
      @EmbraceMaking  5 ปีที่แล้ว +1

      Since most of them have the P-channel in front of the whole circuit they are practically zero when off. At least that's what my multimeter was showing, but I would have to see how low it reads. That was one of my motivations for finding these circuits... for a battery application I wanted very little parasitic draw when off. When on, I did not try and measure if there was additional draw though..

  • @RPBCACUEAIIBH
    @RPBCACUEAIIBH 4 ปีที่แล้ว +7

    9:29 The 1uF at the input charges too fast, via the 100K resistor, so the circuit can't stay on. Replace the 100K with 1M or even higher at the input, or the 1uF with a 10uF or higher, that gives you enough delay to release the button.

    • @pauliexcluded1
      @pauliexcluded1 10 หลายเดือนก่อน +1

      That was my suggestion as well. My thought process is that, as it does turn on but only momentarily, the there is insufficient time for the latch to hold. This means it is a timing issue which means adjusting your values of these components to lower your time constant .
      You may find this circuit works just fine without the micro. Pull it and replace it with a resistor. If it works, the issue is the initial state of that Io pin is shutting the latch off at startup. Again, this should be fixable by adjusting your time constant.

  • @tromtrom009
    @tromtrom009 4 ปีที่แล้ว

    hey, thank you so much! One Question: I have here one IRF520N and one BC414. Can you do the first example with these two components instead of yours? Greetings

  • @kennethweiss6544
    @kennethweiss6544 4 ปีที่แล้ว

    Hey Embrace Racing
    Great video like to see all the different examples compared but I would like to see the arduino code for the examples (especially circuit 3)
    I've been looking for it on EEVblog but I could only find a LTspice model of Arduino code controlled behavior :/
    Thanks and keep posting awesome stuff

  • @GapRecordingsNamibia
    @GapRecordingsNamibia 3 ปีที่แล้ว

    At 1:07, the first circuit, is that not a JFET being shown? You said a mosFET. As far as I can remember an arrow on the gate side indicated a jFET, a mosFET has it's arrow on the source side?

  • @sanjaybatra6593
    @sanjaybatra6593 ปีที่แล้ว

    what is your recommendation , which circuit is reliable ? Can you suggestion any other circuit or IC easly available ?

  • @tromtrom009
    @tromtrom009 4 ปีที่แล้ว +1

    hey guys, thanks so much for this tutorial. I want to use the first circuit. It's principally working BUT: Even if the button is not pressed, I can still messure 1.5V (instead of 5V if it's pressed). What could be the reason?
    greetings
    Sven

    • @tromtrom009
      @tromtrom009 4 ปีที่แล้ว +1

      ok, I have added a 100uF. Now it works. Before, I have make the circuit without any capacitor.

  • @benvien7966
    @benvien7966 4 ปีที่แล้ว

    Thank you for the exhaustive video! I connected the Peabody (first circuit) and it seems to work without the 2.2uF capacitor. Any idea why it might be needed?

    • @JohnDoe-rx3vn
      @JohnDoe-rx3vn 4 ปีที่แล้ว +1

      Might be to absorb micro spikes from the switch contacts scraping before they touch. Could be to stop oscillations, too

    • @patrickschnedl892
      @patrickschnedl892 3 ปีที่แล้ว

      i think its a delay, giving the mcu enough time to boot, pull up the out pin to power the transistor

  • @electroGoal
    @electroGoal 3 ปีที่แล้ว

    Is it possible to replace voltage regulator with itself microcontroller to switch mosfet fast enough (kind of buck/boost converter) to achieve it's own desire voltage

  • @scottsejka8681
    @scottsejka8681 5 ปีที่แล้ว

    Thank you for sharing. I was wondering if you might have a Fritzing/screenshot of the first soft latching power circuit. I am having an issue where the microcontroller turns back on after I pull my output pin low. I have a feeling it might be due to how I have my two diodes wired/breadboarded. Any help would be greatly appreciated.

    • @EmbraceMaking
      @EmbraceMaking  5 ปีที่แล้ว

      Hi Scott, unfortunately I do not have a Fritzing diagram for the circuit... did you modify the position of the capacitor as I suggested in the video?

  • @SKElectronics
    @SKElectronics 6 หลายเดือนก่อน

    tried circuit no 3 works fine p mos - irf9z24 n mos - ao3402, diode - 4148 mcu arduino nano.

  • @Van-NhanTran
    @Van-NhanTran ปีที่แล้ว

    I use circuit 2 (without the diode) and as soon as power is applied, the circuit is latched even though I have the jumper at auto off position. Do you know why?

  • @davidhitchins8870
    @davidhitchins8870 3 ปีที่แล้ว

    There are an number of similar videos on the web but this one is the most interesting so far. HOWEVER, no matter where I look I can't seem to find a latching circuit that works with a door/window reed switch - they all use some version of the momentary pushbutton such as a PIR trigger signal or just an actual pushbutton. But when a door closes, the reed switch is permanently "ON' until the door is opened again. It is not momentary. I've put the question on the various forums but nobody is answering. (because they don't know?) Any ideas please?

    • @EmbraceMaking
      @EmbraceMaking  3 ปีที่แล้ว

      So let me clarify... you want your door / reed switch to be the push button that activates the latching circuit? But the problem you are having is that with the door closed, the door switch remains "high" unlike the momentary push button which would go back to low... and this is causing issues in your circuit?

    • @davidhitchins8870
      @davidhitchins8870 3 ปีที่แล้ว

      @@EmbraceMaking Yes precisely that. Many talk of using reed switches but I can't see how they can be used. In one video they even have a demo of a reed switch but they only show what happens when the door is opened (so trigger comes down from high) and how that triggers the latching circuit but they don't show it long enough to see the circuit unlatch again. I asked them several times - no reply. One could be forgiven for thinking they weren't being honest...

    • @davidhitchins8870
      @davidhitchins8870 3 ปีที่แล้ว

      It appears that I am right saying that reed switches can't be used as triggers. Will have to seek another solution...

    • @rickheine8317
      @rickheine8317 2 ปีที่แล้ว

      @@davidhitchins8870 You can get either NO or NC reeds. For my door switch it boots up the esp when the door opens and the switch closes. This means zero draw when the door is closed. I have the same door armed now for 5 years on a small battery.

    • @davidhitchins8870
      @davidhitchins8870 2 ปีที่แล้ว +1

      @@rickheine8317 Thanks. Yes I know, and in fact I have a reed switch with both NO and NC built in (so it's a dual reed switch). But what if the door is left open as it often is during the day for airing the house (there is a second screen door for security)? Leaving the door open for just a couple of hours would flatten the battery very quickly. I've really tried to dream up a solution but so far nothing works and this in spite of all the solutions I can find on the web implying that using a reed switch is a doddle. It certainly isn't a doddle...

  • @toby150
    @toby150 3 ปีที่แล้ว

    Why is there the right diode on the first circuit? When there is an input it should be high impedance, so the current will automatically flow to ground?

    • @toby150
      @toby150 3 ปีที่แล้ว

      And the left diode is also unnecessary, or am I wrong?

  • @metamud8686
    @metamud8686 2 ปีที่แล้ว +1

    How great this would have been without the distracting background music interfering with your spoken explanation. Please omit next round!

  • @djwhouse
    @djwhouse 5 ปีที่แล้ว

    Is the io pin being set high on powerup?

  • @adrianoverona
    @adrianoverona 5 ปีที่แล้ว

    Hi. Thanks for sharing! Any chance of publishing the source code?

    • @EmbraceMaking
      @EmbraceMaking  5 ปีที่แล้ว +1

      I'll see what I can dig up and put on github!

    • @adrianoverona2388
      @adrianoverona2388 5 ปีที่แล้ว

      Thanks! That would be very helpful :)

  • @nhatnguyen4794
    @nhatnguyen4794 3 ปีที่แล้ว

    I wonder how MCU wake up itself after turning OFF. Does anyone know about power consumption of these circuit when it is in Off state? Any way to save this consumption to increase battery cycle(can we use CAP for discharge or sth like that?)

    • @EmbraceMaking
      @EmbraceMaking  3 ปีที่แล้ว

      With the p channel mosfet blocking current flow into the circuit, I believe the current consumption when off is nothing? almost nothing? This is why the button is there to turn the device back on. If the MCU was in some sort of low power sleep mode (not these circuits), they are usually woken up with an "interrupt" ... mcu data sheet should show which pins support interrupt.

  • @ErdemYldrmer
    @ErdemYldrmer 5 ปีที่แล้ว

    I’ve been searching a ready to use circuit to buy but couldn’t find any on tindie or AliExpress. Anyone can point one?

    • @EmbraceMaking
      @EmbraceMaking  5 ปีที่แล้ว

      There is this one from pololu www.pololu.com/product/2808 but the push button does not function as an input when the device is on.

    • @djwhouse
      @djwhouse 5 ปีที่แล้ว +1

      I use it, and add an external switch with SPDT. I tie the common to a ground, the NO to the 'A' line, and the NC to the Arduino as an input (pullup), and another Arduino pin to the 'off' line.
      Pressing the switch applies gnd to A, turning on the power. The Arduino can read the switch during operation. When the Arduino is ready to power down, the Arduino raises the off pin high.

  • @imignap
    @imignap ปีที่แล้ว

    dude LTC2954 is $5

  • @nemesis851_
    @nemesis851_ หลายเดือนก่อน

    LTC2954