Hacker News new | ask | show | jobs
by fancyketchup 4485 days ago
This isn't to suggest that using the WDT in interval mode is the wrong approach, and I know there's a certain amount of elegance to doing everything with one chip, but you could still use the level interrupt by adding a 7486 (standard quad XOR gate). For the gate's inputs, you would use the reed switch and a output pin from the AVR, and the gate's output would go to the external interrupt line. If the ISR toggles the state of the output pin each time it runs, the gate's output is only in the IRQ-asserted state for as long as it takes the ISR to fire up--so you don't get constant interrupts while the switch is closed, only a single one on the opening and closing transitions.

The 74LVC86 variant only draws a dozen, or so, microamps, which is dwarfed by the current in the 10k pull-down resistor when the reed is closed, and comparable to the standby current of the radio in the new radio.

1 comments

I totally agree. There are definitely some more things like this that I could have done to reduce power further and use normal external interrupts. I was going for more of a general purpose sensor board though and wanted to keep it minimal. I could also have used the HIGH and LOW level interrupts on those pins and just change which it triggers on every time it triggered. But I decided to go with the WDT.