Wake Arduino from 4 buttons.

For the discussion of Arduino related topics.

Moderator: phalanx

Post Reply
Posts: 1
Joined: Sun Nov 19, 2017 7:30 am

Wake Arduino from 4 buttons.

Post by kshepitzki » Sun Nov 19, 2017 7:48 am

I am working on a project using ATmega328 that requires waking up from sleep mode using button presses. Several articles explain how to do that by connecting the button to the interrupt line INT0 or INT1.

However I have 4 SPST buttons but only 2 interrupt lines. Each button needs to be able to wake the controller and as it wakes up the controller needs to know (e.g. by reading digital pins) which button was pressed.

The project is single battery operated so needs to be very energy efficient.
I am embedded SW eng', so I understand HW if explained slowly :-)

Any suggestions for a simple HW solution?

I look forward to your solutions

User avatar
Posts: 333
Joined: Sat Apr 25, 2015 9:29 am

Re: Wake Arduino from 4 buttons.

Post by DanV » Mon Nov 20, 2017 8:27 am

Use Double pole single throw buttons and parallel one N.O contact from each switch into a single interrupt line, then use the other pole from each switch into an input on the ATMega (4 inputs total).

Support Volunteer
Posts: 2148
Joined: Fri Jun 15, 2007 9:41 pm
Location: Eugene, Or

Re: Wake Arduino from 4 buttons.

Post by jremington » Mon Nov 20, 2017 9:49 am

Every digital input on the ATMega328 is an interrupt line. Use "pin change" interrupts, one per button, on separate Input pins. Pin change interrupts are not quite as flexible as the external interrupts, but will do what you want. No extra hardware needed.

https://thewanderingengineer.com/2014/0 ... nterrupts/

Post Reply