Hi All,
I'm sorry if this isn't the proper place to ask this question but none of the other were too
Got this DS3231 AT24C32 IIC module from Ebay (http://www.ebay.com.au/itm/DS3231-AT24C32-IIC-Memory-Module-Arduino-Module-High-Precision-Clock-3-3-5-5V-/271302733176?ssPageName=ADME:L:OC:US:3160).
Long story short: trying to keep power consumption to a bare minimum.
I'm powering the module with D4 in series with a 220 ohm resistor (that line is also capped to gnd via a 0.1uF cap).
D4 is set to HIGH whenever I need to power up the clock.
In this case every time the module's INT/SQW pin goes low (by setting an alarm) it fires a low level interrupt on D2 to wake up the micro-controller and do whatever it needs to. After that I set D4 to LOW and power off the module.
I have the module's INT/SQW pin pulled up to 5V with a 10k resistor.
Everything works smoothly except that the power led on the module remains lit after setting D4 to LOW, albeit very dimly.
Didn't expect to get that led lit via the INT/SQW line... XD
Since it's draining power my question is if it's safe to remove the power led from the module - or if anyone else has done it too.
Here's the relevant code (loop fx) btw:
// WORK SECTION
// power up clock chip
digitalWrite (CLOCK_POWER, HIGH);
pinMode (CLOCK_POWER, OUTPUT);
// activate I2C
Wire.begin();
if (DS3231_triggered_a2()) {
Serial.println(" -> alarm2 has been triggered");
  set_next_alarm();
  // clear a2 alarm flag and let INT go into hi-z
  DS3231_clear_a2f();
}
Serial.println("I'm awake...");
struct ts t;
DS3231_get(&t);
Serial.print(t.hour);
Serial.print(":");
Serial.println(t.min);
delay(1000);
// finished with clock
pinMode (CLOCK_POWER, INPUT);
digitalWrite (CLOCK_POWER, LOW);
// SLEEP SECTION
// power down everything we don't need
// turn off I2C
TWCR &= ~(_BV(TWEN) | _BV(TWIE) | _BV(TWEA));
// turn off I2C pull-ups
digitalWrite (A4, LOW);
digitalWrite (A5, LOW);
// disable ADC
ADCSRA = 0;
set_sleep_mode (SLEEP_MODE_PWR_DOWN);
sleep_enable();
// Do not interrupt before we go to sleep, or the
// ISR will detach interrupts and we won't wake.
noInterrupts ();
// will be called when pin D2 goes low
attachInterrupt (0, clockWake, LOW);
// turn off brown-out enable in software
// BODS must be set to one and BODSE must be set to zero within four clock cycles
MCUCR = bit (BODS) | bit (BODSE);
// The BODS bit is automatically cleared after three clock cycles
MCUCR = bit (BODS);
// We are guaranteed that the sleep_cpu call will be done
// as the processor executes the next instruction after
// interrupts are turned on.
interrupts (); // one cycle
sleep_cpu (); // one cycle
// WAKES UP HERE
TIA,
Pedro