Arduino soft power control

แชร์
ฝัง
  • เผยแพร่เมื่อ 18 พ.ค. 2015
  • A software-controlled zero-power-off solution for battery-powered Arduino projects (or any other micrprocessor), using a single button for controlling both power-on, functions and power-off. After a little investigation, and a large wrong-turn caused by a bad circuit diagram I found on the Internet, I decided to work out how to do soft power control for myself.. and made a video so you can join me for the ride.
  • วิทยาศาสตร์และเทคโนโลยี

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

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

    I was very surprised when I couldn't easily find anything about making a soft start circuit for arduino. This has been very helpful. Thanks for sharing!

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

    Very helpful video, great to have an explanation for every component, I don't think you missed a thing!!

  • @benjmunday
    @benjmunday 6 ปีที่แล้ว +2

    Great video, enjoyed watching it! Electronics blow my mind, even this 'simpler' project. I dont know how i am ever going to learn it.

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

    Exactly what I was looking for ... thanks for posting this video!

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

    This solves the problem i just realized i had, thank you so much! I am building a lightning trigger for a camera with a pro mini and a few other bits and have been looking for a way to control power with a momentary button, this fits the bill.

  • @stevemeacham
    @stevemeacham 7 ปีที่แล้ว

    Thanks for your circuit Jim, just what I needed.. although I had to add a 10K pull-up from the input signal to +5v to get a reliable signal from the button .

    • @ThingsWhichArentWork
      @ThingsWhichArentWork  7 ปีที่แล้ว

      Thanks for the feedback Steve - I'm very glad that this video helped you out. Cheers!!

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

    Great invention there Jim, and useful instructions on going about the thought processes for such a project.
    Cheers mate

    • @ThingsWhichArentWork
      @ThingsWhichArentWork  9 ปีที่แล้ว

      Thanks ***** - I'm not sure I can take credit for the invention, but hopefully my expanation made sense of how the circuit works. In other news... the arking transformer I ordered after watching your video arrived today, so I'm going off to play now. Cheers!!

    • @OrbiterElectronics
      @OrbiterElectronics 9 ปีที่แล้ว

      Jim Conner .. Hehe... Have fun with the transformers Jim. Watch-out though mate as they do bite :)

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

    Really appreciate your video. You saved my ass.... Keep up the good work man!!

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

    I have seen similar circuits where you can connect the base of the BJT to the Drain of the MOSFET. As soon as you press the button and the MOSFET turns on, the drain receives power and it pulls the base of the BJT high, thus latching the circuit into an power-on state. This way, you don't need the pin from the MCU to keep the BJT on. Great project and video. Enjoyed it very much. Thank you.

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

      If you use BJT to keep the mosfet on, can the MCU still switch off the power when it's finished its work? I'd like to know more about this solution. Thanks.

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

      @@ThingsWhichArentWork Hi Jim, I built the circuit with both MOSFET/BJT and MOSFET/MOSFET.
      Things worked fine with pushbuttons, but when I used an Arduino Uno, I could not get it to turn off either. Things look so great on paper, but then I read people talking about the diode-like behavior of the Arduino pins that make switching off transistors so hard.
      I'll keep at this to find a solution. Thank you for the great video.

  • @pranavrokde9417
    @pranavrokde9417 6 ปีที่แล้ว

    you are awesome... thanks for sharing with us.... 😇

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

    Thanks for sharing knowledge! One question though... when you show your breadboard (at the 4:25 timecode), I see that your yellow and blue wires connect your source pin to power, however what is your drain pin connected to? Since it is bent over, I cannot see anything. Thanks!

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

    Awesome video, very clear thanks a lot for posting it. Do you know if this method has some advantages to the 2 MOSFET (N&P) method?

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

    Very nice Jim.. Great explanation too. I'm sure the kids will love it. One thing though.. How did you get the electronics & batts in the ball? Or is this a secret ship in bottle type skill ☺️
    Cheers. John

    • @ThingsWhichArentWork
      @ThingsWhichArentWork  7 ปีที่แล้ว +2

      Hi John - I just cut a small hole in the ball, and then stretched it over all of the electronics... though actually the ball didn't last for long... all of the squishing wasn't good for the solder joints, so these days the electronics all live inside a 3d-printed Android-logo style robot, and you pat it's head to activate the switch to turn it all on. Cheers!!

  • @DansKoiPond
    @DansKoiPond 9 ปีที่แล้ว

    Jim great video

  • @meehan302
    @meehan302 9 ปีที่แล้ว

    Good Jim get them started while they are young . Be well

    • @ThingsWhichArentWork
      @ThingsWhichArentWork  9 ปีที่แล้ว

      Thanks Patrick Meehan - The best part is that the kids love learning all of this stuff. Cheers!!

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

    Thanks. I guess only missing part is mosfet selection. IRF5305 or IRF9Z34N which I have for some reason is not ideal if microprocessor operates at 3.3V or so (lifepo4, 3xNiMH, li-ion, ...). Few years ago I bought a few TP0606N3-G and LP0701 ... not sure why exactly these, they have quite high on resistance, but vgs(on) is 2.4 or 0.7V. Ok, after experimenting, TP0606 draws about 1-3uA depending on VCC when it should be off (maybe it always conducts a bit), has higher resistance and it's likely discontinued.

  • @kremicfein
    @kremicfein 7 ปีที่แล้ว

    Does it have to be the BC414 or can I take any NPN transistor? What specs should the alternative transistor have otherwise? (I have others here, like C945 or C828.

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

    Great for getting the kid's involved .....

    • @ThingsWhichArentWork
      @ThingsWhichArentWork  9 ปีที่แล้ว

      Thanks GreenEvolutions - Gotta show my kids the stuff I think is cool... and they enjoy it too... Cheers!!

  • @ScottieNiven
    @ScottieNiven 9 ปีที่แล้ว

    Im also new to arduino aswell, one of my current projects is a 100w torch with fan control, battery management etc. I was struggling to find a nice way to turn the arduino on and off, so I will definitely be trying your method!

    • @ThingsWhichArentWork
      @ThingsWhichArentWork  9 ปีที่แล้ว

      Thanks ScottieNiven - I'm surprised nobody makes a ready made board for handling soft power control. I scoured ebay for a while before resorting to stripboard, but came up empty handed. The torch sound like it will be pretty awesome when it's done. Cheers!!

    • @ScottieNiven
      @ScottieNiven 9 ปีที่แล้ว

      Jim Conner It is strange, I also did look for one. Ive got it to the point where the LED is switched on and off and the fan is controlled by heatsink temperature, I still need to buy the battery protection PCBs and figure out a way for the arduino to monitor the battery and add PWM to the LED. At the moment I can get around 2 hours from a single charge at full brightness!

    • @ThingsWhichArentWork
      @ThingsWhichArentWork  9 ปีที่แล้ว

      ScottieNiven What are you using for the battery? I'm guessing it's going to be around 200Wh capacity, but I'm curious as to whether you went with lithum, nimh or pb. Cheers!!

    • @ScottieNiven
      @ScottieNiven 9 ปีที่แล้ว

      Jim Conner Currently its a 16 cell 18650 Li-ion battery, 4 cells in 4 sets. Its roughly around the 200wh mark 16v * 12ah but the cells were recovered from laptop batteries, so they may not be 100% capacity

    • @ThingsWhichArentWork
      @ThingsWhichArentWork  9 ปีที่แล้ว

      ScottieNiven I'm a great fan of old laptop packs... I rejuvinated an old 100W halogen torch a few months ago by replacing it's long-dead 4Ah lead-acid with 13.2Ah worth of old laptop batteries... It's a vast improvement. Cheers!!

  • @scottthompson2481
    @scottthompson2481 8 ปีที่แล้ว

    i have bought a Arduino starter kit, but i am new to this type of thing , do you now how the hell i get started, as watching this video has made me realise how hard this learning curve will be , do you now of any channels for real beginners? many thanks Scott.

  • @sean999ification
    @sean999ification 9 ปีที่แล้ว

    Good video. I've been struggling with a soft on/off button. Will try a fet instead bpj now. Where's the cat by the way?

    • @ThingsWhichArentWork
      @ThingsWhichArentWork  9 ปีที่แล้ว

      Thanks sean999ification - Glad you found it useful. The cat was off having her mid-morning-to-early-evening snooze when I was filming this one. She's now woken up and is relaxing in the comfy chair in the corner of my office. Cheers!!

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

    Can't be bothered drawing a Fet....lol...Great Work...

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

    So close to getting this working however it just isnt! :/ the arduino is keeping it on with the 5v power. I think i have diodes in wrong place :(

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

    Hellow,
    Can you please explain me the use of two diodes here. If we use one controll pin from arduino it will turn on when the button pressed(if the code has written to turn high the controll pin in void setup function) and keep the mosfet on no? So what is the use of getting state of switch? Thank you

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

      It means that you can use the 'on' button for multiple functions once the arduino is powered up. Click to turn on, double-click to enter a menu etc..I made a toothbrushing timer for my kids using this circuit and made it so that a long-press on the switch would turn it back off again. Hope that explains it. Thanks for taking the time to watch and comment. Cheers!!

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

    Jim - thanks for the video. I liked involving the children in "inventing" solutions. There are a few other quite similar solutions using two FETs. Are there any solutions with SMD components only? I need a circuit in which I can use the same switch for another purpose (pressing it for a shorter duration). I think this circuit will work - just need to change the code. I am surprised there is no specialized device for doing exactly this given this is a requirement in a large percentage of electronic devices. How do mobile phones handle this requirement (I assume the microcontroller can be sent into / woken up from a deep sleep state using a switch). Any ideas?

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

      Hi Puneet Teja - I scoured the Internet long and hard searching for a ready-made soft-power board, but couldn't find a single one available anywhere (with our without surface mount components) - I'm half tempted to design a PCB and see if I can get some manufactured cheaply somewhere so that I can start selling them on ebay. Mobile phones handle their soft-power in exactly the same way as this circuit for power-off situations, but deep-sleep is not quite the same situation. With deep-sleep all of the perhipheral devices are powered-down, but the power is still sent to the microprocessor (which is using close to zero power as the clock can be stoped and no instructions are being executed. The chip is set to wake up when it sees the state of one of it's input pins change, but all of that is handled by a built in interrupt handler in the microprocessor - this allows for things such as the real-time-clock to wake the processor to trigger alarms etc. Hope that helps - Have a great weekend. Cheers!!

    • @puneetteja
      @puneetteja 9 ปีที่แล้ว

      Jim Conner - Thanks for the deep-sleep details. It is a great idea to get something like this manufactured as a ready-to-use breakout board. To keep it flexible, the power on/off must be microcontroller controlled in addition to the switch. This way the switch can be used for other functions with a short presse and multiple short presses and long press to switch on-off.

    • @ThingsWhichArentWork
      @ThingsWhichArentWork  9 ปีที่แล้ว

      Hi Puneet Teja - The circuit I used in this video lets the button be used for other functions too. Pressing the button just ensures that the power stays on for around 2 seconds... subsequent pressed can be read by the microcontroller as a button input, and when the microcontroller decides that it's time to switch off, it just pulls an IO line low and sits and waits for a couple of seconds until the power dies. Maybe I'll knock together a PCB layout for this board over the next few weeks... might be a fun side project for me. Cheers!!

    • @puneetteja
      @puneetteja 8 ปีที่แล้ว

      +Jim Conner - check out this device: www.linear.com/solutions/1710
      It meets all your requirements and more! What do you think? I am sure other manufacturers have similar components. Am on the lookout.

    • @ThingsWhichArentWork
      @ThingsWhichArentWork  8 ปีที่แล้ว

      Hi Puneet Teja - That's for that... The LTC2955-1 looks like almost the perfect part for the job.... If I'm reading the datasheet correctly then the power-button state is also available on the _INT pin which feeds into the micro... I wonder if the state of the power button is directly matched with _INT, or if _INT is a single pulse which is triggered on a button push... (hopefully it directly matches the power button state as then you could use long-press / short-press for activating different functions)... I'll take a better look at the datasheet when I'm at home this evening. Thanks for letting me know about it. Hope you're having a good day. Cheers!!

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

    Hi, could you please share a close up photo of your stripboard layout? I've built this on a breadboard and everything works except using the button as an input after the powet has been turned on. I think I spent 2 hours just trying to get the diodes right but to no avail. It's quite frustrating but I'm sure it's something trivial that I'm not seeing. In any case, whatever I do the button always reads either high or low, depending on the diode positioning - pressing it doesn't change the value.

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

      Hi Serelek - I felt bad that you'd spent 2 hours debugging already, so I pulled apart my unit, cut the cable ties and removed the layers of kapton tape so that I could take some photos for you.... Front: raw.githubusercontent.com/jimconner/ArduinoSoftPower/master/PCB-Front.jpg ... Rear: raw.githubusercontent.com/jimconner/ArduinoSoftPower/master/PCB-Rear.jpg ... Hope that helps. Cheers!!

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

      @@ThingsWhichArentWork Thanks a ton Jim, I really appreciate the quick answer - I honestly wasn't really expecting a reply seeing as this video is over 5 years old haha. Your pictures are perfect and I got it all working great now! The issue was that I built the circuit using your first diagram and then I was adding the diode between the button and MOSFET gate without taking out the piece of wire that was used to connect them before. So the diode wasn't doing anything either way! I took out that wire and it all just clicked. Thanks again!

  • @astasna
    @astasna 9 ปีที่แล้ว

    awesome !

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

    nice

  • @danljohnston
    @danljohnston 8 ปีที่แล้ว

    Great project, for those that are "code challenged" is the sketch posted anywhere? thanks

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

      Thanks +Danny Johnston - Now that you've prompted me for it... I've just stuck the code up on github. github.com/jimconner/toothbrush_timer ... Cheers!!

    • @danljohnston
      @danljohnston 8 ปีที่แล้ว

      +Jim Conner thanks for sharing your project, very creative!

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

    The capacitor is initially charged through the 1M resistor. How can it keep the P-Channel MOSFET on by supplying a high voltage at its gate? It is low voltage that turns on this MOSFET!! That’s why you have the 1M pull-up resistor to keep it off normally!
    Also when you press the button it instantly shorts the capacitor, which is a great way of discharging a capacitor. I don’t see how the capacitor can give you any lag time. Sorry, I just don’t understand. I would love to know how this circuit works.

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

      Hi Daniel - It's been a few years since I made this circuit, so my memory is a little rusty at this point. The circuit isn't using the pull-up resistor to keep things switched on - it is using it to keep things switched off by default. The MCU has to pull a pin down (or up) to keep the circuit activated. When you push the button it rapidly will drain the capacitor to ground enabling the mosfet and supplying power to the MCU. When you release the button, the capacitor will slowly charge up again until it reaches the voltage where the mosfet switches off. The Arduino needs a couple of seconds to get past the bootloader and into the code which is driving the pin to keep things enabled. The 2.2uF capacitor charges through the 1M resistor, and it takes around 3 seconds for that to charge to the point where the mosfet will switch off - this gives a little bit of time for the arduino to get itself booted up into the code which then drives pin12 to keep the power switched on. Without that capacitor you'd have to hold the power button down for a couple of seconds to get the power to stay on. Hope that explains it better. Cheers!!

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

      @@ThingsWhichArentWork Hi Jim, thank you very much for your reply. What I am struggling to understand is the role of the capacitor. Since it charges initially through the 1M resistor, and it puts a positive voltage at the gate of the P-channel FET, this will keep the FET off rather than keeping it on for the 3 secs or so that is needed.
      When the capacitor discharges, it still has a positive voltage, albeit it is decreasing rapidly towards zero.
      In my silly mind, I am looking for way to keep the gate of the FET at ground for 3 secs, rather than putting a positive voltage at its gate. Maybe I am looking at this wrongly or my assessment is messed up :)

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

    You sound just like EEVBlog / My Mate Vince.

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

      I take that as high praise as I love both of those channels... Thank you Claudia

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

    Dude I wish you were my dad

  • @RoterFruchtZwerg
    @RoterFruchtZwerg 8 ปีที่แล้ว

    Actually a good video for educational purpose but completely unnecessary in this case ;) The arduino has a built in 5V regulator. It also works fine with voltages down to ~3V, so you can just power it from 3 AAAs or one LiPo without regulation at all. It also features low power / sleep modes with current consumption way below 100uA and wake-up on interrupt (button press). You just have to kill the power LED on the board. It can also monitor its input voltage so you can make a low battery indicator too.

    • @ThingsWhichArentWork
      @ThingsWhichArentWork  8 ปีที่แล้ว

      Hi +RoterFruchtZwerg - That may be the case for propper real Arduinos, but the super-cheap clone Nanos that I'm using don't seem to have any kind of voltage regulation built in. I added the step-down converter after I'd blown up two Nanos already. I'm 100% sure that my Nano clones don't have voltage regulation... I've measured their current consumption at various voltage inputs and it scales up rapidly as the voltage goes up... The LEDs get brighter, the speaker gets louder and the Atmel chip goes hot, hotter, too hot, magic-smoke... I was rather frustrated to have to make this circuit as I'd done a similar sort of thing before using an ElectricImp device, which has an ultra-low standby power even when the voltage regulator is left active. I'll have to get myself some real branded arduinos one day, but I've still got half a dozen of these clone Nanos to use up first. Cheers!!

    • @RoterFruchtZwerg
      @RoterFruchtZwerg 8 ปีที่แล้ว

      Jim Conner I also use cheap clones... They have a unregulated 5V (or 3.3V also exist) input and a separate RAW input that usually goes to a LDO voltage regulator... But anyway, if yours doesn't have a LDO, you can still power it directly from 3 AAAs. For low power consumption, look for the lowpower.h arduino library.

    • @RoterFruchtZwerg
      @RoterFruchtZwerg 8 ปีที่แล้ว

      +Jim Conner yours also has the RAW input and a LDO voltage regulator right next to the RX pin (telling from the close up right after the intro)

    • @ThingsWhichArentWork
      @ThingsWhichArentWork  8 ปีที่แล้ว +2

      +RoterFruchtZwerg You're right!!!... I hadn't looked too closely before (I think I mentioned in the video that this was my first every Arduino project)... There's a RAW input on there (I wondered what that was for) and a 5v regulator... D'oh - What an idiot I am.... I'll add an annotation onto the video to let others know too. Thanks for setting me straight. Cheers!!

  • @scottthompson2481
    @scottthompson2481 8 ปีที่แล้ว

    i have bought a Arduino starter kit, but i am new to this type of thing , do you now how the hell i get started, as watching this video has made me realise how hard this learning curve will be , do you now of any channels for real beginners? many thanks Scott.

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

      Hi +Scott Thompson - Julian Illet's channel is a good choice for learning from - he often goes into good explanations about how basic circuits work. I would say though that the best approach to any project is to get stuck in, and fill the gaps in your knowledge as an when you need to - It's not that hard to go from a flashing led arduino sketch to making the LED flash when the analog input detects a higher voltage from a microphone (or something like that)... and it's not hard to go from there to the next step... That way you have a bunch of little learning curves instead of one big one. This was actually my first every arduino project, and as a result of someone letting me know in the comments below, I've discovered that the RAW pin on the arduino is the input to the onboard voltage regulator, so I didn't actually need the seperate step-down board at all... It's always good to learn something new, and I won't make that same mistake again. Hope you're having a good weekend. Cheers!!

    • @scottthompson2481
      @scottthompson2481 8 ปีที่แล้ว

      Thank you for the advice sir , all about increasing knowledge an building confidence , like with most thing , persistence pays off . many thanks Scott .