#116

แชร์
ฝัง
  • เผยแพร่เมื่อ 19 พ.ค. 2024
  • Savings battery power on the Arduino is a non-starter, as the board just consumes too much power, even when the ATmega328P chip is in Deep Sleep.
    That notwithstanding here's an alternative method to bringing the chip out of sleep mode that is probably more useful than that described in video #15 which used switches.
    And we get to see how much current a bare-bones Arduino consumes (spoiler alert: next to nothing!) - perfect for battery use.
    ---
    Also, have a look at Thijs Ruiter's Kickstarter campaign - if he reaches his goal I'll do a proper review of his sound module:
    kck.st/2M2KeRr
    ---
    All links, sketches and other information:
    github.com/RalphBacon/Arduino...
    The 18650 Battery Charge Shield:
    www.aliexpress.com/item/ESP32...
    The official ATmega28P data sheet:
    ww1.microchip.com/downloads/en...
    The FP6298 PWM converter datasheet:
    www.feeling-tech.com.tw/km-mas...
    Arduino pin mapping (GPIO numbers vs Chip numbers):
    www.arduino.cc/en/Hacking/Pin...
    ---
    If you like this video please give it a thumbs up, share it and if you're not already subscribed please consider doing so :)
    My channel and blog are here:
    ------------------------------------------------------------------
    / ralphbacon
    ralphbacon.blog
    ------------------------------------------------------------------
  • วิทยาศาสตร์และเทคโนโลยี

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

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

    You really do take this to the next level, great video.

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

      Nice of you to say, ifell3, glad you liked it, thanks for posting.

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

    Helpful, informative & useful. Thanks for sharing!

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

      You are most welcome Springwood Cottage, I'm glad you like the video. Nice to hear from you.

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

    I Like the videos - the length is OK by me :) Keep them coming great work!

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

      Thanks for your post, Arye Guetta, good to hear from you.

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

    Thank you for the details!

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

    Great content and these two were just the right length IMO, any shorter and important details would have been skipped I think. Keep up the great work.

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

      Glad you enjoyed it!

  • @BGLENN-dp4tx
    @BGLENN-dp4tx 4 ปีที่แล้ว +2

    Great video. Thank you.

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

      Thanks for your post, B. GLENN, good to hear from you.

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

    I enjoy that you do thorough videos, and I think the current balance is pretty close to ideal. If I am following along at home I dont have to search for missing details, or otherwise "faff about" as you might say. If you feel the pressure to cut too keenly, I might recommend creating a "Ralph Bacon Shorts" series (notice how free I am with your time), where you trim the same video down to the barest of essentials.

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

      So you want me to edit my video raw material _twice_ , Kent, is that right? Actually, I like the idea of constructing a 5-minute (yes, 5-minute) look-at-what-you-could-have-watched style teaser. I'm wondering how much work that would actually be. Hmm, I shall consider... and maybe experiment with video #118 (as video #117 is already queued up ready for release, too late for that one). Thanks for the idea and being so free with my time!

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

      I'm glad to receive what ever you offer, I prefer the videos as you do them now vs. a less thorough shorter format. I'll keep watching either way. I think you summed up what I was trying to say better than I did.

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

    Great video. Thanks.

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

      Glad you liked it!

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

    Thx for shareing this information with the world!
    That helped me to bring down the power consumtion for a central locking control unit replacement, for my old BMW to 3,5mA using an Arduino Nano.
    If i have enough time i try to convert this replacement project to a attiny and see how low this thing can go! 😏

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

      Experimentation is sometimes the only way to see if it's going to work!

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

      Did you have to flash a new boot loader? My nano went into an infinite boot loop and I read that you have to use another boot loader forum.arduino.cc/index.php?topic=513120.0

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

    Nice video. I was going to ask what the capacitor values were on the "naked" bread board but then you mentioned a future video will cover. Hard for me to duplicate and experiment with if I don't know what those values are. I am new enough to the details to just get me into trouble. More often than not I release the magic smoke.
    Keep up the great work!

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

      A video is queued up and ready to go, but I don't think I'm giving anything away by telling you, Joe, the small caps next to the 16Mhz crystal are 22pf and the one by pin 1 (used to reset the device) is 0.01µF. But I explain this in more detail in forthcoming video #117, so you may want to watch that first. Since that video, I've experimented with the ATmega328P's on-board 8Mhz oscillator as well as the ESP8266 --- but that _is_ giving too much away!

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

    Hey! This is really good. Thx.

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

      Thanks for your post, 4FunRC, good to hear from you.

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

    Thanks. Very interesting video.

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

      Thanks for your post, Bruce Peterson, good to hear from you.

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

    Very good video! :)

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

      You are most welcome Vinicius, I'm glad you like the video. Nice to hear from you.

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

    seriously, love the vid and as for "naked Arduino" Julian got it down to chip and LED only !...…...he broke all the rules !

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

      Yes, Andy, he did break the rules as the timers (millis, delay) no longer work the way you expect! But I guess there are tradeoffs to running at a lower frequency.

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

    Nice vid. I saw the use of a watchdog timer on a channel called SuperHouseTV (hope ok to reference). He basically automated his whole house using arduino's. But he used it in case of a power cut. To give everything time to wake up. But yeah, love your channel.

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

      I saw a video of him (of SuperHouseTV) going to the Sonoff factory in China, Dave, that was a looong video too but very watchable. Using this project to protect against power cuts is something I either have already mentioned or will do so in video #117, it's an easy thing to do, depending on the criticality of the system being protected, of course. Thanks for posting.

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

      Sorry if you did mention past hence. I'm fairly new to your channel. Only just getting into arduino's. Some of it is beyond me. But learning so much and getting more understandable. Best of all i'm learning to code a little. I've found the hobby i'm looking for. Once again many thx.

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

      You're most welcome, Dave, and I hope you enjoy the Arduinite ride. It can be frustrating at times, but it's all a learning experience and success tastes all the sweeter because of the hurdles we must sometimes overcome. If you haven't already subscribed you might consider doing so, if only to be advised on new videos (sort of weekly). Thanks for posting.

  • @abdellahsendjasni
    @abdellahsendjasni 7 วันที่ผ่านมา

    thanks, i hope this one works for my project

    • @RalphBacon
      @RalphBacon  3 วันที่ผ่านมา

      I hope so too!

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

    For what it's worth, the ICM7555 (CMOS timer chip) uses 60uA and claims to provide timing periods into hours... One wonders if it could trigger the microcontroller to wake-up, say, once every 30min. There may be other long-period timers that can do better. And, certainly, other microcontroller programming methods to maximize power savings must exist.

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

      Wait until I cover the braindead ESP8266/ESP32 and you will see how your idea has more merit than you might imagine! Shhh, Are, no more spoilers!

    • @BGLENN-dp4tx
      @BGLENN-dp4tx 4 ปีที่แล้ว

      Great insight and to answer you directly, YES you can trigger wakeup with the CMOS and other versions of the 555 timer. It's very simple and there is much information on the topic already available.

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

    Very cool video!! Would love to have an IoT teacher at my school that is at least half as good as you at explaining things.

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

      Wow, thanks! Perhaps I should have been a teacher (nearly was, actually). Thanks for posting!

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

    Very good

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

      Thanks for that, Ed19601, nice to hear from you.

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

    Love the videos. I saw one of your videos where you use a Lipo with the brand ultrafire which is what happened a few houses away where a lipo battery caused a house to burn to the ground. I am using NiMa batteries they are easier for me

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

      Oh wow! Yes, some LiPo batteries from dubious sources have to be treated with respect/suspicion, or do you what you have done!

    • @davidmarks509
      @davidmarks509 3 หลายเดือนก่อน +1

      Yes they do but what a good name for them ultrafire which happened to some persons house a street away from me. They said it was a lipo fire could of been from a laptop or some RC thing. NI MA for me no house burning involved. :)

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

    I find a combination of both videos to be very useful!!
    My application: mailbox delivery notification:
    input switch -> wake up interrupt -> sendWirelessMessage("Mailbox alert!")
    max timer -> count X hours -> sendWirelessMessage("mailbox guard alive")
    master unit -> replyWirelessMessage( CONFIRMED ; request_X(number) )

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

      Sounds very do-able Thorbjorn. What processor would you use to send the message? An ESPXXX? Or use a network card with an Arduino?

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

      @@RalphBacon the project is still in the early phase, just collecting ideas. I want long life on battery.
      It seems like the ESP8266 has potential for low deep sleep power.
      I am a bit confused about how to wire a switch and the internal WAKE signal to RST, then know if it was switch or timer.
      I am open to to any suggestions on other purpose fit controllers. I also thought about possibly a controller to handle the main tasks with switch and timer interrupt in deep sleep, then power on the wireless controller on demand, but it seems like the ESP8266 has potential for pretty low deep sleep power by itself.
      The other significant decision is for lid switch detection.
      Shoul be weather proof all year: sunny, rainy, snowy, icy, or windy.

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

    Nice video, please try the 8Mhz setup @3V. What is the difference about the power consumption?

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

      I'll have a go, Istvan, and report back in a future video. Without a doubt, it should reduce consumption again. Thanks for the nudge.

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

    If I've got my maths right then assuming an average 25uA drain, then that 2200mAH battery should last almost exactly 10 years (if it were perfect!). I recently watched a video of someone (can't remember who) who ran a similar circuit off a 3V coin cell, and that ran for well over a year, which makes sense as a CR3032 has a capacity of 220maH.

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

      You're doubtless correct, slm60uk, as I too have come to the conclusion that the flashing LED circuit I now have sitting in the corner of my workshop is never going to stop before the universe itself ends, so I am going to wire up a tiny 100mAH battery and see how long that lasts! Hopefully not so long before the next update...

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

    Naked AVR?? ATMega porn?
    Brilliant vid, Ralph
    At risk of pre-empting part 3, further savings (for a micro doing some actual work, when not asleep) can be made by reducing the frequency of operation. This has the added advantage of not needing the crystal and oscillator circuitry and stable operation at lower voltages.

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

      Michael Keegan Yes 8MHz, and you do not need the crystal.

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

      Yes, I think I mention in one of the three videos (#117 not yet released) about reducing the clock rate to run on a lower voltage (down to 1.8v) but I think I was at that point thinking I was milking the topic just a tad. I also didn't cover running on the internal clock as that required a (minor) bootload change which, when you see my next video, has been covered enough! Running at anything other than 16Mhz means that all timers run incorrectly so I didn't want to get into that. Who would have thought that there was so much to cover?

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

      PS I am not allowed to use the n-word here as TH-cam flags it up and blacklists my video! I think even "bare" is pushing it ;-)

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

    Hi got a software problem for you and benny to mull over:
    if (heat > too much & andycantsleep = TRUE){
    drink Guinness}
    else {
    andy = deepsleepmode }
    Interrupt = don't ;
    }
    }
    this does not work any thoughts ?...…………..thanks in advance

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

      You forgot the double "=" on the first line, == TRUE, no wonder it doesn't work! Also, you misspelled Murphy as Guinness!
      I asked Benny, and he just looked at me weirdly in a "can't sleep? What on earth does that mean", and he then back to do-not-disturb mode. Hope this helps.

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

    Hi Ralph. Long time ago I know, but why use a volatile char for the sleepcnt variable?
    I'm just going to use your sleep code for a project and a bit confused by this. Cheers. Matt.

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

      Good question!
      All the "volatile" bit does is to ensure that the variable value is retrieved from its memory location rather than relying on a register value that previously held that value. No harm done (other than a few microseconds of time to retrieve the value).
      However, as the Arduino retains its memory across Deep Sleeps you are safe to remove that attribute.
      Note that on _an ESP32_ a variable _must_ be decorated with the RTC_DATA_ATTR attribute as we store any variables we want to retain across Deep Sleep in the RTC memory. Then no special precautions are required when updating it.

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

      Thanks Ralph. Sorry, I wasn't specific. Why a char variable?
      I understand the volatile bit and also the requirements for an ESP32.
      I've had this sleep code (with my oen function) running flawlessly for two days now, but just didn't really grasp why you used a char and not a byte for example.
      I haven't changed the variable type but maybe I will just to see what happens!
      Cheers as always.
      Matt

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

      A "byte" is a made-up variable type not commonly used elsewhere; it is the exact equivalent to a uint8_t (single byte unsigned integer) in C++. I personally would not use this data type as it does not describe the data in any way at all.
      A "char" is the equivalent of an int8_t (single byte signed integer), usually.
      Which one you use shows your intent; did you expect a small integer returned or an actual character such as 'b'?
      Any single byte type can hold up to 255 in value, but that may be interpreted as a negative number if you use char, so could represent -128 to +127 if the first bit in the byte is set.
      Confused? You should be!

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

    Hi Ralph, I noticed you were able to order components from AliExpress, but I get the 'not shipping to your region' dialog. Do you have a way of being able to order stuff from them? Any advice would be greatfully recieved😊

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

      Your username includes "Glasgow" so if you have chosen United Kingdom as the destination it will be fine (I've had several dozen parcels from them). Look at the top right of the page where your currency / region are and make the appropriate selections, otherwise it defaults to somewhere like Albania (the first country in the list). 😲

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

      Hi Ralph, OK, resolved it by creating another account, so something went wrong in my original account setup. All resolved and good to go. Thanks for your help Ralph. Cheers
      Chris

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

    What piece of equipment is being used to measure such a low current?

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

      I'm using a UT803 multimeter by UNI-T, a well established brand with some high quality equipment.

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

    As an added reference, there is a LowPower library available to make this easier, so you can do "LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);" to sleep for 8s which is the max and then wake it back up, library is here github.com/rocketscream/Low-Power

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

      Very useful link, thanks for that.
      That said, It is always good to know _why_ and _what_ you are invoking the "long way" before using libraries (which is why I often do it the long way first, just to show my viewers what they are trying to achieve, before letting us all off the hook by using a library!)

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

      @@RalphBacon Agreed! thanks btw for a great video, got my "bare naked 328" going to sleep every 8s and checking millis() before doing some work. What is the meter you used to measure current btw? I need something similar as when I connect my generic multimeter (switched to mA) in series, the 328 doesn't come on for some reason even though it registers power being drawn...

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

      My current meter dongle came from Banggood but I've just ordered a different model (spooky coincidence!) because I wanted both voltage and current to be displayed simultaneously. It's this one:
      bit.ly/USB_Current_Monitor_Dual
      A bit more expensive (a couple of $) compared to my original one:
      www.banggood.com/KW-202-Digital-Display-USB-Portable-Tension-Tester-Voltmeter-Battery-Tester-Blue-p-1153997.html?p=FQ040729393382015118&
      but this one alternates between voltage and current which gets a bit irksome if you're just after current.

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

    hi, thank you for your video, it is very helpfull. i have a strange problem, if i set sleepcnt < 115 (approx. 15 minutes) everything works fine, but if i set < 150 or above it doesn't work and i want to set sleep time 35 minutes.. ( i am using aurdino nano btw)

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

      The maximum Deep Sleep RTC timer for the Arduino UNO and Nano is just 8 seconds so are you waking the Arduino using an external signal interrupt on GPIO pin D2 or D3?
      When I wanted a long Deep Sleep (power off), I counted how often the Arduino woke up ( in multiples of 8 seconds) and if less than the required time, immediately went back to sleep - it took just a few milliseconds to do all this. I wanted it to wake up after 1 minute so after 8 cycles of sleep/wake (8 secs * 8 wakes = 64 seconds) I continued with the code.
      Using an ESP32 it's quite different and you can Deep Sleep for up to 5 YEARS! because the RTC timer is a 64-bit counter not the tiny 8-bit counter in the Arduino.
      I can recommend Nick Gammon's article on all the various sleep states for the Arduino: www.gammon.com.au/forum/?id=11497

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

      @@RalphBacon i am trying your code (using wdt , thank you for sharing btw). i want it to sleep e.g. 40 minutes, so sleepCnt should be 40 * 60 / 8 = 300, right ? if i set sleepCnt > 120 code doesn't work (for me at least)

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

      Yes, 40 minutes is 40*60 seconds (2400) so divide by 8 second "chunks" of Deep Sleep should get your the required delay.
      If it "doesn't work" for you (a bit vague!) put a Serial.println in the code every time it comes out of Deep Sleep so you can find out _when_ it stops working.
      Make sure too, that you are not using short integers (uint8_t) for your maths as that will introduce truncation (255 max for a uint8_t aka short int).

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

      @@RalphBacon thank you for your detailed answer. but i didn't understand "Make sure too, that you are not using short integers (uint8_t) for your maths as that will introduce truncation (255 max for a uint8_t aka short int)."

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

      That means, in your sketch, use the 'int' type for numeric variables not the 'uint8_t' type because an integer can hold up to 32,000+ but a uint8_t only hold up to 255 which is not large enough for the maths you are doing here. Stick to 'int'.
      Any more news on what you mean by "doesn't work"?

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

    I'm kinda surprised by your results. A bare ATmega328P shouldn't draw more than only 4 uA in deep sleep. I do see that you have a pullup on the reset line that might explain the extra power draw? It has an internal (weak) pullup internally so it's not really needed.
    Also, you could go further into other power saving techniques such as lowering the frequency and the voltage. The ATmega328P draws significantly more power on 5 V compared to 3 V, in the order of 3-4 times. Lowering the frequency also have an impact, in the order of half the current. Just note that there is a maximum frequency the ATmega328P can run off a certain voltage, 16 MHz on 3V don't work so well.
    I have a board sitting beside me that I run off two AA batteries. It is a modified 8 Mhz Arduino Pro Mini, where I have removed the power regulator and the power LED. It has run for 2.5 years already, and the voltage level on the batteries is only marginally lower. I initially calculated a life time of +5 years, but it looks to be even better than that.

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

      And I'm impressed with your Arduino board running for 2.5 years on a couple of AA batteries. Running at a lower frequency is fine if you're then prepared for the millis() and delay() to take twice as long or are prepared to edit a file (eg boards.txt) or two to get it all back in line. I just took the easy path on this one! I'm shutting down that breadboard of mine and connecting a small 100mAH battery as the one I have will last forever. I'll also take out the pull-up resistor and see what difference that makes. Great information, Jonny, thanks for posting.

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

      Actually, if you select Arduino Pro Mini in the Arduino IDE, it adds a new sub menu where you can select between 3.3V, 8MHz and 5V, 16MHz (I did create my own board definition for a 12 MHz board I designed though).
      Note that you need to burn the bootloader that is made for the frequency as well, otherwise the serial speed is wrong and you can't upload sketches.

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

      I've got a board definition for an 8Mhz breadboard Arduino (from Arduino.cc themselves would you believe) so I'm playing about, er, doing in-depth analysis and research with that one. Perhaps a future video update?

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

      Just note that you can't use 115200 on Serial when running at 8MHz. I found that out the hard way, thus my need for a 12 MHz version. :-)

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

      Good to know, thanks for the heads up.

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

    Why is
    MCUCR = bit (BODS) | bit (BODSE);
    MCUCR = bit (BODS);
    not used in the timer example? Can i use it and where in the code?

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

      Because I don't have Brown Out enabled! It's a bit of a nuisance whilst developing so I usually set the fuse to turn it off entirely. If you do have it enabled (and must therefore execute those lines of code) do it immediately before sleep mode is invoked. I believe I have used this in some of my demos. Nick Gammon (no relation) is the guru of stuff like this, have a read of his site on this topic:
      www.gammon.com.au/forum/index.php?bbtopic_id=123
      A beautifully written site, chock full of essential Arduino information.

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

      @@RalphBacon thank you, your site is very interesting.

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

    Hey Ralph, can you tell me how can I change the time it takes to wake up the arduino?
    Can I even program it to wake up after an hour?

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

      Unfortunately, Stavros, if you are using the Watch Dog Timer (WDT) method then the Arduino will wake up after a *maximum* delay of 8 seconds. That doesn't sound a lot but your code can just increment the number of times it's been woken up and go straight back to sleep again. So for an hour that would be 3600 secs / 8 secs = 450 wake-ups.
      Alternatively, if you are using the interrupt method of wake up then you need something to provide a LOW pulse on pin 2 or 3 as per my demo. This can be a manual intervention (eg someone pushing a button connected to GND) or a DS3231 Real Time Clock (RTC) that you have previously set an alarm for, to wake up after an hour. At its simplest (and depending on how accurate you need it to be) an NE555 timer could be a solution too.
      I hope that helps but feel free to ask further questions!

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

      @@RalphBacon Thanks for the quick answer!
      Maybe I will get and RTC but for the time being can you please advise me how to set the alarm to 8 seconds?

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

      If you read this article and understand it you will be able to set your WDT to the maximum of 8 seconds. I hope this helps.
      folk.uio.no/jeanra/Microelectronics/ArduinoWatchdog.html

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

      @@RalphBacon Thanks for everything Ralph! You see, me and my brother are working on a project where will will measure the weight and temperature of beehives and we need that extra power. Thanks again, really appreciated.

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

      Finally, someone is using an Arduino for beehives and bees! Fantastic!

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

    Thanks (: How do you get it down to 20 mA? My arduino Uno is 3o mA with your code. It is powered by 5V (:

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

      I guess not all Arduino-style circuit boards are created equal. The LEDs, for example, on your board could consume much more current. To be honest, trying Deep Sleep on a full UNO board is never going to give you good results. Try following video #117 using a bare Arduino chip - then you'll see it's the same.

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

    Ralph,
    Here is a barebones ATmega 328 board that allows for selective inclusion of components
    www.bitsbox.co.uk/index.php?main_page=product_info&cPath=140_161_164&products_id=3297

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

      Looks nice, a bit wider than this other USA one: kevinrye.net/index_files/barebones_arduino.php assuming it's even available. I'm tempted by the bitsbox.co.uk version, perhaps I should negotiate an affiliate deal... Anyway, thanks for the info, interesting.