Hello, I am aware that the mini can be put into a deep sleep and be "woken up" by a RTC interrupt, preform a task and go back to sleep. All of the examples I have seen so far are pretty "basic" (every (10) seconds a LED blinks ALL DAY LONG). I'm not inquiring "how" to do this". I am inquiring if these things are achievable. it is a battery powered project.
- RTC (MCP7940N), interrupts up at 9:00 pm, mini preforms a (2) second task, SLEEPS, then every (5) minutes preforms the same task again, SLEEPS. here's the catch. At 5:AM I want the Mini to go back to sleep until 9:PM.
I'm just looking for a yes or no's right now.
- I believe there is only one pin on the board for interrupts. (can't get the data sheet to open right now)
I have a secondary trigger/interrupt in addition to what the RTC will be doing. It is a PIR. It's function is to preform the same task as the RTC. EXCEPT it performs the task when motion is detected.
In order to detect motion of course it must also turn ON a 9:00PM and turn OFF at 5:00AM running in addition to RTC's interrupts.
Keep in mind that the PIR will have to run from start to finish ex. 9:00PM to 5:00AM with the mini in sleep mode would be the perfect scenario.
Though I would like to be able to rearrange the schedule EX: 7:00PM to say 2:00AM with both interrupt devices functioning in the same described manner.
Is it possible to use the serial port for one and the interrupt pin for the other?
Thank you, there's another component in the project however if the above isn't achievable there's not much point in continuing.
The mini has two interrupt pins. How would you use the serial port? What is the "another component"? Will it add more special input requirements?
Question 1) - Quote from datasheet: "The MCP7940N features two independent alarms.
Each alarm can be used to either generate an interrupt
at a specific time in the future, or to generate a periodic
interrupt every minute, hour, day, day of week, or
So, yes. You can do this. Set the Alarm for 9PM. When it occurs, enable the Interrupt for every five minutes. Every five minutes, once you do whatever you want to do, check the time. If it is 5AM or later, disable the Interrupt for every five minutes.
Question 2) - Actually most of the Pins can be set up to Trigger an Interrupt. The Pins which are specifically for this purpose (Pins 4 and 5 on the chip, designated as D2 and D3) are just easier to use that some of the others. However you go, you can always poll to find out WHICH pin caused the Interrupt.
Changing the times from 9PM or 7PM or 2AM to 5AM is simply in the coding. If you hard code them, you can always Change the program. If you try to use some type of configuration the bigger question is how to Change the configuration (menu driven, several pushbuttons, read from SD Card, etc. The sky is the Limit)
the 3rd component is an adafuit fx sound board. I don't know much about serial stuff yet, but I think if I read right it can be controlled via serial.
so the next question or challenge is the volume is adjustable from 0 to 225. when interrupted by the RTC I want the volume raised. if it is interrupted by the PIR I want it lowered. unfortunately when you power off the fx board it loses the former vol setting. and in this case I want to have 2 different settings. which makes it a bit more complex.
so first it needs to determine the source interrupt, set volume, play, sleep, is how I imagine it.
am I on the right track?
it also has 10 triggers pins and uses a naming protocol to loop, play once, play random etc. I was thinking for simplicity using a rotary with 10 selections to pick the output pin of the fx. just dial in 1,2,3 or 4.
Honestly, I never approach a project like that without building test sketches to actually implement the basic functions. Then questions like the ones you are asking, are phenomenally easier to solve. It's because they become specific problems, not general ones.
I understand and agree there are more underlying variables and items that need to be taken into consideration. I was just thinking if all you need to do on the fx board is gnd 1 of 2 pins to make the vol go up or down that it may be possible to have the mini do it. (or simulate it) the triggers are the same way just monetarily grn a pin and it plays that track.
another one that has caused grief is the PIR output signal can be from seconds to minutes. like I said just checking to see the possibilities and appreciate any input. it seems most everyone has a “specialty” that they know a lot about and maybe I will run across an audio output fanatic that controls sound boards through serial port. never know.
once I find out if all the things “can be” accomplished I will more than likely just hire someone to put it together.