user49596: 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

user49673: 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.

49596: <p>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</p>
 49673: <p>You need 3 pieces of code and one replacement:</p>

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

<p>2) Setup your RTC to fire an interrupt every 12 hours.</p>

<p>3) Since you have successfully implemented a sleep mode, try to wake your Arduino up using a hardware interrupt. See <a href="http://www.gammon.com.au/interrupts" rel="nofollow noreferrer">Nick Gammon's guide for interrupts</a>, 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. <a href="https://www.instructables.com/id/External-Interrupt-in-arduino/" rel="nofollow noreferrer">This guide</a> has good information for starters.</p>

<p>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.</p>
