2016-06-06 at 1:39 PM #1547OleParticipant
I just got my Mayfly yesterday and totally love it so far.
I’m trying to use the interrupt from the clock to control an event but I have not been successful in detecting the interrupt.
I’ve been using the “interrupts” example from the Sodaq_DS3231.h library but it isn’t working.
Looking at the Mayfly schematic, it appears the interrupt output from the rtc chip is on pin A7 of the Mayfly. Is that correct?
I don’t know much about interrupts in general, but I assume I need to change the code to listen on the right pin.
All my attempts to edit the program have been unsuccessful so far.
Does anyone know how I could get this to work properly?
I appreciate any advice – thanks.
//Interrupts for Battery management/saving using MCU power down mode. /INT from DS3231 is connected to INT0 of MCU.
static uint8_t prevSecond=0;
void setup ()
/*Initialize INT0 for accepting interrupts */
PORTD |= 0x04;
DDRD &=~ 0x04;
attachInterrupt(0, INT0_ISR, FALLING);
rtc.enableInterrupts(EveryMinute); //interrupt at EverySecond, EveryMinute, EveryHour
// or this
//rtc.enableInterrupts(18,4,0); // interrupt at (h,m,s)
void loop ()
DateTime now = rtc.now(); //get the current date-time
if((now.second()) != prevSecond )
//print only when there is a change in seconds
prevSecond = now.second();
//Interrupt service routine for external interrupt on INT0 pin conntected to /INT
//Keep this as short as possible. Possibly avoid using function calls
Serial.println(" External Interrupt detected ");
2016-06-06 at 2:19 PM #1548Shannon HicksKeymaster
The Mayfly has 3 hardware interrupts, D2, D3, and D10. Since the first two are part of the serial UART, that only leaves D10 as the only available hardware interrupt. On the Mayfly v0.3 board, the RTC is connect to A7, so you have to use a “pin change interrupt” library to handle an interrupt from something other than one of the hardware pins. This can also be helpful if you’re looking for a trigger signal on any input pin.
The SODAQ pin change interrupt library works great for this: https://github.com/SodaqMoja/Sodaq_PcInt
You can also read more information about how SODAQ handles the interrupts on the Mbili, which is similar to the Mayfly. http://support.sodaq.com/interrupts/
I’m working on some sample Mayfly code for handling the pin change interrupts, I can hopefully post it soon, but the SODAQ links should help you in the meantime.
2016-06-06 at 2:31 PM #1549OleParticipant
Thanks for the info.
I’ll look into that for sure.
Would it be possible to cut the trace between them and run a jumper to D10?
- You must be logged in to reply to this topic.