Waking up my Arduino Uno with three switches

Hi,

For my snail mail notifier, I'll use three switches (reedswitches or contactors):

  • One on the flip cover in case I receive a letter
  • One on the front door in ase I receive an unregistered package
  • One on the back door to know when the mail has been collected

When Arduino detects mail arrives or is being collected, it will send a 433 MHz signal to a Raspberry Pi that wil do its magic (send me an e-mail and display something on a TFT screen) one or twice a day. Hnce, it wil sleep the vast majority of the day.

In your opinion, what will be te best way to wake it up when a door or filp cover is opened?

Are those battery operated Arduino boards ? Which Arduino boards and which batteries did you have mind ? When you power them with a power supply, there is no need to wake up.

Well, I was thinking stand-alone Arduino (i.e. 8 MHz ATmega 328 on a breadboard) for the final project.

I do have 10V DC near the mailbox but I'd really prefer too be able to use a button-cell battery or 3*AA depending on power consumption.

Do you know these : http://gammon.com.au/power https://code.google.com/p/narcoleptic/

When you filter the switch with a capacitor, and use the narcoleptic library to sleep 15ms, you can check the switch 67 times a second. More than enough I think. Running on 3 AA batteries should be possible for 1 or 2 years.

Peter_n: When you filter the switch with a capacitor, and use the narcoleptic library to sleep 15ms, you can check the switch 67 times a second. More than enough I think.

In your opinion, that's better than using the switch (activated once a day) to wake the arduino up?

I might not be a big difference:

  • You can use narcoleptic for sleeping for 15ms. The switch is only sampled 67 times a second.
  • You can use a less deep sleeping mode to keep interrupts enabled. You don't have to filter the switch.

Choose the one that you think is best. Both should work on 3 AA batteries for more than a year.

That link to Nick Gammon : http://gammon.com.au/power Search on that page for : "Waking from sleep with a signal". He had only 0.35 µA while waiting for LOW on INT0 and INT1 pins.

I think it doesn't make a difference whether the switch is activated every minute or once a year.

Peter_n: I think it doesn't make a difference whether the switch is activated every minute or once a year.

There must be a concept I don't get. There's no difference between waking it up once a day or several times a second ?

I ment: you have to detect the switch and you can't detect something without running some hardware (like the atmega chip in sleep mode).

But I did some rough calculations: Suppose when the Arduino wakes up, it runs for a very short time and goes to sleep. Some instructions take only 0.25us (8Mhz), but some Arduino functions take 80us. Suppose only 10us are needed every 15ms and the startup time with the fuses is 14 clock cycles without further delay. In that case the Arduino runs for 1/1000. Running for 1/1000 is still a lot ! Using the pin interrupt as show on the Nick Gammon page is better :P

Peter_n:
That link to Nick Gammon : Gammon Forum : Electronics : Microprocessors : Power saving techniques for microprocessors
Search on that page for : “Waking from sleep with a signal”. He had only 0.35 µA while waiting for LOW on INT0 and INT1 pins.

He’s waiting for LOW, so INT0 and INT1 are HIGH (with the internal resistance thingy [I’m really not confy with the Arduino yet]), right?

But, earlier, he’s saying he’s using 0.35 µA when all pins are imput and low :

All pins as inputs, and LOW (in other words, internal pull-ups disabled): 0.35 µA (same as before).

All pins as inputs, and HIGH (in other words, internal pull-ups enabled): 1.25 µA.

Why isn’t he setting it to LOW and waiting for HIGH then?

He uses the internal pullup resistor. I think that just one pin being high doesn't have a lot of influence.

By the way, 1.25uA could still be less than the internal leak current of the battery.

Peter_n: He uses the internal pullup resistor. I think that just one pin being high doesn't have a lot of influence.

By the way, 1.25uA could still be less than the internal leak current of the battery.

So:

  • Either I use the internal pullup resistor, look for LOW and close a circuit to ground with my switch when the door opens;
  • Or still look for LOW but use an external pullup resistor in a circuit that is opened by the swich when the door opens;
  • Or set the pin to LOW and look for HIGH, closing a circuit with 5v and an external pullup resistor?

Somehow, I prefer the idea of looking for HIGH rather than having current flowing 24/7. Especially since I have three switches and only two interrupt pins: I'll have to use at least another GPIO.

When the internal pullup is enabled, and a switch is connected to that pin, there is no current flowing. No current, like zero, 0mA. The internal pullup pulls the pin high, but the impedance of the pin is so very high, that it doesn't need current.

The ATmega328p has many PCINT interrupts. I think they can also can wake it.

Peter_n:
When the internal pullup is enabled, and a switch is connected to that pin, there is no current flowing. No current, like zero, 0mA.
The internal pullup pulls the pin high, but the impedance of the pin is so very high, that it doesn’t need current.

But are the three options I mentioned in my previous message ok?

The ATmega328p has many PCINT interrupts. I think they can also can wake it.

I think it depends how deep the chip is sleeping.