Very LOW Power Arduino - Precise Time Interval Wakeup! using an RTC

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 ก.พ. 2017
  • Here's a cool way to put your Arduino into an ultra low power deep sleep state, then wake up at a very precise interval, like for 10 seconds, minutes, hours, days, and so on. I'm using an external RTC (Real Time Clock), specifically, the MCP7940. Here's the wiki that I made for that board: www.kevindarrah.com/wiki/index...
    RTC Video I did here: • RTC (Real Time Clock) ...
    LOW Power Arduino Video here: • Low Power Arduino! Dee...
    The CODE is here: www.kevindarrah.com/download/a...
    Check out my Tindie store (trigBoard is available) www.tindie.com/stores/kdcircu...
    Thanks to all the Patrons for dropping a few bucks in the tip jar to help make these videos happen!
    / kdarrah
    Twitter: / kdcircuits
    For inquiries or design services:
    www.kdcircuits.com
  • วิทยาศาสตร์และเทคโนโลยี

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

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

    Brilliant !
    Well done- informative Video.
    Will use these with my Afterschool Arduino program.
    and just subscribed- Thank You !

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

    Great tutorial! A channel well worth subscribing to.

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

    Very cool! Keep it up!

  • @Jack-eh2ud
    @Jack-eh2ud 7 ปีที่แล้ว +1

    Hi Kevin,
    At 1:17, you suggest "Why not use the internal watch dog..", and you list that you're limited to turning on every 12 second and then going back to sleep. I agree with you that the RTC clock is more accurate, but as far as I can tell, the while loop you have set up has the same problem. It turns on every 12 seconds, checks to see if the alarm flag is triggered and then goes back to sleep. Accuracy is better, but POWER USAGE is basically the same as far as I can tell? Am I missing something?
    Another option, instead of using the interrupt, is to simply use a RTC Date Time library, and then
    RtcDateTime now = Rtc.GetDateTime();
    RtcDateTime alarmTime = now + 1000; // 1000 seconds into the future or however long you want.
    while(alarmTime > Rtc.GetDateTime() )
    {
    SleepFor12Seconds();
    }
    This should do the same thing without needing the interrupt pin. The downside is that all these methods you are still limited to wakeup within 12 seconds of the alarm and not exactly on time.

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

    There is possible to combine two alarms (ALM0 and ALM1) to cooperate. Then you can wake up Arduino for example on specific Hour and Minute or specific Hour of any Day of the week. See 5.5.2.2 Dual Alarm Operation and TAB5-10: DUAL ALARM OUTPUT TRUTH TABLE

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

    Awesome video! Where do I pick up the board to solder the parts into? Do I have to have PCB's made or can they be purchased somewhere? If I have to have them made, is there a file for that? I saw a wiki picture of the layout but didn't see a place to download it. Thanks again!

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

    That's really awesome work! One question though, the checkAlarm function could just return the result of the condition, couldn't it? Instead of the if statement with a return 1; and return 0; in it, a return ((alarm0Check >> 3) & 0x01) == 1; should suffice. It's returning a boolean after all.
    Heck, I think even return (alarm0Check >> 3) & 0x01; would do just fine as & 0x01 can only result in 1 or 0, which will be interpreted as boolean true or false.

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

    Thank you, you answered my quetions

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

    Nice Kevin

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

    Will you do a video on how to use an ESP8266-12 on the lowest possible power consumption for keeping the WiFi connection On. Using an RTC of course. I read, it can wake up and ready to send in under 2ms!

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

    Kevin, is there a way for an RTC's alarm to switch a mosfet and turn on an arduino?

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

    How long can you run an RTC that sends an interrupt every 15 mins just of the coincel?

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

    Hey! I want to be an embedded systems engineer when I graduate. Should I be working with the Arduino IDE for hobby projects or should I use something like the MSP430 and code it the hard way?

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

    All well and good ... if the user is a programmer.
    But how does one take input from a non-programmer then set the alarm to the date, year, month, day, hour, minute and second?

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

    great. thank you.

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

    I've designed a simple board with ATmega328p's internal rtc with external 32.768kHz crystal directely connected at TOSC1(PB6) & TOSC2(PB7) pins. It draws abot 1.1uA (vcc 3.3v) in power save mode with accurate time keeping! Also you can use the internal rtc interrupt to wakeup the processor in any time. I'm running the cpu at 1.8432Mhz with calibrated internal oscillator via OSCCAL by the help of internal rtc. So it's easy and I can run the UART at 115200 with the minimal external hardware, only one 32.768kHz crystal!

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

    I can't find an MCP7940 module online, just the chip itself. Can I achieve the same result with a DS3231?

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

    Can you make a vedio about 32786MHZ with timer2 ?

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

    Hey, Kevin! I have a small project here, where I used only an ATmega328P (and a crystal) to create a RTC internally on it.
    If anyone is interested, here's the code and schematics: github.com/jdneto/Atmel-Projects/tree/master/ATmega368p-168pa-88pa-48pa/timer2-as-rtc-with-leds. The average current at 3.3V is about 8uA.

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

      José Dias Neto Super Code, thanx for sharing

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

    If I ran this basic blinking setup out of 2xAA 1,5v batteries how much time would it last?
    And hiw mich time would they last if the arduino was awake without RTC doing the same work instead if sleeping?

    • @Kevindarrah
      @Kevindarrah  7 ปีที่แล้ว +30

      great question - so let's say the ON time is 1 Second and the current is 6mA. Then you've got your OFF time for 10 seconds with 1.5uA current. Then you've got to calculate the average current draw over that time. So we take 1x6mA + 10*1.5uA then divide that by the total time (11 sec) which equals 0.55mA So you can see how that 6mA of ON current affects the average current. If you slept for longer, or reduced your ON time, you can get that even lower. So then looking at a standard AA battery, let's say we get 3000mAh out of it. We can simply take that and divide 0.55mA by it and you end up with 5455hrs or 227 days. Not too bad... but let's say you didn't 'sleep' and were just ON all the time at 6mA, well then you just take 3000/6 = 500hrs or only 20days. So clearly sleeping buys you a lot in terms of battery life.

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

      Kevin Darrah thanks for taking time to answer!
      I really like these videos. Very clear and well explained. Thanks for making and sharing them!

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

    Where to find this 328 board for sale? Cant find any info about it and its not on eBay or Ali.(

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

    Nice video, gives me more insights. I use the 328p sleepmodes with watchdog. I understand the difference with and without using the watchdog is around 6uA (using 6.5uA with and 300nA without, I am not able to measure this tiny current myself). Looking at the datasheet of the MCP7940 shows it uses 1uA. So if I want to save 5 uA, I just need to add the RTC module.

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

      yep, exactly

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

      Arnoud van Leijden and if you cut power of rtc it runs of its battery. but can it wake the uC if running its running on battery??

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

    What Arduino board are you using in this video?

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

    What about using a cmos 555 timer ?

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

    Excellent info again Kevin!
    This is probably a dumb comment, but why not use 'C' type commenting /**/ ?
    I think I know why you comment rather than #if's though as I have many options in my code and it's hard to
    see what's happening (especially with multiple nested #if's).

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

      I'm lazy and use the Arduino's built select all, then Control Slash command to comment out a block of highlighted code. To uncomment, you just select the code and do the same thing Control+/

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

    make a low power 8mhz arduino video!

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

    Whats up with your arduino?

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

    Hi Kevin, may I ask two questions? In your circuit, both the RTC board and the Arduino board are powered off of the VCC rail on the breadboard and the current in sleep is only 1.5uA. Or is the RTC running off its own battery? Asking because the RTC datasheet says ~ 1.2uA @ 3.3V for time keeping + the Arduino which I would have expected in the 3-4 uA range. And secondly, looking at this 328P board - is there any good reason why one would go even further and only use an ATTINYxx instead? For even lower low power consumption? Thanks so much!

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

      yep. that current you see in the video is pretty much all RTC. I did another low power video with just the arduino. And sure an ATtiny is fine if you only need a couple pins for simple stuff. No prob, I use those all the time.

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

    Witch arduino is this?

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

    You've made a latch circuit once. Perhaps use the RTC to turn it on and Arduino to turn it off? That will kill Arduino and save you some power?

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

      I'm extremely interested on this, I did put the latch circuit together and it 100% works with my arduino,I was hoping to get it working with a RTC, everything seems to indicate that is not possible, RTC doesn't seem to be able to deal with logic by itself, the alarm setting is being executed on the Arduino side (I'm using a DS1307), so lower power is possible because the arduino is still checking the time and executing the code, but no power is not, I would absolutely love to be corrected because turn the arduino on with a RTC would save my project

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

      just saw that my version of RTC (DS1307) does not have an standalone alarm but the next one does and should do the trick, hopefully

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

    how do I change the mask to boot up every 7 days instead of every 10 seconds?

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

      I'd try "Day of week match" mask...

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

    goToSleep(0x10) does not mean 16 seconds ?

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

      no, because the byte is split in two. The 1 is for the 10's digit, the 0 for the 1's digit, so you get 10 when you give it 0x10, or 0x59 gives 59seconds...

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

    By removing a couple of resistors and clipping the vcc leg you can reduce the current on $1 DS3231 modules from 100uA down to 5uA which will give you alarms for >4 years on the backup coincell. This power saving modification is quite useful for our battery powered data logging application:
    thecavepearlproject.org/2014/05/21/using-a-cheap-3-ds3231-rtc-at24c32-eeprom-from-ebay/