#192

แชร์
ฝัง
  • เผยแพร่เมื่อ 18 มิ.ย. 2020
  • Use a cheap RTC to wake up your Arduino from Deep Sleep
    JLCPCB Only $2 for PCB Prototype any colour jlcpcb.com/
    More information (including all links, sketches & PDFs in my GitHub):
    github.com/RalphBacon/192-DS3...
    INFORMATION
    The DS2131 library I'm using in this demo (I do wish each developer used a unique name!)
    github.com/rodan/ds3231
    Alternative DS3231 library by Northern Widget, has some nice features
    github.com/NorthernWidget/DS3231
    DS3231 Datasheet. Essential reading if you are using native I2C calls (ie no library)
    cdn-shop.adafruit.com/product...
    AT24C32 EEPROM on that module - this could be VERY useful for data-logging. 1 million writes!
    ww1.microchip.com/downloads/e...
    A library to exploit that AT24C32 EEPROM
    github.com/jlesech/Eeprom24C3...
    Battery Life Calculator
    www.digikey.co.uk/en/resource...
    Best 18650 battery of 2019
    www.18650batterystore.com/186...
    Si4599 Datasheet
    www.vishay.com/docs/68971/si4...
    Want to know about I2C?
    en.wikipedia.org/wiki/I%C2%B2C
    PRODUCTS
    DS3132 module (with EEPROM) 3 pieces for less than $5
    www.banggood.com/3pcs-DS3231-...
    Si4599 N and P Channel 40V (D -S) MOSFET Expansion Board Module (each)
    www.banggood.com/CJMCU-4599-S...
    List of all my videos
    (Special thanks to Michael Kurt Vogel for compiling this)
    bit.ly/TH-camVideoList-RalphB...
    If you like this video please give it a thumbs up, share it and if you're not already subscribed please consider doing so and joining me on my Arduinite journey
    My channel, GitHub and blog are here:
    ------------------------------------------------------------------
    / ralphbacon
    ralphbacon.blog
    github.com/RalphBacon
    ------------------------------------------------------------------
  • วิทยาศาสตร์และเทคโนโลยี

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

  • @borayurt66
    @borayurt66 3 ปีที่แล้ว +4

    There is one interesting thing about these DS3231 modules. They are trying to charge the CR2032 battery! I can't remember where I found the schematics of this module and noticed this couple of years ago, so I can't give a link. But you need to remove one 200 ohm resistor right next to the SCL pin on the 4 pin connector side. It is between the MELF diode and the SCL pin. Both the diode and the resistor are in on this very wrong charging circuit, so you can remove either or both. This may also be the reason of higher than expected current draw.

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

      Or you get rechargeable cells

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

      I even have one with a rechargeable battery still in it. Dead as a dodo now of course. I will check whether the charging circuit is still included on mine and remove the resistor/diode. Good information, thanks for posting.

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

      @@RalphBacon www.onetransistor.eu/2019/07/zs042-ds3231-battery-charging-circuit.html

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

      I spent 2 months in lockdown messing with this stuff trying to build a temperture/humidity data logger with a mini pro, got current consumpion down to around 3mA when sleeping which is still very high.
      alot of help from thecavepearlproject.org/2014/05/21/using-a-cheap-3-ds3231-rtc-at24c32-eeprom-from-ebay/
      Desoldering the led and charging resistor and the vcc leg of the 3231 chip make a massive difference but you need to power the leg from an arduino pin when reading and recording data
      And Nick Gammon site was also very helpful
      gammon.com.au/forum/?id=12106
      He claims less than 7 micro amps for his logger

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

      @@Ed19601 check this site for reasons not to use the charging circuit on these boards thecavepearlproject.org/2014/05/21/using-a-cheap-3-ds3231-rtc-at24c32-eeprom-from-ebay/

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

    Excellent addition to the previous videos. Thank you.

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

      Glad you like them! Nice to hear from you, Simon.

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

    Very clear and informative as always! Thanks Ralph.

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

      Glad it was helpful!

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

    Great job as always Ralph.

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

      Thanks again! Nice to hear from you Steven.

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

    Great video! Thank you for the detailed explanation and for pointing to the right library

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

      You're very welcome!

  • @karens-jclark4199
    @karens-jclark4199 3 ปีที่แล้ว

    Thanks for all the videos Ralph ... I have learned a ton from you .
    Very much appreciated ... :)

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

      Glad you like them!

    • @karens-jclark4199
      @karens-jclark4199 3 ปีที่แล้ว +1

      @@RalphBacon
      Very much so ...
      Been meaning to say thanks for ages...
      Been very helpful ... :)

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

    Thoroughly thorough !

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

      All bases covered then, Andy? Great!

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

    Great video btw! excellent explanation.

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

      Glad you liked it!

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

    Another lovely informative video

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

      Glad you enjoyed it

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

    Thanks A TON! I ran across your video whilst searching for anwers on why my interrupt wouldn't work. I was forgetting to clean the flag bits

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

      Glad I could help!

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

    Thanks for the interesting video Ralph, I actually use these RTCs with all my IoT sensors around my house but it did take some time to get a fully working & stable device for my needs, i.e.extremely low power use.
    Without posting my schematics the basics of my system are as follows:
    Sensors are powered via 2 x 18650 cells in parallel for capacity not voltage which go to a ultra low Microchip 3.3v LDO
    The output of the LDO is connected to a P- Channel MOSFET & the gate of the MOSFET is connected to the INT/SQW pin of the RTC (DS3231)
    (all this time, my ESP8266 & even the RTC itself has no power, the RTC purely running on CR2032 backup)
    When an alarm is activated, the gate of the MOSFET is pulled low which then sends the regulated 3.3v around the circuit.
    ESP8266 is powered on, takes a reading and sends this reading to the main unit located elsewhere via ESPNow, ( the main unit is connected to a permanent supply & connects to the internet to upload the reading), sets a new alarm for the RTC and then shuts down to wait for the next wake up call. The MOSFET gate is then sent high once again & all powere is removed from the circuit.
    RTC is now running on battery backup again.
    There are a number of caveats though that mean some modifying of the DS3231.
    The 472 resistor pack located above SDA & SCL pins on the RTC have to be removed & make sure that there are SDA & SCL pullup resistors on the board being used, good thread here:
    forum.arduino.cc/index.php?topic=537675.0
    For super low power removal of the LED on the DS3231 is also a great idea.
    Plus a necessity for anyone who uses these RTCs is to remove/disable the inbuilt charging circuit.
    These RTCs come ready to accept an LIR2032 rechargeable battery, most people find these inadequate and fit a regular CR2032 non-rechargeable battery in the holder. The problem is that there is a charging circuit on the unit, not a good mix with a non-rechargeable battery installed.
    For simplicity I just removed the 200ohm resistor on my RTC, some people removed the whole circuit though.
    More details here:
    thecavepearlproject.org/2014/05/21/using-a-cheap-3-ds3231-rtc-at24c32-eeprom-from-ebay/
    Cheers..,

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

      Very interesting. I also got the P-channel MOSFET of a Si4599 to go LOW via the SQW/INT pin of the DS3231, and the current required was in the order of 3µA. I'm guessing that when you clear the alarm the open-drain MOSFET on the DS3231 goes high again which is enough to turn the P-channel MOSFET off again? Neat. Thanks also for all the other current saving techniques, every µA counts!

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

    I live in rural Michigan. I wish I could find any electronics locally. Everything I get comes from Aliexpress. :P
    Thanks for the awesome tutorials. I've learned so much since I found your channel recently. Thanks Ralph!!!

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

      Glad to help! Note that Amazon also sell some stuff (yes, source from the Far East, too) which might be an option for you. And you have the "big boys" such as Digikey, Mouser and so on.

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

    Another brilliant video.

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

      Glad you enjoyed it

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

    I was waiting for today's video, an even without watching, i know it will be something usefull..

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

      Hey i was first :-)

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

      Hope you enjoyed it!

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

    Bugger, I just bought a handful of 1307s! Need to get my hands on some 3231's now (not that I need them, but I love this function)!

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

      Ditch the 1307s, Nick. I have some still and will never use them, they lose seconds per day and are not temperature compensated (so they get more inaccurate the hotter it is, during the summer, for example). Sad but true.

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

      @@RalphBacon Bloody hell! I had no idea. Thanks very much for the heads up. I'll keep a couple for the archives and bin the rest!

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

    I used a similar idea to save power when using a venerable PIC 16F84A to make something similar to the "who got in first" device used on quiz shows. The B port would be set up to trigger an interrupt on a button press, then the Sleep instruction executed to put the processor into a low-power state. An interrupt would wake up the processor and the interrupt routine would simply return, allowing the rest of the program to continue (check for which button triggered the interrupt, light up a LED to show which button was pressed and make a sound by bit-bashing a port, then go back to sleep until a reset is received).

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

      Sounds like a decent PIC project (ah, memories, memories). I don't do any PIC work now, shame.

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

      @@RalphBacon They're fun to play with. my next project was making an 8-pin PIC produce a single-bit "white noise" output by internally simulating a 32-bit ripple counter with XOR feedback, effectively making a pseudo-random number generator.
      My latest project has been programming an Arduino Nano to drive a 32x8 Neopixel display with static text and a colour-changing border.
      It's all fun, until it comes time to put a box around it... sigh.

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

    Thanks for these well presented and clear videos. I'm teaching myself simple electronics and find certain Arduino projects really helpful. I plan to use this RTC video on one of my tasks, but only need a "wake up" at the same time each day. In this case do I still need to "set next alarm" each time the sleep pin goes low.

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

      I don't think the alarm is held over to the next cycle (unlike your bedside alarm clock) so you need to set it each time. Pretty sure, but best check the datasheet or just try it out!

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

      @@RalphBacon Yes I will. Thanks for the quick response. I am still having problems getting it to repeat for the first time. I'll get there, and let you know. It's just that you said somewhere in the video that the DS3231 held the data permanently and I assumed that once the hour/min/sec was set it was there until the battery ran out. I still need to work out what I am doing wrong. It works fine on day one, but seems to stall after that.

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

    Excellent video! I did a breadboard/bare bones project like this, and ran into the RTC eating too much current during sleep. My solution was to power the DS3231 from a pin on the microcontroller. Before going into deep sleep, I set the pin low, then set it as an input without pull-up. I think I got to around 40 microamps. The DS will still trigger the low alarm signal, so having the Int pin with internal pull-up is necessary. Runs for around 16 months on 3 AAA batteries I think.

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

      Nice work! 16 months on 3 AAA batteries is pretty good. I tried powering it from an Arduino pin but got strange results and I was pushed for time. Nice to hear it can be done by you Andrew. Thanks for the post.

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

      @@RalphBacon You're welcome! One thought: Did you remove the charging circuit from your board? The diode/resistor pair near the auxilliary SCL connector form a (really bad) charger from Vcc direct to the battery. (From memory, the boards are meant to have a rechargeable 2032 but usually have a CR2032, but in any case the charger is inadequate/dangerous depending on Vcc) I'm wondering if that would pull down the GPIO pin's output too much? Out of interest(?) my proto board also had a tiny OLED display for setting the clock and some other parameters for my project (environmental air sampler), so I used the same trick for that with a GPIO pin to power it during setup. You've got to love this stuff!

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

      I didn't but plenty of viewers reminded me to do so!

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

      great !
      by any chance can you share diagram and code please ?

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

      @@ighost_1337 should be able to. It was a work project, so I'll check if anything needs stripped before sharing. Drop me a message in a few days if I don't respond again! Cheers.

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

    Been looking at making a birthday clock using a DS1307, promini and 16x2 lcd and came across your video as I was looking for more info on the use of structs.
    In some ways seems simple enough but it can get rather deep rather quickly and hence loss of understanding.
    So a list of names and the day and month of the birthday and then display something like "happy birthday johnny" ...other times just display the time etc. I guess or "no birthdays today".
    I'll keep at it.....cheers Jeff

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

      Don't use a DS1307, Jorgo, they are notoriously inaccurate. A DS3231 is much, much better.
      The way to approach a project like this is to split it up into logical sections. Get each section working without worrying about whether the time is 4 pixels too far to the right!
      So, I would:
      1) Get the LCD working. Display HELLO WORLD on it. That proves your I2C is working too assuming you are using one with the extremely useful "I2C backpack" which I covered in a recent 'Bacon Bytes' video.
      2) Read the date/time from the DS3231 (Getting the date/time INTO the DS3231 is another task). Display it on the (working) LCD. Ignore the fact that it's the wrong time and date. You will need a TIMER TASK to run a function every minute to update the time.
      3) Find out how you set the date/time on an DS3231. It's best to do this in a SEPARATE sketch otherwise you run the risk of overwriting the real date/time with some past date/time in your code. Don't ask me how I know this!
      4) Decide how you will store the birthday info. On an SD card? Whilst you _can_ hold such info in EEPROM, that is more difficult initially. Updating an SD card is easy on your PC/Mac and then just read it in the sketch.
      It would take me probably a few days to do all this so that I had a working prototype. It might take you considerably longer. The best advice that I can offer is to do the tasks one by one and get it WORKING well enough before moving on. And watch my video #BB9 about organising your code, you will thank me! Good luck!

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

      @@RalphBacon Hi Ralph...thanks...covered up to point 3 and will take a look at your link. Had been looking at storing [10] birthday names with day and month in progmem in a struct but how to retrieve is yet to come. I guess a "for loop" to check the now time and compare. Anyhow, onwards and thanks for the link. Cheers Jeff

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

    Great video thanks!

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

      Glad you liked it!

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

    Been watching you for a few years now and I like the way you over-explain everything. It really helps people get what you mean. I love yer new shop for doing yer vids. Did you need a permit for that? I made a greenhouse and Melanie " Low Vision Life"thinks I needed a permit for that. Wadda ya think?

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

      It's nice you are still with me on my Arduinite journey, Drex! My "new" workshop (now two years+ old) did not need a permit as it is less than the permitted 2.5m high (when near a boundary, ie fence) and is classed as a "shed". I could have had it bigger (if I had more room next to my house) and still not need a permit. The rules have relaxed in the last few years.

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

      Ralph S Bacon As others have said, the cave pearl project is a mine of great information.

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

    Another good video thanks,
    the ds3231 module along with a EEPROM has a diode and resistor from 5v to the battery adding a sleep drain along with the I2C resistors. Working days and weeks ahead is a pain unless have UNIX time a count of seconds and decode void to convert back to time format ts. The time library does this ? Graham

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

      The Time library (or something very similar) does this, Graham, as I use UNIX time in the HomeAlone project so it will be an #include in that code. Whoever is interested, that code (2,000 lines of it) is in my GitHub.
      Yes, others have mentioned the charging circuit (which I had forgotten about, even though one of my DS3231 actually has a rechargeable battery in it).

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

    Grand video. A couple of thoughts to save current. As the DS3231 has a backup battery would powering the DS3231 from an arduino pin then allow you to cut the supply in the go to sleep sequence [I dont know if that affects the alarm out pin]. Second idea, would wire.end() de-energise the I2C just ahead of sleep, then wire.begin() on wake up?

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

      Best to keep the DS3231 on its own 3v battery - it will last for at least a year. And, yes, it needs the power to function (ie create the alarm, of course). does Wire.begin/end control the power or just start the protocol?

  • @MD-wy5xr
    @MD-wy5xr 3 ปีที่แล้ว

    Great video, perfect and detailed explanation. And it works .... unit you do something more in the "I am awake" state. Adding DHT11 reading, Writing to an SDcard, a Delay(2000) and .... everything stops with me. Any ideas?

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

      When you say "stops", what do you mean?
      You need to put in several Serial.println statements so you know at what point the code got to before not getting any further.
      Are you sure you used the exact code of my demo (including the "don't go to sleep again until I tell you" line)?

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

      Now it works OK. My code here: github.com/mitjad123/IOTarduino/blob/main/DHT11-SDcard-DS3231, fritzing: www.dropbox.com/s/5yowvr9a5iqoxns/Schematic_arduino%20pro%20mini%20ds3231%20dht11_2021-01-27.pdf?dl=0

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

    Good stuff here! Given that you mention that I2C is only good for distances of ~1 meter or so, what would you use to go further? I saw mention in one comment about "stuff all around the house", what would you use for something like that?

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

      WiFi is the obvious thing to connect stuff around the house, roy, although if you really wanted a wired connection then RS485 is robust (I even did a video on it, #106). You can get extenders for various protocols too, that all run on CAT5/6 cable, which convert the signal from one protocol to another and back again. That way you can run I2C over hundreds of meters (see learn.sparkfun.com/tutorials/qwiic-differential-i2c-bus-extender-pca9615-hookup-guide/all ). WiFi (if you have decent enough signal) is the "cleanest" method though.

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

    Hi,
    thanks for a very nice and very helpful deep sleep videos. I had difficulties using watch dog and thinking about using RTC instead. In the end i got everything working but questions arose. Why? I get it that from a person perspective waking up every 8 sec can be tedious but Arduino can not complain unless its programmed to. I havent cought it in the video(s), but is there some reason why should i be using RTC as a interrupt source instead of WDT worth that increased consumption? I understand that these tradeoffs depends the most on the project but are there some generall pros and cons for battery projects? Second question is just theoretical idea that iam not able to try because i dont have DS3231 in hands. Is it possible to disable I2C before sleep and enable again to save power?

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

      The main advantage of using an external RTC to wake up a processor is that you can schedule (complex) timetables to do so. Eg, every 43 minutes, or twice a day or... you get the picture.
      You can, of course, wake up the microcontroller every 8 seconds using the RTC but the Arduino will have no idea of what time of day it is. The clock is not accurate enough to used as a RTC. So if you want something to fire up at 7am each day using the RTC is not going to be very reliable. Using an external RTC will give you that accuracy.
      Regarding putting I2C to sleep, if we're talking ATMega328P (Arduino UNO) you can put just about every part of the processor to sleep independently. For example, you can put the Analog part of the device to sleep, the Brown Out detection and the Serial UART. Sometimes you need to do this in a particular order, or within a certain number of clock cycles but it can be done.
      Nick Gammon has a lot about this on his website, you can read up on it here: www.gammon.com.au/power

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

      @@RalphBacon Thanks a lot for a prompt answer and tip for a really interesting blog. Even though according to your explaination, it doesnt make much sense to using RTC for just periodical waking up, (f.e. every 15 mins) if i dont really care what time is it, i think i buy one to explore more. Thanks again for inspiration. Rabit hole here i come...

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

    Great video as always. Have you calculated how much power it would take to just use the watchdog timer, wake up every 8 seconds, increment a counter, check for 10,800, and go back to sleep. If you did not need "real" time, it might take less power then running the I2C lines.

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

      I haven't but Andrew Toogood (comment below) has Real Life experience of using the WDT and thinks it the way to go. They switch on so fast and go back to sleep again that he needs an oscilloscope just to prove they work up! I can't argue with that!

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

    Hi Ralph, old one i know but I get conflicting info and thought you might know. I'm changing from a DS1307 to a DS3231 RTC and one aspect is, some say a rechargable LiR2032 is required rather than, like you use here, a CR2032.
    Most also say no need to change anything with the includes etc. as this ds3231 will work the same. Any comments?
    Used wire.h and RTClib.h and RTC_1307 rtc;....also have a 1602 i2c lcd on library hd44780.h as I'm told this is a far better library for the display.
    Reason for the change is due to the time drift on the ds1307.......would like to keep it as is but cannot find a simple way to correct it from time to time externally(up down buttons)

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

      The DS1307 should be withdrawn, it is very inaccurate. Hence the DS3231 which is super accurate.
      You do NOT need a rechargeable battery but some boards do include a charging resistor on the DS3231 modules which should be removed if you are using a standard CR2032 battery. If you don't remove it I'm not sure any bad things happen; the voltage will simply be used instead of the battery, I guess... (if your house burns down do not blame me, though 😲)
      I haven't used library hd44780.h as the one I use does everything I need, but no harm in trying it out!

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

    Great video with loads of information. Can one use the same alarm wakeup method for the ESP8266 / ESP32?

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

      See my reply to Mr.Chauhan regarding the ESP8266. I've not done a Deep Sleep on the ESP32 yet so I don't know if this will work or not.

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

      @@RalphBacon Thought I'd report back. I tried this on the ESP32 and it works like a charm. I used the esp_sleep_enable_ext0_wakeup function
      For even more power saving, would it not work to try and use a Si4599 as part of a power latch circuit? I recently watched your other video on power latches, and it seems that a N channel and P channel mosfet can be used, is this not what the Si4599 provides?

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

      Report back: I tried it out and it works great. The Si4599 is a small chip and cheap, this works really well as a power latch. Thanks Ralph, I wouldn't have known about it without your videos

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

    Hi Ralph great video again. I do a lot of deep sleep projects for farm sensors running on AA batteries so always interested in new ideas. I think if you are serious about deep sleep performance you will need to use the DS3231 IC rather than the module, only turn on the pull ups when you need to reset the Alarm. Then you could use the alarm to power on rather than wake up the uC. Although it sounds silly waking every 8 seconds its actually hard to beat for consumption the power lost is less than normal battery losses for time and requires an oscilloscope to detect it has even happened. I have sensors waking every 30 mins to sample and send long distance via nRF24 and lasting 18mths +...

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

      Absolutely, Andrew. I do believe I originally mentioned this only to cut it out - using a module is within the grasp of most Arduinites, soldering a 16-pin SMD (of which only half the pins do anything) is a soldering iron too far! Yes, the power consumption thing would have to be measured very accurately to determine whether this method was better than waking up every 8 seconds. But your empirical evidence makes it sound that the WDT method still has merit (and no extra hardware required). It's a pity no Chinese manufacturer has made an Arduino clone with a DS3231 built in.

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

      @@RalphBacon that sounds like a challenge, perhaps i should make one. First i will do ther theoretical math based on the data sheet. To see if it has any chance of being better at power consumption. Thanks again n for the great video

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

      Or do what others have suggested here: desolder the EEPROM chip, remove the battery charging circuit resistor (and diode too if you want), power the VCC to the DS3231 from the Arduino GPIO pin. Job done. I'll try all this soon. You first!

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

      @@RalphBacon FYI using CurrentRanger and Oscilloscope i can see that it takes 16.3ms for each 8sec wake up which is 3min 1sec perday 18hr per year. For my 10ma project thats less than 10% of 3 AA batteries in a year. The lowest standby for ds3231 will use~50%. So no chance of being better.

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

      So there we have it, a scientific reason to keep using WDT. But I guess this is another way of doing it... right? Right?

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

    I think, when the DS3231 is powered from external source (5V of Arduino) and the vcc is higher than the coin cell voltage, the coin cell is being charged from that external power source, hence the higher consumption. I think I read it in the data sheet.

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

      You are correct, Milen. The charging circuit is present and will attempt to charge a non-chargeable battery (eg CR2032) if fitted! One of my DS3231s actually has a rechargeable battery still fitted. I must remove the charging circuit resistor to avoid any unpleasant surprises with that coin cell. Thanks for posting, good to hear from you.

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

    Enjoyed your video, but I have a slightly different problem that I think you can help with. I am trying to wake up a ESP8266 12-E NodeMCU with the DS3232 Alarm and haven't been able to make it happen. I have not been able to find a wiring diagram that works. My sketch sets the alarm(s) and they fire as directed, but I have not been able to wire the SQW pin to the ESP8266 RST pin and make the wakeup/reset work. I think I have tried every combination of transistors/resistors/etc. but nothing seems to work. My aim is to use ESP.deepsleep(0), but can't get the alarm to reset even when the ESP8266 is awake. Your help would be appreciated. John B.

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

      Such a long time ago, John... my brain is foggy. I covered Deep Sleep for the ESP8266 in video #118 (th-cam.com/video/NgPwPKXCLFY/w-d-xo.html ) and I seem to remember that the RST pin had to be held LOW for a minimum period; I'm not sure the SQW output is LOW long enough but you could prove this pretty quickly I'm sure with a 555 monostable getting its wake up from the DS3231 which then provides a much longer pulse for the ESP8266. If you just short the RST to GND does the ESP8266 wake up OK?

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

      @@RalphBacon Thanks for your reply. Yes it does wake up (restart) when connected to GND. I don't do much EE type stuff but I can tell you what I see. When I measure the SQW output I get 3.5v and same for RST. When SQW alarm fires SQW drops to 0v and after the alarm it goes back to 3.5v. It is a very short pulse. If I connect the SQW to the RST it locks up the processor until I disconnect the wire. I've never used the 555 monostable and only know what I have learned on the web over the last two minutes. Do you have a video explaining it? Thanks again, John B.

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

      I haven't done such a video (other than my 555 watchdog) but if you email me (my email is in the About tab of my channel - but not from a phone) I'll send you the best book on 555 timer chips that you can peruse.

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

    Observation: the pull-up resistors are not only applied to I2C's SCL and SDA, but to SQW. The DS3231 chip supplies SQW on an open drain, but the board with its pull-up resistors connects SQW to the board's Vcc, and Vcc is connected (amongst other things) via the LED to ground. That means that when the RTC is running on its button battery (no power on I2C), volts (from an external source) applied to SQW are attempting to power the LED and other bits of the board, and current is draining from the external source even while the alarm has not yet fired. Which rots my socks.

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

      Probably explains the higher-than-expected current drain.

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

    If you have a power-critical application, a simple ultra low power timer like the TI TPL5010 would be a good way to go. You could power down the RTC just before going into deep sleep, and the timer would draw 35-50 nA until it wakes up the MCU. You'd be limited to sleep times of 2 hours (for this timer anyway), but most applications need to wake up more often anyway. And if you need to wait until a specific time of day, you can set it to wake periodically, wake up the RTC, check the time, and go back to sleep if the time isn't met. With sleep intervals of more than a few minutes, you'd still gain a lot of battery life.

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

      Indeed, Chris, 'tis true and I did video #125 on the TPL5110, there are many roads to Rome. th-cam.com/video/Qms_iEL7Uqg/w-d-xo.html

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

      @@RalphBacon Nice!

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

    How do you program the chip, do you put it back in a UNO upload the sketch then pull the chip and put it in the little test mule you built? Or do you have to play around with one of those finicky FTDI things?

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

      When I design a circuit I allow for the ICSP connections (so the SPI pins, basically) and use a standard programmer (or an Arduino-as-ISP) to program them.
      Once you have used an FTDI (USB-to-Serial device) a bit, you'll find them a lot less finicky I assure you!

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

    Great video! What programming software are you using? It's not IDE. I like that you can collapse the remarks.

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

      In this video I'm probably using the Eclipse (Sloeber) but that's now dead in the water. I recommend the new Arduino IDE 2.0, now available as Release Candidate 5 (so very, very nearly done).
      Get it here: www.arduino.cc/en/software#experimental-software

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

    I made a box to remind the boss to take her medication at breakfast every morning using theDS3231. Great chip. Remove the resistor array to kill the EEPROM (big blob of solder took the whole thing off!) and cut power track. Using Lidl AAs, it’s still going strong 16 months later (so is she!). It flashes a LED every 3 seconds until she stops it. This battery calculator is much better for this type of project oregonembedded.com/batterycalc.htm.
    And you can power the DS from an Arduino pin and switch it off before sleeping. Interrupt still drops on alarm!

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

      I wish I had found that battery calculator page! Yes, I guess removing the EEPROM and the battery charger circuit would do wonders for the current consumption. I will have to modify my one to do this and re-measure. Now, I tried powering the DS3231 VCC from an Arduino GPIO pin but got weird behaviour so I didn't mention it during the video. I'm glad you said it works OK so I will retry that. Great information, thank you.

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

    Thanks

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

    Hi Ralph Bacon
    I have been following your video with great interest regarding “# 192 Wakey, wakey! Let the DS3231 RTC wake up your Arduino-easy! ” I can not program, but I can use your sketch for some practical use, and not just flashing LEDs. I have a sketch that runs on ESP32 and which is an Internet clock that is updated every minute, along with Temp. and Humidity from DHT 22, all of which are shown on an E-Paper display.
    Since I do not see or use the Internet clock at night, it was best that it is in Deep Sleep, as it is powered by a battery, thereby saving power. I could imagine that ESP32 Wakeup, for example, time 0800 and, and goes into Deep Sleep at 2300, and it can do that every day. I do not have the ability to combine the 2 sketches into one sketch as I do not have enough knowledge of programming, so could you help me with that?
    How do I combine Setup from the 2 sketches in one sketch, and the same in Loop, so that it can be used for something practical.
    With best regards Georg

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

      Have we not had this conversation already, Geog? I'm sure I replied. Perhaps I just forgot to press SUBMIT? Anyway, to combine the sketches is fairly straightforward. Copy each line of code from the simplest sketch into the more complex one. Don't repeat stuff and make sure it works as you go by compiling and uploading. I've just done the exact same exercise copying my TFT Screen code into my Internet Radio code, testing as I went. A couple of hiccups (forgot an #include library) but other than that all sweet.

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

    another great video, BTW how is Benny?

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

      Not so good, right now, fingers crossed he will recover. Thanks for asking.

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

    You are not up to date on LiIon batteries, the 18650 is up to 3400mAh and 2000mAh is not very common.
    I have been testing LiIon batteries the last 8 years, this table shows brand and capacity and links to a review of each cell:
    lygte-info.dk/info/batteryIndex.html

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

      A very useful table. Thanks for posting. Bob

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

      That's both useful and an eye-opener for me. the last 18650 batteries I bought were in 2018, 6 x Samsung 2500mAh for the princely sum of £22. Things do change quickly in the battery world these days.

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

    I did try this sketch but it seems that the wakePin is changing state constantly, meaning goes to sleep and wakes up in milliseconds ! any idea why ? i used the same rtc module with an Arduino Uno.

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

      If the wake pin is suppose to go LOW to wake the device, ensure you have either defined it as an INPUT PULLUP or have attached a 10K resistor from it to VCC.

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

    Is it possible to power on arduino with this alarm clock? I mean, when using mosfets to completely shut down the arduino, then start it with an alarm from the DS3231

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

      If you combined this with my Auto On/Off circuitry (or variant) you could do it:
      #173 th-cam.com/video/S2y1oAVmxdA/w-d-xo.html
      A better way would be to build your own Arduino UNO with a bare chip (only requires about 5 components) then put it into Deep Sleep which consumes just 0.2μA. Wake upon external trigger.

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

    Holey cow! Right when you pulled the power wire my video stopped! Could you hear me screaming "plug it back in"?

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

      I heard you! Spooky!

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

    What I do not understand that sleep current consumption in this video is not verified with multimeter.
    I'm watching this with pretty much the same setup and Arduino Pro Mini 3.3V (basically Atmega chip, efficient, but weak voltage regulator unable to provide high current for SD card for example, reset button, oscillator, few capacitors and resistors and nothing else), trying to resolve issues which either do not exist in your setup (due to code differences or I omitted something). But first mistake I can see is that battery charging circuit is not disabled which may add few milliamps extra to overall power consumption at 5V because battery is being charged (regardless CR2032 is not rechargeable). Other problem is that in this exact setup, RTC circuit consumes roughly 90uA and Arduino 60uA with ADC disabled. I'm not sure why Arduino consumes so much. When I tried to remove VCC from RTC powering it from pin, it switches to battery, but also interrupt goes to low at this moment so falling edge is not detected or interrupt is triggered briefly after arduino enters the sleep. Another problem is that BOD has to be disabled within few instructions before entering sleep, but with power consumption being 150uA in my setup, I don't bother to save maybe 10uA.
    Weirdly I checked The Cave Pearl project which mentions that 90uA as well, but it also mentions that RTC can be powered via digital pin, without mentioning interrupt. I can try to set BBSQW bit on, it's undocumented what effect it has in interrupt mode.

    • @RalphBacon
      @RalphBacon  18 วันที่ผ่านมา +1

      A bare-bones Arduino ATMega328P chip will use just 0.2μA in Deep Sleep. Of course, achieving that depends on disconnecting just about every other bit of the circuit, normally done by a P-MOSFET (so the Arduino brings the gate of the MOSFET low and thus powers the rest of the system).
      Using any kind of "dev board" is a no-go unless it has been specifically designed for low power use. For example, ThingPulse do a low power version (15μA) of the ESP32 (called ePulse Feather) which is about as good as you can get with that chip. There's probably a low-power version for the Arduino too.

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

    Oh those library names... You wouldn't believe just how many libraries out there called LiquidCrystal_I2C...

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

      Yes, I can believe it. So annoying.

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

    I bought a bunch for 43 cts a piece 5 years ago. No postage

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

      Deal of the decade, that was Fred. Were you in China at the time?!?

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

      @@RalphBacon nope. Just aliexpress. Bought some rechargeable button cells for them as well

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

    At 3:42 you say, referring to setting an alarm time "you can have days weeks MONTHS hours minutes seconds" but neither alarm1 nor alarm2 allow for MONTH. Maybe in a short month you could specify a day of month of 31 and not alarm at the end of the current month (I haven't tried that), but there is no alarm register that will accommodate a month number (or year number, for that matter).

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

      You are right, the granularity stops with days. Which is a shame really, because if you wanted an annual or bi-monthly reminder it can't be done (easily).

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

      @@RalphBacon Thirty days hath September / April, June and November / All the rest have thirty-one / Except February which hath but twenty-eight days clear / or twenty-nine in each leap year. :)
      Calculating a leap year:
      Divide the year by four. If it does not divide evenly, it's not a leap year, otherwise go to the next step.
      Divide the year by one hundred. If it does not divide evenly, it's a leap year, otherwise go to the next step.
      Divide the year by four hundred. If it does not divide evenly, it's not a leap year, otherwise it is a leap year.
      Yes, it's complicated. The complexity is because the Earth's orbit around the Sun isn't an exact number of days. It's _almost_ 365 and a quarter days, but not quite, which is why a leap year has to be skipped every so often.

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

    Please pardon the intrusion for jumping on this thread but I'm quickly approaching the end of my reason and am no closer to a solution. I have watched ALL of your low/save power Arduino videos but I don't have the knowledge to use the info effectively.
    I am trying to build the most efficient battery powered circuit that will illuminate a LED when movement is sensed by a PIR. This will only happen during 'night' hours meaning start at 4pm in winter & 9pm in summer. My idea is that it would power off at say 12am and then repeat 24hrs later. I acknowledge thast the change from winter to summer time will be manual.
    My proposed solution is ...
    Use Arduino to programme a RTC with actual time together with relevant start and finish alarms.
    @ Alarm 1 the RTC (running 100% on internal battery) will send a signal to the gate of a BJT.
    In response the BJT will switch power to a PIR.
    When the powered up PIR senses movement it will send a signal to a 2nd BJT.
    This second BJT will switch power to the LED for as long as movenment is sensed.
    When movement stops there will be no signal from PIR to 2nd BJT thus cutting off power to LED.
    Process continues until Alarm 2 when the RTC will stop sending a signal to the first BJT.
    No power will flow until the Alarm 1 is triggered the next day.
    Is this possible?
    Am I thinking about it the wrong way?
    Can an RTC alarm be used as described to stop a singal being sent to the first BJT?
    I love the comment (from another project)... "It's impossible to over-engineer hobby projects" 😂
    Again I do apologise for the hijacking but desperate people do desperate things at desperate times.

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

      I feel your frustration but, as always, there is a technical solution, just maybe not the one your were expecting!
      Whether you can _directly_ power an LED (I'm assuming a proof-of-concept 5mm LED?) from the PIR, rather than use a microcontroller, I cannot say as I've never done it. Using a BJT might work, but again it's not a path I have trod before. Sounds plausible.
      You can certainly use an RTC (DS3231) to switch on (and off) something like an Arduino ATMega328p chip (not the board, like an UNO, as that consumes far too much current). As the RTC is independently powered, usually by a 2032 button battery) it won't cause your main power source to become depleted.
      The PIR needs powering too and from what I recall they are not so low-power friendly. Usually, you would have to either power continuously or *use a solar cell* during the day to charge a Li-Ion battery for use overnight. The PIR needs to be active during all the night hours so current consumption becomes a factor.
      The advantage of a rechargeable circuit is that Arduino chip can also be powered from it, albeit only when the PIR detect a movement, sends a signal to the Arduino to wake it up from Deep Sleep, light LED for as long as it gets the PIR signal, and then go back to Deep Sleep (the ATMega328p only needs < 1μA when in Deep Sleep).
      TL;DR my take on this would be to use a solar/rechargeable solution, with a standard Light Dependent Resistor (LDR) that determines when the circuit as a whole should run. Thus, no need for an RTC at all. There are millions of light-level switch circuits out there on the Internet (basically a comparator circuit).
      This LDR circuit could then trigger and power an ATMega328p chip with minimalist circuitry just like my demo. It would be in Deep Sleep for 99% of its life but would wake up when triggered by the PIR's output. That would then control the LED whilst it was getting the trigger (and could extend the light's duration, just like your security light). A BJT might be all you need at this stage, no μC at all!
      Whilst using discrete components as you suggest _might_ be possible, it's not the way I'd do it. Whilst you mull over some possibilities I'll try and see whether I can devise an analog circuit with a DS3231 and PIR to do what you initially proposed.

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

      @@RalphBacon
      Thank you, Ralph, for taking the time to consider my post and reply.
      I have sucessfully driven a LED via a BJT (2N2222) from both PIR #1 & PIR#2. I haven't yet tried this on P1R#3 - see below.
      Are you saying that an RTC (DS3231) via a second alarm can effectively stop sending the signal from the first alarm? If so, this is very encouraging.
      It is my intention to power both PIR and LED from the same battery.
      To date I have looked at three PIRs...
      PIR #1 is an HC-SR501 which uses 65mA. However this model can be set up to continue sending a signal while it senses movement.
      PIR#2 is an AM312 which is marketed as Low Power. In my experience this is very low power & does not have the option to set a delay.
      P1R#3 is a RCWL-0516 which uses microwaves and is very low power. It generates a 3.3v output but no control over the delay time.
      This particular project is not solar friendly. I am trying to draw attention to a sign when a person enters a corridor. The corridor has windows and the sign is obvious during daylight. However, it is easy to miss under artifical lighting. While access to the project is fine unfortunately there is no convenient source of AC power.
      I think I'd be able to complete the project using a bare bones Arduino (and I probably will for practice) but at this stage I am trying to design the simpliest solution I can think of.

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

      So having scribbled out a diagram or two, it quickly became apparent that doing this with analog/discrete components without some sort of microcontroller was becoming far too complex.
      Then I had the thought to consider how my garden ornaments lit up at night; most were solar powered (charging during daylight hours) but we also have one, battery controlled PIR light that works very effectively.
      It's a commercial device, cheap and there are unmpteen variations on the format and design, but all fall within your brief of a battery-powered device that lights up something when movement is detected during the hours of darkness. Here's a link to what I have, but as I say there are many of this format: amzn.to/3vzqgdd
      There is one downside to this particular device (and, come to think of it, many of this type): they are easily detachable (mostly magnetic) because they need regular recharging via a USB port or need new batteries now and again. Great for the home user, maybe not so great for a public place with light-fingered visitors? You may need a different format device or some way of securing it (which might include placing it high enough so that it cannot be reached without a ladder, for example).
      I hope this "blue-sky", "out-of-the-box," "pushing the envelope" thinking may help you in coming up with a solution that is cheap and easy to install! Sometimes the easiest solution if one that has already been thought of and manufactured.

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

      Thanks again for your time and recommendation.
      I assume the PIR becomes live when ambient light is low i.e. when it gets dark.
      I'm trying for a situation where the PIR becomes active within defined on/off times.
      My original goal was to design the simplest project possible but it looks like I will need to include an AtMega328 chip to achieve that.
      Thanks again

  • @SurajChauhan-po8ll
    @SurajChauhan-po8ll 3 ปีที่แล้ว

    How to set the clock to 8MHZ IN ARDUINO IDE?? Because in Arduino ide default clock is 16mhz. Please give me suggestion, so that I can run an atmega328 without a crystal and program it using Arduino ide

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

      www.instructables.com/id/Configure-Arduino-IDE-for-Atmega-328P-to-Use-8MHz-/
      untested, might help

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

      Watch his earlier videos...

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

      See video #117, #119, #116 Suraj, bound to be something there.

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

    Do you just send SQW --> Gpio something and detect the low in software?

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

      Yes. The Arduino is in Deep Sleep (suspended, effectively) but will be woken by a LOW signal on the chosen GPIO pin because your code told it (attachinterrupt etc).

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

    Warning !!!!!!!!!!! The module (DS3231) is delivered with a CR2032. This is a lithium battery.
    That would be no problem if the module did not have an armed charging circuit. During operation, the input voltage of the module is on the battery, and this can also be 5 V. The charging circuit can be removed by removing the diode (red) or the 201 above or by interrupting the line.

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

      Indeed, Thomas, and you're not the only one warning me (and others) about this. Crazy design decision.

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

      @@RalphBacon What do you make of MAXIM's statement on the DS3231 datasheet "The device is UL recognized to ensure against reverse charging when used with a primary lithium battery." Is there evidence of problems, rather than a theoretical concern? (I sound like Dr. Fauci.)

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

      This should be a pinned comment.

  • @jenadolfo9358
    @jenadolfo9358 22 วันที่ผ่านมา

    i got compilation error it says: Compilation error: Arduino_Sleep_DS3231_Wakeup.h: No such file or directory
    how to fix this?

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

      You need to add a line at the top of your sketch to include that libraty:
      #include "name of library here.h"
      and that should do the trick. Make sure the library is in your library folder!

    • @jenadolfo9358
      @jenadolfo9358 18 วันที่ผ่านมา

      @@RalphBacon i use Arduino IDE, i use exactly the code you use and it says that error. I try to find that library, I also write it at the top of my code still error

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

      Where have you put the library? It should be in the libraries folder, which is normally a sub-folder in your sketches folder.
      Just to test it out, you could put the library files (not the folder) in the same folder as your sketch but it will be a bit messy!

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

    Can it wake up a Wemos D1 from deep sleep every 15min from 18h to 7h30?

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

      The way you could do this is to set the alarm (programmatically) to 18:00h. On wake-up the Wemos does its stuff then sets the alarm for 18:15. Wash, rinse, repeat until 7h30 at which point it sets the next alarm for 18h.
      Remember that "wake up" in this context means a fresh reboot - you will have to restore any values you need in the setup( ) routine.

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

      @@RalphBacon I was able to hammer it together, thank you. The ESP8266 needs a quick LOW pulse to its RESET pin in order to wake up from deep sleep, however, the pulse coming from SQW on the DS3231 stays LOW after the alarm is triggered until your clear the alarm flag and set a new alarm. Therefore, to convert this constant LOW into a quick LOW pulse, I used the "esp8266 dtr reset circuit" found online. As soon as the ESP8266 gets this pulse, it resets and immediately sets a new alarm, and SQW is HIGH again. I used the library by Rodan like you showed. Thank you again.

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

    Please, add scheme. It's takes a lot of time to understand what you do. Thanks a lot!

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

      Very sorry, it's too time-consuming to add an actual schematic but I've added a new file describing how to connect the DS3231 to the Arduino. I'm sure it will help you.
      github.com/RalphBacon/192-DS3231-Wake-Up-Arduino

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

    16:10: Should lines 59 & 60 be reversed? Right now you are setting it LOW first and then you instruct the MCU that this is an output.

    • @karens-jclark4199
      @karens-jclark4199 3 ปีที่แล้ว +1

      Hey LJ .
      No , I think Ralph did that as setting as output first will set the pin to high .
      Set as low first and it will start low .
      The way you are thinking will send a high pulse before going low .
      Ralph did explain this in a video , only I cant remember which one ...
      Maybe Ralph can remember or explain a little better ... :)

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

      Karen is correct. By setting the HIGH/LOW first avoid any microsecond blip as the set the pin to OUTPUT and then digitalWrite it LOW. Nick Gammon (no relation) taught me this so who am I to argue?

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

      @@karens-jclark4199 Thanks

    • @karens-jclark4199
      @karens-jclark4199 3 ปีที่แล้ว +2

      @@LJWinkler247
      No problem ... Picked this up from Ralph , lots of good info from Ralph .
      Happy to help when I can :)

  • @mr.mythoclast4451
    @mr.mythoclast4451 3 ปีที่แล้ว

    Sony/Murata VTC6 - 3000 mAh without any protection

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

      That is certainly a high capacity 18650 (assuming it's genuine) and at just a fiver each (in the UK) good value too.

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

    Under which stone do you come from ;) You can get 3400mAh and they are really 3400mAh tested it myself (Warning buy the good ones with proof from buyers)

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

      I live in a cave, Albert. I don't get out much. Only Benny to visit me. And Dougle. So I am well behind the times as Henrik Jensen (comment below) has indicated with a very useful chart indeed.
      lygte-info.dk/info/batteryIndex.html

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

    Thank you
    Please replicate same with ESP8266 :)

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

      The ESP8266 does things a different way, when waking from Deep Sleep. It just "reboots" and there is a flag that the developer can read to detect it is, in fact, rebooting from so-called Deep Sleep rather than just being switched on at the plug. The only way it can "remember" values is by writing them to the RTC's RAM area before it goes to sleep. But it doesn't resume execution from the next statement in the sketch, it just starts the sketch from the very start. Not so great. But the DS3231 could trigger the reboot, I guess. Watch video #116 (th-cam.com/video/NgPwPKXCLFY/w-d-xo.html ) to see if that gives you the answer.

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

    Hello sir how are you 😊

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

      All good, Yogesh, I hope you are too.