#115

แชร์
ฝัง
  • เผยแพร่เมื่อ 24 มิ.ย. 2018
  • Running an Arduino (Uno/Nano etc) is a general no-no because they consume too much power. But here we explore how to put the ATMEGA328P chip to sleep and then wake up again when a pin goes low (using an interrupt, generated with a switch).
    It's very easy to do and as a first stage in getting your Arduino to run on battery power, it's essential that you understand the simple commands that need to be executed.
    The power drops quite a bit, but is it enough to run on batteries?
    This video, #115, provides the groundwork to part two (video #116) in which a different approach is taken to wake up the ATMEGA328P and in which we show exactly how much power is taken up by a "bare-bones" Arduino - you'll be amazed.
    ---
    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
    ------------------------------------------------------------------
  • วิทยาศาสตร์และเทคโนโลยี

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

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

    Great stuff Ralph. In the past I have put attiny's to sleep. Makes a big difference in power indeed

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

      The ATTiny85 (for example) is a prime example of where power consumption could be critical - it's tiny (clue's in the name), easy to install, pretty powerful for an 8-pin chip. So, yes, Ed, I agree, this could make a big difference to someone wanting to run on battery power (or solar, with a rechargeable cell) for months on end. Thanks for posting.

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

    Brilliant, thanks for this...just what I'm looking for.

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

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

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

    Ralph, thanks for sharing your knowledge with us. Cristal clear your explanation.

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

      Glad it was helpful!

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

    this is so awesome!! seriously, really good. thanks for sharing.

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

      (by the way, have you ever tried posting these or sharing on projectboard.engineering.com/? ? i know their engineering community love these and would also love to contribute on top of the project. let me know if you end up taking a look or checking it out!)

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

      I wasn't familiar with this website, Naz N, so I took a very quick look, reminds me a bit of Pinterest. I'll see if it's worth posting there too (or at least putting a link to my TH-cam video there. Thanks for the heads-up, good to hear from you.

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

    Excellent! Love your new workshop!

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

      Thanks for your post, Jeffrey Melanson, good to hear from you.

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

    Thank you! You helped me a lot to put the CPU in deep sleep and wake up after a certain time.
    I have tried it a few times in different ways and that didn't work. Your video (and code!) was a good help to fix this problem.

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

      Glad I could help you, Raymond, thanks for posting, good to hear from you.

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

    Great video Ralph - look forward to the atmega328 alone version

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

      Indeed, Raad, I have finished filming it, have yet to video edit it all together but it's easy and, more importantly, shows just how simple an Arduino really is, at its root. It demystifies the "magic" around using an Arduino, I hope. Anyway, great to hear from you, now back to the video editing!

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

      same here. just saying

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

    Great video and useful information. Thanks

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

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

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

    Another great , informative video. Hope things are going wellwith your new direction. i'll check your blog.

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

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

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

    Imight have said this before but I'll do it again: there are probably a million Arduino, raspberry, ESP, electronics channels on TH-cam, but I find myself following only a few:
    Ralph's, Andreas Spiess, bigclive, Julian Ilet. All have a few things in common: hands on approach with good knowledgeable detail, not long-winded and pleasant voices. Yes, the latter important too, I noticed at my age I tend to skip videos that start with 'hey guys wassup!?'

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

      Hey, _wassup_ Ed? Oh damn, forget I ever said that! I had no idea that my dulcet tones were part of my channel's appeal but thank you nonetheless, I'm flattered and pleased that you like the content too. My ego duly stroked I shall return to editing my most recent video on a Bare Bones Arduino. Thanks for posting, nice to hear from you again.

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

      Ralph S Bacon oh well, u are forgiven. Anyway with a Barebones Arduino, consider a ceramic oscillator rather than a xtal, it saves 2 capacitors

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

      Yes, it does, Ed, but too late for that video. I used ceramic oscillators extensively in my PIC work but never for an Arduino, I wonder why it worked out like that? But I do mention that we can dispense with the Xtal and caps entirely in my Barebones video. Stay tuned, thanks for posting.

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

      It's really convenient when videos start with "hey guys wassup" because you can immediately close the video because the rest is probably not worth listening to.

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

      John Cherry very true

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

    Great tutorial thank you!

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

      Thanks, Rudi, nice to hear from you.

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

    Hello Ralph always great to be very detailed as many rush through and those trying to learn can’t keep up……..
    I have a query for you in regards to a geetech voice recognition module, is it possible to use a voice command to put the arduino into sleep mode then another voice command to wake it up? I have lights and a motor working by command but I would like to see if I can get it to put into sleep then wake up

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

      A voice command to put it to sleep would be pretty straightforward, Kev. The voice module sends the data via the serial interface (UART) to indicate to the Arduino that Command X has been received; the Arduino would detect that X means go to sleep and voila!
      Waking up is slightly more involved. The Arduino would wake up every X (milli) seconds, check whether any serial data (from the UART) was available and either stay awake and process it, or go back to sleep immediately. Perhaps once a second would be enough; on average it would only incur a 0.5 second delay between speaking and the Arduino responding (when asleep). The UART buffer could store the few bytes that indicate one of the 15 commands available, as it has a 64 byte buffer.
      You need to get the Arduino waking up every second first; flash an LED or something. Then you can connect the speech module and get the Arduino to read the serial data and process it (if there is any).

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

    thank you. really nice work!

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

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

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

    Good timing Sir, interrupt's are something I want to tackle, as I think there are a lot of applications where us Arduibaconites can really start to get a bit flashy, take our code up a level without getting above our pay grade to quickly, if ya no what I mean.

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

      Ha ha! I never heard that term before, Arduibaconites, I'll stick with Arduinite but it's flattering you would engineer such a term. This is easy stuff, Andy, and if you want to run an Arduino for months on end on a single Li-Po battery this is the way to do it. Thanks for posting.

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

    Great and informative video - would be great if you you could specify the switches used and show a wiring diagram

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

      I don't have a wiring diagram to hand but I'm building a circuit that will be using this technique so I will include one then, if you can wait that long. All in a new video.

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

    Hi, this is a really good tutorial, thank you for sharing. When I run your code I receive the messages on the Serial Monitor (Good night and I'm awake) but for example, the inbuilt LED (on pin 13) stays always ON. This makes me think that my board is not going actually into sleep. I was thinking that maybe I have to upload the library for in my sketch library? I couldn't find it online though, could you please advise? By the way, I'm a beginner on Arduino world, sorry if my question is a bit simplistic. Thank you very much!

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

      Hi Eduard, no worries, no question is a stupid (or simplistic) question! Yes, you need to include the line:
      #include
      This is, in fact, the first line of code in my demo sketch so I guess you didn't download that and try it out and must have missed it! Easily done. Try downloading it now and testing it out, it will take a minute, no more.

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

    Another great video, thank you.
    Just thinking back to your rf24 video, as I’m using that to get my head around those little modules. On the transmit side, can I put the chip to sleep and use the DHT22 as an interrupt, so that the data can then be sent, or will the receive rf24 keep searching for a signal.
    Hole I an making sense there.

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

      For the *master* (aka transmitter), Mike, you can put it to sleep, have it woken by an external stimulus (or timer) and then transmit the information. The receiver, however, *will* have to continually scan for transmissions as it has no way of figuring out when a data packet might arrive.
      In Real World applications, the master would be the remote sensor eg in a beehive that wakes up every 10 minutes and transmits the temperature. In sleep/standby the nRF26L01+ consumes _tiny_ amounts of current (µAmps or even nanoAmps), ideal for such an application. However, the receiver is assumed to be permanently running (eg from a power supply) so it doesn't miss any of the transmissions. It needs about 12mA when running and listening. Remember that unless you switch off the facility it will auto-acknowledge the master's transmission which means it does transmit a reply which requires about the same amount of current (a bit less actually!).
      Does this answer your question?

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

      Ralph S Bacon thats brilliant. It does answer my question, thank you. Just need to go and play now and figure that bit out. Now I know it’s possible, then I know I won’t be wasting my time.
      The ‘slave’ will be connected to mains power, although I’d considered having it battery powered but this confirms main power would be the better option.

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

      Glad I could help, Chris, and I have no idea why I called you Mike before. Busy day, that's my excuse!

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

      Ralph S Bacon haha no bother, I was going to let that pass by. And yes, very helpful but I’m yet to have a try so far.

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

    Nice project
    Thanks for sharing 😀👍
    The Andreas spiess way👍

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

      Glad you like the video, Asger, but who is this guy Andreas? Sounds Swiss, frankly, I bet the speaks with a Swiss accent too, am I right? I had no idea he copied my approach but that's OK, we are all one big happy family here!

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

    Hey. Thanks for the video
    I wonder to know where u connect the current measurement probe. Is that placed on +5V of arduino power wire?

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

      It's placed in series with the VCC wire, so all current is measured.

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

      @@RalphBacon okay. thanks. i'll try it

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

    YOU ARE FANTASTIC GOD BLESS YOU

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

      You are most welcome demetrios demetriou, I'm glad you like the videos. Nice to hear from you.

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

    Hello Ralph, I actually don't mind how long a video of yours is, the smallest detail might be the last piece in the puzzle for somebody out there, I actually enjoy them at the age of 43 i have plenty time to spare!

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

      In some ways, you have hit the nail on the head, Vasilis. "The Devil is in the Detail", as the saying goes. It's not very helpful to gloss over the details which are absolutely relevant to the video you're doing, so I don't gloss over much at all. As a last resort, viewers can speed up the video or hit the fast-forward button, right? But I must say I wish I could have said that I have plenty of time spare at age 43! Thanks for posting, keep tuned.

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

      Totally agree with you Vasilis, When you attend/watch something you are passionate about and like, time doesn't matter.

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

    Hi Ralph, I don’t suppose you’re going to do a similar video for the 328PB?
    I was using a Pro Mini, which I was putting into sleep mode and it was sleeping and consuming 190uA. Now I’m using a 328PB the lowest is 5mA. The rocket scream lib doesn’t work, although there is a fork for the pb but it doesn’t put as many things into sleep.
    Thanks

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

      I'm pretty sure that the 328PB is very similar to the 328P in terms of Deep Sleep current. I've just checked and it's 0.2µA without any clocks running. And 1.3µA with the RTC running. You need to disable a lot of things which I do explain in my Sleep videos (and disable them in the correct order).

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

      Ralph S Bacon Hello. Yes it is. I found an example on the AVR website which worked and gave me something like 20uA but my code skills haven’t allowed me to transfer that into my own code. I’ll sort it out at some point and I’ll rewatch your video. There is a fork of Rockscream lib which supports 328PB but it doesn’t reduce the current as much as the Rocketscream lib. Weird. I know. All the best and heal up.

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

    Watching this made me fall asleep lol

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

      Ha ha! As long as the Arduino went into Deep Sleep too that will be fine.

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

    hi sir, thank for this great video, the librairy avr/sleep.h isn't recognise in my Arduino code I tried to find it and upload it. I couldn't find it I found sleep.h dose it work?

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

      My sleep.h file is found in:
      C:\Program Files (x86)\Arduino\hardware\tools\avr\avr\include\avr
      and it is found when I type the #include .
      Try finding exactly where you are trying to pick the file up from and include that file with its full name initially (like the name above), then start removing bits from the left side of the name, eg remove c:\program files{x86), to see whether it still finds it. Note that the name must be in quotes if the name has spaces in it.

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

    Hi Mr Palph, I'm still struggling at waking up Arduino using capacitive sensing; where you touch a conductive material with 1M resistor as interrupt instead of a press button. Hope you can help on that..thanks!

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

      I'm not sure you can do that natively, Vest, with an Arduino (UNO, ie ATMega328P). The interrupt capable pin (so 2 or 3 on the ATMEGA328P) pin has to be driven LOW - it must be a proper digital signal. So don't use your finger to do this, use a proper capacitive touch switch to send the signal as I described here: th-cam.com/video/jhtY_Hn5jBM/w-d-xo.html - this works like a dream.

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

    Why do you not have the AREF (Pin 21) connected to the +5 rail? Also why are you using those 2 100nF caps across the power rails when many designs don't?

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

      AREF is, by default, always the VCC of the device (in this case 5v but others might be 3.3v). So unless you change it to another value (such as 1v, no connection is required).
      The 100nF caps across the two power supply rails are as per the datasheet. To ensure reliable running these need to be physically located very close to the actual pins. They ensure that any noise generated by one part of the circuit does not affect the other part (the two parts being Analog and Digital).
      I hope that clarifies things John, good questions.

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

    The link for ATmega28P data sheet seems to be broken... That battery module is pretty nifty! I dove into that particular rabbit hole a while back in a slightly different way, acquiring a number of battery holders, and two modules. One of them takes a USB micro input and connects to both a battery and a load, and there's protection on there for the battery -- it won't overcharge it and won't allow discharge too deep. The other one takes battery voltage (connecting to the "load" output of the first module) and provides +5V out on a USB connector, though I've also seen the same module without the connector. I bought ten of each, and after tearing apart a few laptop batteries now have more cells than I have hardware to handle them. I'm working on a DIY power bank for starters, we'll see where it goes from there.

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

      Sounds like you have power to spare, Roy. As long as the modules do protect the battery from over-charging and under-discharging that's fine (the ones I have seem to manage it, no problem). Keep going!

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

    Hello Ralph, I bought the 18650 Battery Charger Shield to briefly power an Arduino Nano in a remote location, but can only get the shield to output 1.26V out of the USB (same for 5V side outlets) (I get 1.34 V out of the 3V side outlets). I am using a fully charged 18650 Li-ion battery (4.2V) to power it. I looked at the specs of the shield on the Ali Express web page and see that it calls for 5-8V input voltage?? I thought this was a boost converter. How could the manufacturer expect the user to provide 5 - 8V out of a single cell 18650 battery? Any ideas of what I am missing? (I'm fairly new at this hobby). thanks.

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

      That doesn't sound right. My 18650 thingy (technical term) outputs 3v3 and 5v quite happily. It's one of these: s.click.aliexpress.com/e/_DdPUYTt
      I'm trying to see what you might be using but there are dozens of permutations. Got a link? You won't be able to paste it here (YT will zap your comment) but you can disguise it such as AliExpress dot item equals 12345 dot that etc.

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

      Thanks for offering to help. As you said, I bought a clone (specs are identical to yours). I figured out the problem. To get my clone to 'turn on', I must hook it up, briefly, as a battery charger (input 5V to it via the micro USB port). It then comes on and stays on, even when the 5V input is subsequently disconnected. Now I can continue your tutorial. Keep up the good work. I've learned a ton from you - THANKS! @@RalphBacon

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

    Are these available from Banggood? I don't have an Ali account so getting one from BG would be much easier for me. Thanks.

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

      Yes they are, Terry, here's a link: bit.ly/5vUPSArduino

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

      Thank you, Ralph.

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

    I can't believe you've got Arduino working with Eclipse. I was never able to do this despite trying many times. Would you have instructions to that you could link? Everything I've came accross has either not worked or had issues that I couldn't solve. Thanks!!

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

      It's a special version of Eclipse called Sloeber, no longer actively supported. eclipse.baeyens.it/
      However, you should consider the new (beta) Arduino IDE 2.0 as that is based on Eclipse Theia and seems quite nice (although still not as exposed as I would have liked).
      Or use PlatformIO (Visual Studio Code) which is even better than Eclipse and will be supported forever!

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

      @@RalphBacon Thank you for the reply. I've used Eclipse for coding c++ and java in the past, and I would've wanted to fully integrate avr and arduino support to it. However, I've been unable to do so with the normal version. There have been plugins in the marketplace for Arduino, but I've not been happy with the results (compiler, output problems). I'd like to program Arduino with very good control over what is being used so I could easily strip out all the unused functions from large libraries when working with tiny Arduinos with limited space.
      If you ever look into this, I would love to see an instructional video how to set that all up either with the now obsolete Sloeber or with a new, custom solution to any Eclipse version. Thank you very much and take care!

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

      Just an aside, you mention stripping out unused functions from libraries. The linker should do that for you. Although everything gets compiled, any unused function is automatically removed (or should be, depending on the optimisation level you have set). You can try it and see by including a large, unused library into the Blink sketch and compile with it #included or not - output file stays small.

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

    Arduino deep sleep is an interesting subject but by the end of a 24 minute video I struggled to stay focused.
    Great video otherwise, thank you Ralph!

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

      Strong coffee, with a break in the middle, always helps. How do you fancy a two-hour, Friday afternoon double seminar on German economics (in German)? Yup, I had to go through that barrier so come on, Georgij, take a deep breath and watch the next two videos with caffeine in your veins and a will to succeed! Heh heh! Thanks for posting, good to hear from you.

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

      Oh yes, coffee.. A magical drink that grants the undead ability to walk by day. :D
      A seminar on German economics (delivered in German) would probably require a whole kettle! Hehe

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

    what IDE do you use?? and if you have a video about it pls tell me :)

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

      You're probably referring to the Eclipse IDE, Beryllium version (contains Arduino add-in) version 4.2 and which can be found here: eclipse.baeyens.it - but be warned that if you have no experience of such an IDE it might be tricky to (a) get working and (b) recover from an error.
      If you want a better IDE but less complex, try the Sublime Text 3 (Google for it) which is pretty good.

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

    Thanks! I am making a circuit that is dark activated and I wanted the board to be in low power until the lights go off.

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

      Did it work? I guess you just wake up every 8 seconds, check the light level and go back to sleep? Well, not _you_ the board!

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

      @@RalphBacon I used a LM741 opamp to produce a 5V signal to the interrupt to wake it from snoozing

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

    Hello Ralph,
    I tried to run your code on my Adafruit Feather 32u4. The error messages say that BODS and BODSE were not declared in this scope. Could you please help me to fix this? Thank you!!

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

      These #defines are in file iom328p.h which should be in folder C:\Program Files (x86)\Arduino\hardware\tools\avr\avr\include\avr
      which is part of the Arduino infrastructure (so included automatically).
      But I see you are using an ATMega32U4 is which is not an ATMega328P so that's the problem. Compile with an UNO-compatible board or find which (Adafruit) library is reference these #defines. Both BOD and BODSE are fuse bits that define whether brown out is enabled or not (but this doesn't help you).
      Check the board and platform you are using in the Arduino IDE Tools menu.

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

    Can I use your code on atmega2560? And does it work for the atmega2560 chip?

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

      I'd be surprised if this worked, as the ATMeaga2560 has different registers and the way of going into deep sleep. Try Nick Gammon's excellent website to see if he covers that chip: www.gammon.com.au

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

    Could you please tell me dear how does use watch dog timer with EEPROM in arduino ? Is this possible method( i mean use EEPROM and watchdog timer sequentially(Simaltenousley)

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

      I'm afraid I don't understand your question, Dilshan. The WDT is a timer independent from the microcontroller hardware. EEPROM is some non-volatile memory to store values across reboots. What is it you are trying to do?

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

      @@RalphBacon yeah i strongly agree with you so could you please tell me how use WDT ( watch dog timer) to deep sleep and wake up arduino? And how does use arduino use in low power? Do you get the point?

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

      See video #166 which is all about Deep Sleep on the Arduino with the WDT: th-cam.com/video/BuxgEeq9IBU/w-d-xo.html

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

      @@RalphBacon thanks lot then where can be downloaded codes ? Are there any website or other?

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

      All code is in my GitHub for that video and the link will be in the video description.

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

    Good day sir, is it ok to use and modify your codes to fit the requirements in my Arduino project?

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

      Yes, you can, it's all Open Source, so do whatever you want!

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

    how did you measure the current in an arduino?

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

      Just using a multimeter, Rafael, no special magic involved. Obviously, you have to do this without any onboard LEDs etc, just the chip.

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

    nice

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

      Thanks for your post, Maxx B, good to hear from you (you've been very quiet lately).

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

    Hello can you wake up arduino using GSM module...

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

      If a pin on the GSM module goes HIGH (or LOW, ie changes state) that would be enough to trigger the interrupt on the Arduino.

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

    Can I use this code in Arduino IDE?

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

      All my code runs 100% in the Arduino IDE, Mohamad!

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

    You can lower the power consumption on the arguing by not leaving unused pins floating

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

      Yes, I tend to set them all as INPUT_PULLUP these days.

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

    you could also look at the deep sleep modes of the ESP8266 and the ESP32

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

      Yes, it's now on my list and has been requested in another comment here, so I will look into it. Thanks for the nudge, Paul.

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

    You have forgotten to "pinMode(13,OUTPUT);" that is the L LED on the arduino. by setting 13 as output it automatically turns off LED L. (highly power saving)

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

      Excellent point, Kahn, thanks so much for sharing this, nice to hear from you.

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

      @@RalphBacon Always happy I could help 😀

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

      @@RalphBacon and you could have used that built in LED instead of the external one you used in the video to show it running. It saves some wiring. You can control it with "digitalWrite(13,HIGH/LOW)" I often use it as it is a lot easier than using an external LED.

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

    how to work with esp8266 with deep sleep

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

      What you need, Ahamed, is a really good video that deals with Deep Sleep on the ESP8266, like this one here:
      th-cam.com/video/NgPwPKXCLFY/w-d-xo.html
      I can vouch that this will tell you everything you need, as I know the person who made it :)

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

    Power cuts are really normal for a Car Computer.

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

      Do you mean the power is removed _completely_ from the on-board computer in a car when you switch off, Hermann? Or does it just go to sleep? When I open the door of my car, it displays the mileage (odometer) so it can't be fully dead at that point.

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

      @@RalphBacon I built a automotive computer. Think of music, gps, backup camera, OBDII data collector! Every time I start my car, the power is cut to the auxiliary devices which includes the automobile auxiliary power outlet (the cigarette lighter plugin) where I was powering my RPi 3. I used it for one trip across Canada and I gave the RPi to my grandson when I was in Toronto. I never got back to that project but the power thing was an outstanding issue. The device specified with some duct tape gives that problem a very simple solution. I sincerely have to thank you for your posts as now during the the time of Covid, I am learning about Arduino and your post are valuable. I have imagined dozens of cool applications with some which requiring battery power.

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

    If you want to make a battery powered sensor, look here -> www.mysensors.org/build/battery Using a pro mini 3.3v with regulator and pwr led removed and using the mysensors built in sleep function I am running at 4-5 uA while in sleep

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

      That's a very good, low-level sleep current, probably about the same as the self-discharge rate of the battery itself. I'll have a good read of that link, thanks for posting, thesimbon!

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

    hi

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

      Well, hello to you too! 👍

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

    #include causes an error
    src\main.cpp:2:10: fatal error: avr/sleep.h: No such file or directory
    #include
    ^~~~~~~~~~~~~
    compilation terminated.
    *** [.pio\build\adafruit_feather_m0\src\main.cpp.o] Error 1
    [ERROR] Took 2.22 seconds

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

      Check to see whether you have any 'avr' folders in your Arduino directory. If not, I suspect you have not installed the correct boards. Go to Tools, Boards Manager and install the AVR boards.

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

    24 minutes? At this length and information flow, someone needs to please wake ME up! The "click magnet" of this video is the title. So, it's not cool to embed a 10-min 'ad' unrelated to that. If you must place an unrelated 'ad plug' for a battery product (or any other product), please do us the credit & courtesy of placing it at the end of the of the TITLED video and articulate the change of topic from the titled one to the totally different one (i.e. the battery ad).

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

    first

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

      Is there some competition to get the first comment in on a new video? This has happened a few times lately. Do I get a prize somehow? Do _you_ get a prize somehow? Let me know! Frankly, I'm just happy you guys are taking note of new videos released!

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

    "Put your Arduino to Sleep" - wastes the first 10 minutes on talking about some battery based microcontroller.
    With a title like that we're here to learn how to put an Arduino to sleep. I doubt most of us care much about the rest..

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

      Spot on.

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

      Sorry you didn't like it. The "some battery based microcontroller" was the Arduino ATMEGA328P chip. The one in the Arduino UNO.

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

    Hi iv used your code on a IR project of mine and it works perfect antill i add this "IR.enableIRIn();" then it seems to skip straight past the sleep and wakes up
    Do you know of any way around this

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

      The sleep mode commands of the Arduino must be done in quick succession (there are two lines) with nothing in-between otherwise it won't go to sleep. Details are in my code.