Hi There,
This is a terrific library (thank you!) and yy apologies if this is not in the correct location but I can't for the life of me figure out what my issue is. I'm using your DS3231_intalarm example to detect an alarm is fired. I'm using an ESP8266 since i want to add Wifi to my project once I get this sorted out. My ultimate goal is to put the ESP8266 into light sleep and wake it up from a daily alarm triggered by the DS3231. So far, I've been able to use this library to read the time and set alarms.
Here's my issue: I'm able to set the alarm but it seems to fire every second. I've tried adding a pullup resistor (10k down to 220O) to VCC as I've read elsewhere the output pin of the DS3231 needs to be tied to VCC. However, when I do that, the alarm never fires. I've experimented with different size resistors but the result is either one of these two outcomes: 1) the alarm seems to fire every second or 2) it never fires.
Here is the output to my Monitor when it fires every second:
20-08-2017 23:17:03 - Unknown
20-08-2017 23:17:06 - Unknown
the 20 second alarm just went off!
20-08-2017 23:17:09 - Unknown
the 20 second alarm just went off!
20-08-2017 23:17:12 - Unknown
the 20 second alarm just went off!
20-08-2017 23:17:15 - Unknown
the 20 second alarm just went off!
20-08-2017 23:17:18 - Unknown
the 20 second alarm just went off!
And here is my code:
`#include <Wire.h>
#include <DS3231.h>
DS3231 clock;
RTCDateTime dt;
volatile boolean alarmFlag = false;
void alarmISR()
{
alarmFlag = true;
}
void setup()
{
Serial.begin(115200);
// Initialize DS3231
Serial.println("Initialize DS3231");
clock.begin();
clock.armAlarm1(false);
clock.armAlarm2(false);
clock.clearAlarm1();
clock.clearAlarm2();
//set a 20 second alarm
clock.setAlarm1(0, 0, 0, 20, DS3231_MATCH_S);
// SQW pin on DS3231 to attached to pin 14 on ESP8266.
pinMode(14, INPUT_);
attachInterrupt(14, alarmISR, FALLING);
}
void loop()
{
dt = clock.getDateTime();
Serial.println(clock.dateFormat("d-m-Y H:i:s - l", dt));
if (isAlarm == true) {
Serial.println("the 20 second alarm just went off!");
isAlarm = false;
clock.clearAlarm1();
}
delay(3000);
}
`
Any help or advice would be greatly appreciated!
Hi There,
This is a terrific library (thank you!) and yy apologies if this is not in the correct location but I can't for the life of me figure out what my issue is. I'm using your DS3231_intalarm example to detect an alarm is fired. I'm using an ESP8266 since i want to add Wifi to my project once I get this sorted out. My ultimate goal is to put the ESP8266 into light sleep and wake it up from a daily alarm triggered by the DS3231. So far, I've been able to use this library to read the time and set alarms.
Here's my issue: I'm able to set the alarm but it seems to fire every second. I've tried adding a pullup resistor (10k down to 220O) to VCC as I've read elsewhere the output pin of the DS3231 needs to be tied to VCC. However, when I do that, the alarm never fires. I've experimented with different size resistors but the result is either one of these two outcomes: 1) the alarm seems to fire every second or 2) it never fires.
Here is the output to my Monitor when it fires every second:
20-08-2017 23:17:03 - Unknown
20-08-2017 23:17:06 - Unknown
the 20 second alarm just went off!
20-08-2017 23:17:09 - Unknown
the 20 second alarm just went off!
20-08-2017 23:17:12 - Unknown
the 20 second alarm just went off!
20-08-2017 23:17:15 - Unknown
the 20 second alarm just went off!
20-08-2017 23:17:18 - Unknown
the 20 second alarm just went off!
And here is my code:
`#include <Wire.h>
#include <DS3231.h>
DS3231 clock;
RTCDateTime dt;
volatile boolean alarmFlag = false;
void alarmISR()
{
alarmFlag = true;
}
void setup()
{
Serial.begin(115200);
// Initialize DS3231
Serial.println("Initialize DS3231");
clock.begin();
clock.armAlarm1(false);
clock.armAlarm2(false);
clock.clearAlarm1();
clock.clearAlarm2();
//set a 20 second alarm
clock.setAlarm1(0, 0, 0, 20, DS3231_MATCH_S);
// SQW pin on DS3231 to attached to pin 14 on ESP8266.
pinMode(14, INPUT_);
attachInterrupt(14, alarmISR, FALLING);
}
void loop()
{
dt = clock.getDateTime();
Serial.println(clock.dateFormat("d-m-Y H:i:s - l", dt));
if (isAlarm == true) {
Serial.println("the 20 second alarm just went off!");
isAlarm = false;
clock.clearAlarm1();
}
delay(3000);
}
`
Any help or advice would be greatly appreciated!