0

ok, Good morning, guys, with a data acquisition project, in this, I get data every 12 hours, even if it's only 12 hours, the arduino gets connected directly, and it's being powered by a 9v battery, for longer life of this battery, to try to hibernate the arduino with real time, using the real time clock 1302, you could help me to make a code for this clock, for I have never used it before! thank you

  • Arduino SE is only in English. Would you understand an answer in English? – Juraj Sep 17 '18 at 14:17
  • Yes, I understand perfectly. – Pedro Henrique Sep 17 '18 at 14:34
  • the translate the question to English with Google translate – Juraj Sep 17 '18 at 14:34
  • ok, Good morning, guys, with a data acquisition project, in this, I get data every 12 hours, even if it's only 12 hours, the arduino gets connected directly, and it's being powered by a 9v battery, for longer life of this battery, to try to hibernate the arduino with real time, using the real time clock 1302, you could help me to make a code for this crock, for I have never used it before! thank you – Pedro Henrique Sep 17 '18 at 14:38
  • When you have never used the ds1302, then keep it that way. Don't use it. The ds3231 is a lot better. Which arduino board do you use? For the ds1302, you can start here: playground.arduino.cc/Main/DS1302RTC Setting the arduino uno in sleep mode might not help, there are other components that use current. For sleep mode, you can start here: gammon.com.au/power – Jot Sep 17 '18 at 15:02
1

You need 3 pieces of code and one replacement:

1) Ditch ds1302 and get yourself an RTC with an interrupt pin (like DS3231 which Jot suggests). It will make your life easier.

2) Setup your RTC to fire an interrupt every 12 hours.

3) Since you have successfully implemented a sleep mode, try to wake your Arduino up using a hardware interrupt. See Nick Gammon's guide for interrupts, and read carefully about waking your micro with an external interrupt. You can prototype it using a pushbutton, which will either connect your interrupt pin to GND or Vcc. Use an appropriate resistor as well. This guide has good information for starters.

To sum up: you'll have your Arduino sleep at all times and your RTC set to fire a hardware interrupt. When fired, the interrupt wakes Arduino, and the interrupt code will handle your measurements.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.