I would like to be able to put a nano to sleep, and wake on D2/Interrupt. The interrupt should fire if ANY of four switches are triggered (two are shown for simplicity), but it should also be able to detect which switch or switches are in an alert state upon waking. (D4, D5)
Both are fine , just offered as an alternative for viewers .
IN4148 are cheap , about the same price as a resistor! Not that I expect it’s that important …
You can also buy resistors and diodes in multiple DIL packages , which might help a neater solution.
You don't need to connect one of the buttons to an Arduino pin. This will save you one potentially precious arduino pin. If the other buttons were not pressed, you know by process of elimination that the unconnected button must have been pressed.
Personally I would use diodes. Your transistor circuit still requires a resistor for each button. Diodes are pretty much the same size and there's no significant difference in cost unless you plan to manufacture millions of these circuits.
You could also just use a diode OR gate into d2 , and also connect the switches to other digital > inputs to see which input created the interrupt .
Thank you for that, Hammy. I appreciate the alternate solution as well.
With the OR gate, I'd be putting pulldown resistors on d4, d5, and d6, correct?
+1 for using pin change interrupts on the four lines, with internal pullup resistors. Then you can save D2 for something else. When the interrrupt occurs, you can just poll the lines until you find the one that's low. Put all four on the same port. No external parts needed beyond the switches.