Low Power Arduino! Deep Sleep Tutorial

Поделиться
HTML-код
  • Опубликовано: 21 окт 2024

Комментарии • 336

  • @billybbob18
    @billybbob18 Год назад +3

    Finding this video 7 years later is great. I've never ran a chip that low until now. I'm surprized your Keithley showed anything at all when most meters round down to zero when the next digit is below 5. I have a 38 year old Hioki multi meter I picked up at Goodwill for 5 bucks. It reads in increments of 10nA and I was finally able to confirm that it works and showed the same result as your bench meter. Thank you for sharing! I really need a meter like yours now.

  • @JMTosses
    @JMTosses 8 лет назад +18

    Kevin, I must say, this is nothing less than amazing! I'm not sure how and where I will implement what I just "learned" but this video is top notch - thank you for a) taking the time to research these details and b) then make your findings available to your viewers. Most appreciated!

  • @davidperna
    @davidperna 8 лет назад +53

    Great video! Please keep up with this low power series, it's very helpful

    • @Kevindarrah
      @Kevindarrah  8 лет назад +13

      +David Perna thanks, lots more to come!

    • @omtandon2741
      @omtandon2741 4 года назад +1

      Yes pls

    • @DrMrSuperAwesomeGuy
      @DrMrSuperAwesomeGuy 4 года назад +1

      Kevin Darrah I’m interested in making a small battery powered fish feeder for a beta fish. Something that utilizes a Mini Pro 3.3v, two double A’s, and one of those tiny digital camera stepper motors. Do you have any videos on getting the lowest possible power draw while still utilizing the internal clock? Watchdog would drift too much over the course of a month or so

    • @omtandon2741
      @omtandon2741 4 года назад +1

      @@DrMrSuperAwesomeGuy yes pls

  • @Zekedog1
    @Zekedog1 8 лет назад +2

    Kevin this is amazing stuff. I am new ( 2 weeks) to Arduino and coding, and know I am going to watch this video over and over dozens of time to comprehend the scope of sleep mode. This is precisely what I am trying to implement into my project. Thank you for taking the time to prepare and research this tutorial. this is an amazing gift to the community. Many thanks.

  • @nrdesign1991
    @nrdesign1991 7 лет назад +2

    I never thought too much about what else besides the sleep mode could further increase battery life much. Thanks for this awesome video! Also bonus points for not begging for likes and subs at the start, like so many other youtubers do. Keep it up!

  • @capttom144
    @capttom144 7 месяцев назад

    I'm part of the late crew but: working right now on a similar project I - finally! - stumbled across your channel/video..
    I failed trying all other tutorials and even ChatGPT couldn't help me out with a proper code. Either the 328 didn't wake up again or the sketch didn't work at all..
    Yours worked for me right from the start, it doesn't need libraries and you even explain how to set the needed registers!!
    Instant subscription 👍 and your channel is - unfortunately - really underrated..

  • @uvlight
    @uvlight 8 лет назад +10

    Thank you so much, I really like this, specially when you do that without external library.

  • @refusneant
    @refusneant 5 лет назад

    from datasheet to break board ,the perfect way to do it.Thanks for this Kevin.

  • @francescoreale
    @francescoreale 4 года назад +2

    Such a kind of videos give an incredible value to internet. Thank you for sharing your hard work!

    • @Nordic_Goon
      @Nordic_Goon 3 года назад

      Time for the authoritarian powers of the world to ban us from it.

  • @Nordic_Goon
    @Nordic_Goon 3 года назад

    Not going to lie. This is way over my head as far as digging into complicated verbiage in documentation, but your breakdown at least helped me understand the efforts that go into breaking down the use of all these sleep state features that I was just copying and pasting into my scripts to use in my projects. Appreciated.

  • @Chowmix12
    @Chowmix12 8 лет назад

    Nice video! The little snafu in the middle is not a big deal at all! Tons of great information in this video, it is all very much appreciated!

  • @giacomopaccagnan5600
    @giacomopaccagnan5600 8 лет назад +38

    Wow! fantastic series!! Good job, man! can you make a tutorial also on low power mode for esp8266?
    Hope the best for you in the future!

    • @cesarp6761
      @cesarp6761 8 лет назад +2

      +Giacomo Paccagnan yeah, esp8266 is a great module but it eats power like crazy!

    • @tomtentp
      @tomtentp 8 лет назад +1

      +Giacomo Paccagnan Yes please!

    • @jannijland5490
      @jannijland5490 7 лет назад

      Giacomo Paccagnan

    • @HoldYourSeahorses
      @HoldYourSeahorses 4 года назад +1

      Yes

  • @erikw8644
    @erikw8644 5 лет назад

    Thanks a million Kevin! I was working on a project running a battery and just need to check a sensor every hour or so. There are no clear guides anywhere to what you have figured out. This tutorial has made my project really to the next level! I subscribed as well. Awsome job!!!

  • @Maclman1
    @Maclman1 8 лет назад +4

    I like the content! keep stuff like this coming, especially episodes like this, with a look into a technique or something, but no project. very nice videos

  • @dgramop
    @dgramop 5 лет назад

    This saved me what could have been a while going through the datasheet and testing various methods. Kudos!

  • @thezerocool22
    @thezerocool22 4 года назад

    Really appreciate the way you make your videos, the speed of presentation, and the content you choose. One of my favourite channels.
    As an idea for an extension video, I wondered about using a 555 timer with a really long repeat, hourly maybe, as the watchdog to interrupt and wake up a deep sleep arduino instead of a RTC.

  • @scolic03
    @scolic03 8 лет назад

    This sort of tutorial was long overdue! Great tutorial, really well explained.

  • @amitdogra9054
    @amitdogra9054 3 года назад

    Probably the best video I've seen on this topic. Thank you very much Kevin.

  • @appatula
    @appatula 7 лет назад

    Some no nonsense power saving, very clever stuff man...Kudos! Very informative will surely implement in a future battery sourced project. If there is one thing that is always in high in use and low in supply it is always going to be power nowadays, used to be the memory/time trade-off. This goes deep into a philosophical EE argument to be made, it seems saving power has become a much larger global problem and it is great to see people like you aware of this, implementing and being pragmatic about ways to improve that consumption of power we Americans forget to bother about. ;-)

  • @daniloespinozapino4865
    @daniloespinozapino4865 7 лет назад +2

    thanks for taking the time to explain this so well, awesome tutorial man, keep the hardwork :)

  • @nodirbekchoriev1763
    @nodirbekchoriev1763 4 года назад

    20:40 those 16 seconds were quite accurate because you started the timer just after led goes off.
    Great video by the way!

  • @martynasmirauskas6977
    @martynasmirauskas6977 8 лет назад +23

    Hi Kevin. Could you make video on attiny series power saving and deep sleep. These micros are perfect for small projects using batteries. I use tinys whenever I can.
    Single 3V button cell project would be nice :)

    • @Autotrope
      @Autotrope 3 года назад +1

      FWIW attiny is similar enough to atmega328 that a lot of this transfers

  • @noahkunz635
    @noahkunz635 5 лет назад +1

    Absolutely great! No other video or any instruction helped me. Once I watched your video everything works perfect! And even with datasheet explanation! Awesome!!!!
    Greetings from Germany ;)

  • @kent1026
    @kent1026 Месяц назад

    still a great video after 8 years. i am learning to code a Attiny right now. i learned how to disable BOD by software and ADC in this video!

  • @IsaacC20
    @IsaacC20 8 лет назад +1

    Thanks for the tutorial! I didn't know those registers were simply keywords that you can use in the Arduino code in conjunction with the bit operations.

  • @AndrewBoktor
    @AndrewBoktor 7 лет назад

    Great video man. Thanks for going the extra mile and going over every bit and not just showing 1 or 2 things :)

  • @3vi14n931
    @3vi14n931 8 лет назад +1

    Liked and subbed, Great video Kevin, I really love the way you explain things. I have been using arduino for years now but have always hit a brick wall when it comes to assembly and modifying MCU bits. I just learned more about it in 25 minutes then the past three years. Bravo!

  • @KommaAchtKommaEins
    @KommaAchtKommaEins 5 лет назад +4

    1 mA is too much. We need to go deeper. :) I love it.

  • @Johncoffee2002
    @Johncoffee2002 5 лет назад

    This was just a awesome presentation of power saving possibilities. Exactly what I needed. I'm running a 328P-PU on the internal 8 MHz and the power savings in sleep mode are even mire dramatic: on my digital multimeter I measure 0.1 micro amps when sleeping! This is even lower than your 0.368 micro amps you measured. Thanks again for your detailed explanations. They were perfect!

    • @Johncoffee2002
      @Johncoffee2002 5 лет назад

      I have a interesting phenomena after increasing the watchdog counter in the for loop to 20 (to get 20x8"sleep) --> It's not possible to wake up the 328 with the interrupt button, unless I press the button multiple times (up to 19 times!). What is the mechanism behind?

    • @Johncoffee2002
      @Johncoffee2002 5 лет назад

      Problem solved. Counter variable ‚i‘ needs to be declared globally and set to 76 in the interrupt service routine to get out of the ‚for‘ loop :-)

  • @garthhowe297
    @garthhowe297 8 лет назад

    Wow Kevin, you really put a lot of work into this. Thank you very much for your efforts.

  • @refusneant
    @refusneant 6 лет назад

    very good presentation from datasheet to real ...perfect

  • @richardp4548
    @richardp4548 3 года назад

    Well put together video with explanation. I'm using a Pmos latch circuit to wake up the whole thing, but then found I could use a Cmos 555 dual timer to do the same thing at less cost and power for a simple project. Uses nothing in the off state. Would like to see some power harvesting projects in this series.

  • @TimothyAttewell
    @TimothyAttewell 2 года назад

    This is... wildly helpful. Thank you!

  • @rbraddy2
    @rbraddy2 6 лет назад

    Tremendous video! Exactly what I needed to give me the confidence to use Arduino in a low power project. Thank you!

  • @SergioIO79
    @SergioIO79 8 лет назад

    Great tutorial Kevin! best one I have seen about sleep functionality. thanks

  • @VolthausLabElectronics
    @VolthausLabElectronics 8 лет назад

    I really enjoyed this video. I loaded the code provided from the link onto an Arduino
    Uno clone and the setting of all the pins to output dropped the measured current used by the Arduino to 11.44mA when the LED was off. For reference when the basic Blink code was running the measured current used by the Arduino when LED was off was 21.72mA. So that alone cut the current usage in half. Brilliant! Really a smart thing to do. Lesson learned. Thanks Kevin. I'll drop a few bucks in the tip jar..

  • @techtalks_India
    @techtalks_India 6 лет назад

    oh god!!!! i was searching for this concept for about a month....great explanation...just amazing...definitely great work #Thumbs up.

  • @geoninja8971
    @geoninja8971 5 лет назад

    Very good. Half way through, bookmarked, because I'll need to watch this a few times.....

  • @steveshaw259
    @steveshaw259 8 лет назад

    Great work Kevin - really clear and straight forward. I particularly like the methodical way you step through this develop the improvements. Would be great to see the differences when applied to the ESP8266

  • @delcogoblin
    @delcogoblin 3 месяца назад

    Exactly what I was looking for, thank you!

  • @psullivan40
    @psullivan40 8 лет назад

    Ha ha, I love the last minute "Oh, you know what...you need this last bit of code to make this whole thing work". Kinda like "Lost".."oh, you know what..you have to type in these numbers then press "execute" every 108 minutes to discharge any electromagnetic buildup, continually averting worldwide catastrophe." "oh, thanks for the boat, c-ya". All kidding aside, love the videos.

  • @sumeryamaner
    @sumeryamaner 4 года назад

    Let's say I am using a standalona ATmega328 chip instead of an Arduino module. When programming this chip using Arduino IDE I have the choice to switch OFF the BODS. In such a case, do I need to use your code to disabel the BODS?

  • @brentsimpson3791
    @brentsimpson3791 6 лет назад +1

    Thank you for a very informative tutorial. It helped me heaps!
    Please keep it up.

  • @LC1492
    @LC1492 6 лет назад

    Thanks man! The best tutorial I've ever seen

  • @Ritzz45
    @Ritzz45 7 лет назад

    I'm looking for a DMM and looked at the price of yours which knocked me back a bit lol
    Also thank you for making videos, I always type your name in followed by what I want to learn about because there is always a video!

  • @nrdesign1991
    @nrdesign1991 5 лет назад

    Re-visiting this video. I can't seem to get the power consumption lower than 200µA with the provided code. Poking around with further PRR modifications brought me down to 112µA, but still nowhere near thelow level you got. Could it be a counterfeit part?

  • @HariWiguna
    @HariWiguna 8 лет назад +1

    Wow! The current "consumption" (if you could call it that) after you disabled the Brown Out Detection is INSANE! Thank you for sharing this Kevin!
    BTW, how come you're still able to upload new sketches after you put the Arduino in the various sleep modes? Is it possible to brick the ATMega by putting it into a "coma"?

    • @Kevindarrah
      @Kevindarrah  8 лет назад +4

      +Hari Wiluna thanks! the programmer first sends a reset pulse to the arduino, that of course wakes it up.

    • @HariWiguna
      @HariWiguna 8 лет назад +1

      So, there is no danger of bricking the ATMega. Reset always brings it back. Phew... Thanks Kevin!

    • @Kevindarrah
      @Kevindarrah  8 лет назад

      ***** yea, thanks for mentioning this. Reminds me how you can flip that bit on the PICs that locks them out from being able to be programmed again

  • @ayush-agarwal
    @ayush-agarwal 8 лет назад

    This is really good stuff. Thank you kevin for coming up with such awesome contents. I am actually working on a project in which i really tied up with the battery power consumption, this video is really gonna help me out.
    Thank again. :)

  • @TheQuasarman
    @TheQuasarman 4 года назад

    Excellent video Kevin, very clear. Many thanks.

  • @onurolce7389
    @onurolce7389 8 лет назад

    This is absolutely perfect video Kevin, thank you so much !

  • @lovshrm24
    @lovshrm24 5 лет назад

    I tried your code with adruino nano v3.0. it went down to 5.5 milliamp from 20 milliamp after removing power LED but I could not get it down to microamps. may be we need different code. can I get any help about that? thanks in advance

  • @brainstormabc
    @brainstormabc 4 года назад

    Thanks Kevin for this excellent video !!!!!

  • @andrea6769-h5i
    @andrea6769-h5i 3 года назад

    for my expert i am using atmega328. I need to put it in sleep mode keeping only timer 2, together with qurzo 32768 on pins 9-10, active to continue counting the hour. which sleep mode could i use? Is there anything else that would remain attractive that I could deactivate? thank you very much

  • @honumoorea873
    @honumoorea873 5 лет назад +1

    Good job buddy, in off grid... every bit of saving is welcome..! 😊

  • @pivot947
    @pivot947 3 года назад

    Man, you are the best! Thank you so much! greetings from Colombia!

  • @TeslaMaxwell
    @TeslaMaxwell 8 лет назад

    Wow, just wow. lots of info packed in this video. Thanks a lot.

  • @kwissiekwissie
    @kwissiekwissie Год назад

    WOW! explanation in GREAT depth. Liked it enormously. even if I just understood 10% of it 🙂

  • @paulbendel
    @paulbendel 8 лет назад +2

    Thanks Kevin I am combining your ESP8266 to database data and your DS18B20 projects for wifi grain bin temperature monitoring (spoilage prevention) and low power modes on ESP8266 might also be ideal

  • @PococraftOrg
    @PococraftOrg 8 лет назад

    Still here SHOCKINGLY!
    No, I really enjoy the content you put out!
    It's very informative and professional.
    I don't have enough funds to support you on Patreon, although I have disabled my Adblocker.

  • @abcdefghijklmnopr
    @abcdefghijklmnopr 6 лет назад

    Hi there :) Is it possible to cut power supply outputs during the sleep? Because I have couple of sensors plus communication modules and they are drawing power even when arduino is sleeping. Some of them requires 3.3 V power supply and I cant use any of digital pins from arduino

  • @AlienRelics
    @AlienRelics 3 года назад

    Correction, I think. At 11:38 you said digital pin 3. I can see that is physically the 4th pin, which from looking at the datasheet int0 is on physical pin 4 on the DIP 328, which is digital pin 2 aka PD2. Perhaps you mistakenly started counting from 1?
    Still an awesome video!

  • @saulruelas8397
    @saulruelas8397 8 лет назад

    @Kevin Darrah Hi Kevin! Awesome and very useful video! I had a quick question regarding interrupts. I was wondering when you put the arduino to sleep do you know if the void loop function stops looping? Hence saving power?

  • @josemotta
    @josemotta 4 года назад

    Thanks, Kevin! This is definitely a great deep sleep tutorial for battery-powered Arduino projects. I was wondering if a bootloader was used to change the code between each part or you used an external programmer. I presume that communication with the micro host after sleep mode is activated is not possible, isn't?

  • @Get-off-my-lawn-00
    @Get-off-my-lawn-00 5 лет назад

    This is a fantastic tutorial. Thank you for posting!

  • @DRI1966
    @DRI1966 3 года назад

    Thank You for this video, this is what I was looking for.

  • @bgable7707
    @bgable7707 4 года назад

    How does the function pinMode(i, OUTPUT); set a pin to HIGH or LOW. I thought you needed to call the digitalWrite(pinNum, HIGH/LOW) to accomplish this. How would I set it LOW?

  • @cesarp6761
    @cesarp6761 8 лет назад

    awesome video!! It motivates me to learn more about this assembly setting and try to get more out of the datasheets (it has being always like ready ancient code non-sense)

  • @ianturner2229
    @ianturner2229 7 лет назад

    Well done Kevin, a very well explained and documented tutoral, I have learned a gret deal from your video and in fact have now written my own library to "sleepState" to allow me to implement these great power saving ideas

  • @aamerhamdani
    @aamerhamdani Год назад

    Absolutely amazing. Your content is superior. Thanks

  • @DanielTorres-ms9xn
    @DanielTorres-ms9xn 3 года назад

    Hey dude! Your video was very helpful to me! Thanks

  • @4.0.4
    @4.0.4 7 лет назад +1

    0.0000003 Amps...
    That's f****** mind-blowing!

  • @TrungNguyen-sh7qx
    @TrungNguyen-sh7qx 6 лет назад

    Hi Kevin. I really impressive by the project you have done.
    I would like to have some advice from you if possible. I'm working on low power project. I could not find the ATmega328P library to boot loader and upload the sketch. I select Arduino Uno but not working.Tks

  • @ynocoolnamesleft
    @ynocoolnamesleft 5 лет назад

    thanks a lot i had no clue what i was doing and was explained really clearly

  • @mightycpa
    @mightycpa 7 лет назад

    Hi Kevin, thanks for this video, it really helped me for my little project. I do have a question. You include a button to wake up the chip, but I noticed that you didn't use the assembler command sei for "Global Interrupt Enable" at 3:55 in your video. Why is this not needed? Or is yours already enabled? Thanks again.

  • @goodwill7643
    @goodwill7643 5 лет назад

    Great job, I was struggling with getting from 60uA to 1uA. And it was just BOD monitoring. Thank you.

  • @AL1977CHE
    @AL1977CHE 6 лет назад

    Hi Kevin, great stuff!! I tried uploading the code on PlatformIO but received a compilation error stating "src\main.cpp:16:22: error: 'digitalInterrupt' was not declared in this scope" the code worked perfectly in Arduino 1.8.5 though.... any suggestions why I see this on PlatformIO? thanks in advance

  • @BrentBlueAllen
    @BrentBlueAllen 8 лет назад

    Nice video, Kevin. I started experimenting with power reduction a few weeks ago with an ATTiny 84 powered IR remote. I found the power reduction register helpful for turning off unused peripherals. I was wondering: why do you use the arduino IDE over atmel studio or some other IDE? For simplicity/speed/familiarity? To reach a wider audience?

  • @youpattube1
    @youpattube1 4 года назад

    Thanks Kevin -
    Very helpful.

  • @philbx1
    @philbx1 8 лет назад

    Hi Kevin, that was a very comprehensive video and I think you covered the lot!
    I just wish the Atmel guys had done a video like this in the past as I had no idea of which low power options to use.
    Maybe they were 'interrupted' too much to do anything else apart from datasheets :-)
    I wish I could afford some test gear (and time) to check batteries, but assume if 4 x AA alkalines were used, and without waking the MCU that they would
    last at least a year (maybe).
    Thanks much again for your great explanation and effort in sharing this!

  • @pildimir
    @pildimir 4 года назад

    You do not making the pins state in the for loop. You do not need the INPUT low state for lower consumption?

  • @martin128
    @martin128 8 лет назад

    Thanks, this was just what I needed for my data logger project!

  • @dbuezas
    @dbuezas 3 года назад

    Kevin: don't worry, we won't use any library
    Me: now I worry

  • @billglass5160
    @billglass5160 3 года назад

    Very interesting. I like your approach to the problem. Simple, direct, and effective. Thank you. I will surely use your method for a small project I have in mind.

    • @billglass5160
      @billglass5160 3 года назад

      Hey, it works like a champ! Made a 2nd remote control for my Mitsubishi AC so I don't have to go upstairs to turn it ON/OFF everytime I return/leave the house. 1 ATmega328P(8MHZ no caps, crystals), 1 IRLed, 1 3V coincell battery, a pushbutton switch and a little bit of code. Saved me $75. I was unable to measure the LOWLOW sleep current with my multimeter! THANX!

  • @notionSunday
    @notionSunday 8 лет назад

    Kevin if you catch it early, you can use RUclips's vid editor to chop out the bit you don't want(click your icon/creater studio/create/video editor). Then you don't have to re-upload - It will publish a new vid.

  • @sathishgunasekaran3227
    @sathishgunasekaran3227 8 лет назад

    Thanks...this cleared me lots of doubts

  • @bascelik91
    @bascelik91 6 лет назад

    awesome, please make more tutorials about timers, interrupts (time and hardware)!

  • @deepakkoirala2296
    @deepakkoirala2296 9 месяцев назад

    Is the watch dog timer max is 8 Seconds or 16 seconds ? Can we loop to 3 to get 8 x 3 = 24 seconds ?

  • @SiteZbulim
    @SiteZbulim 4 года назад

    Great video! Exactly what I needed, Thank you.

  • @zevik84
    @zevik84 6 лет назад

    Hi,
    can you please write which electronic components you used (beside the ATMEGA) for the setup?
    Thanks

  • @youpattube1
    @youpattube1 6 лет назад

    Kevin -Over the last year or so I have watched this video about 6 times. It is a subject I am interested in, and you did a good job explaining and presenting it. I looked thru your low power playlist and I don't see anything about using an attiny. Would this yield an even lower current consumption and still allow a wake up interrupt and an external interrupt ?

  • @christofgluckler3690
    @christofgluckler3690 7 лет назад

    Hey Kevin thanks a lot for the video, learnd a lot.

  • @Razorrule
    @Razorrule 8 лет назад

    how 'low' can i go, when i plan to wake up the ATMega via Serial input?
    i want to control something on PC via an VB.Net Program over serial converter

  • @ejkitchen
    @ejkitchen 8 лет назад

    Awesome video! Very well made. Thank you.

  • @cosscat
    @cosscat 6 лет назад

    very nice, really hard work. Congrats for sharing :)

  • @derboki88
    @derboki88 5 лет назад

    i'm not entirely sure why, but for me the for loop just doesn't do anything. no matter what i put in there, it always just resets after ~8 seconds. what could the problem be?

  • @madtenors
    @madtenors 8 лет назад

    Kevin, my programming experience is mainly in assembly, so forgive me if my question is odd. I've never set registers manually in Arduino IDE, so why not manually set the reigsters in assembly code if you can use inline assembly? From what I remember, it wasn't as tricky to just write %10000000 to the register's address to set bit Seven, or %01100000 to set bits 5 and 6 simultaneously. That or use BSET or BCLR. Do you have a tutorial for doing this kind of thing in C++ or in Arduino IDE? I'd like to understand a litter better. Thanks!

  • @tejasarlimatti8420
    @tejasarlimatti8420 7 лет назад

    thank you so much for making these happen man

  • @GeekRedux
    @GeekRedux 6 лет назад +12

    Why use the assembly commands instead of the C commands?

    • @typingcat
      @typingcat 4 года назад +1

      Because it's cool.

    • @RandomPerson494-12c
      @RandomPerson494-12c 4 года назад +2

      Because it runs faster and consumes less memory :)

  • @algre977
    @algre977 3 года назад

    Do you get similar results with ATMEGA328P (no -PU) ?

  • @ahmedbashar1807
    @ahmedbashar1807 6 лет назад

    Excuse me, sir, I would like to get sleep mode code of ATMega 328P code that goes to sleep and wake up depending on a timer, not external switch.Thanks a lot