Arduino Power Latch (Single Button)

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

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

  • @TrippyElectronics-yn4fh
    @TrippyElectronics-yn4fh 3 หลายเดือนก่อน +2

    This is great. Just what I need. I have been looking for ways to reduce power consumption after running some code to start a generator.

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

      Great, glad you found it of use. Would be interested to hear how you get on.

  • @yourstruly2728
    @yourstruly2728 4 หลายเดือนก่อน +2

    This is exactly what I was looking for sir. Thank you very much for your experience and knowledge.

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

      Thanks. Glad you found it of use.

  • @mpadlite2925
    @mpadlite2925 24 วันที่ผ่านมา

    Very happy to have found (and now subscribed to) your excellent channel!!
    Best regards

    • @paulpkae
      @paulpkae  24 วันที่ผ่านมา

      Thanks and welcome.

  • @SusanAmberBruce
    @SusanAmberBruce 8 หลายเดือนก่อน +1

    I like it, thanks for sharing

    • @paulpkae
      @paulpkae  8 หลายเดือนก่อน +1

      Thanks again for for comments. Glad you find these videos interesting.

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

    Brilliant video, I really like the idea! I have two questions though.
    1. What are the advantages of using a P-MOSFET over a PNP BJT transistor on the VIN side?
    2. Why did you add that while(true) loop inside the loop() function which by itself loops indefinitely? Wouldn't it work without the while(true), apart from it requiring that ButtonHeld, StableLED, lLEDState and lReleased variables be global and initialized in setup()?

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

      1. MOSFETS turn on/off from presence of the electrical field at the Gate rather than current flowing like a BJT. They drain virtually no current in the OFF state.
      2. That's just habit. I prefer to have the loop within my control. Quite often I do some initialising at the top of the loop function before I want the actual loop to start. This is normally because I use local variables which cannot be initialised within the Setup section. Global variables are bad practice.

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

      @@paulpkae Thank you!

  • @JasonWhitlark
    @JasonWhitlark 8 หลายเดือนก่อน +1

    This is lovely. I'm thinking about using this with my esp32s. I'm still new enough to these things that I'm not sure what changes would need to be made to power this off of a 5v circuit, or if it's even still possible. Do you have any hints?

    • @paulpkae
      @paulpkae  8 หลายเดือนก่อน +1

      Hi. Thanks for the comment. I had the circuit still setup on my bench so I tested it and yes it works OK at 5V. That's with an Aurduino Nano, but I see no reason why an ESP32 board would be any different. Just bear in mind the slight volt drop across the MOSFET which looks to be around 0.1-0.2V, so @5V supply your actually getting around 4.8-4.9V. This might vary dependant the total load of the ESP32 and any other components you're powering. Good luck, I would be interested to hear how you get on.

  • @kabloui
    @kabloui 4 หลายเดือนก่อน +1

    Wow, Very useful

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

      Thanks.

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

    Well done buddy ❤

  • @BartBraun-y9d
    @BartBraun-y9d 10 วันที่ผ่านมา +1

    I would like to have a similar circuit, but running off 5V rather than 9V.
    What changes would have to be made (to resistors etc.)?

    • @paulpkae
      @paulpkae  9 วันที่ผ่านมา +1

      None, 5V works absolutely fine.

  • @Wil_Bloodworth
    @Wil_Bloodworth 8 หลายเดือนก่อน +1

    Very nicely done. Seems like it might be more efficient to use events instead of a loop for knowing button states and depressed durations though would it not? I have not done any Arduino programming so I am only relying on "other" programming. I do not know if events are available [in Arduino] but it would be a shame if they were not. Just thinking through it, you would only need two events... onButtonPressed and onButtonReleased. From there, it is a simple matter of recording when the button was depressed or released and doing math... and taking an action similar to what you're doing in your loop once the button is released. But hey, it's 8am and I'm on my first cup of coffee in a topic in which I have zero experience... so there's that. LOL. Have a wonderful day and I look forward to more of your videos!

    • @paulpkae
      @paulpkae  8 หลายเดือนก่อน +1

      Yes, you can setup hardware interrupts for Rising Edge and Falling Edge triggers. The code is just there to demonstrate an example implementation of utilising the button to do a certain action within your code, but also act as an OFF switch.

    • @Wil_Bloodworth
      @Wil_Bloodworth 8 หลายเดือนก่อน +1

      . @paulpkae thanks Paul. I just ordered a Nano so I can play around with this. I'm sure it will be a fun way to learn more about Arduino as well as how various transistor types work.

    • @paulpkae
      @paulpkae  8 หลายเดือนก่อน +1

      @@Wil_Bloodworth nice one. Let me know how you get on.

  • @marcus3d
    @marcus3d 7 หลายเดือนก่อน +1

    Is it possible to have even lower leak current when it's off?

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

      The leak current was undetectable (with my test kit) in this circuit and nothing to worry about unless you are ultra concerned about power for some reason. In which case a mechanical switch or a latching relay is your best option.

  • @SKElectronics
    @SKElectronics 5 หลายเดือนก่อน +1

    going to give it a try