Keeping a circuit powered.

I have a mailbox alarm circuit that transmits a message to my receiver whenever the mailbox door is opened. The UNO circuit is powered up by the door opening and power is cut when the door closes. It works mostly, but, I believe a very fast open/close doesn't give enough time for the transmission to take place.

Is there any way to keep the circuit powered up beyond the door closing (relay? second power source?) to ensure it finishes? If I could hold a relay open for 30 seconds, that would work.

For obvious reasons, I don't want the power on 24/7.

Thanks for reading this. Circuit/code upon request.

What about a large capacitor across the 5V input or whatever input you're using? Upon opening, it instantly charges up. Then when the door is closed, it takes time to discharge and provide power to your UNO. You can make UNO beep once it turns on so you can time how long it takes it to turn off with a particular capacitor. Also, if you remove the bootloader from UNO, you save a second in the beginning. Maybe that's all you need.

You'd need a pretty large cap to do that with an Uno, since it draws ~50mA. If you used a pro mini with the LED removed instead, you'll significantly reduce power consumption, which would make the cap needed smaller... On the Uno, you're powering a bunch of auxiliary hardware in addition to the chip...

Using a pro mini with the LED removed, I'd put the board into sleep, and have the mailbox door switch be the thing that woke it. So it'd wake up on low level on int0 (connected to door switch), send the message, and then go back to sleep when it had (regardless of whether the door was closed immediately because The Flash is delivering your mail, or left open), and power would be applied continuously, but power usage would remain very low.

(see nick gammon's power usage arduino page - you can get the power usage way way down)

Thats probably the best way to go.

If I understand correctly, the power source is applied to the Arduino by a switch which is active when the door is open.

If you have a relay that is in parallel with the door switch, then the Arduino can activate the relay immediately upon power on and hold it in the on state until it has finished the transmission task. At that point it deactivates the relay. If the door is closed this removes power. If the door is not closed power is removed when it closes.

Thanks for the responses.

How big a capacitor is needed?

I think I'll play around with a relay to see if I can make that work. While low power usage would work, I really like the idea of zero power unless the door is open.

Are you able to rewire it to where the door just sends a signal to the arduino and not actually power the arduino?

With this, yes the arduino will be on 24/7 but the arduino has a sleep mode feature that can be triggered by an interrupt pin. Door opens, it sends a 5v signal to the arduino to wake up. Door closes and a timer starts on the arduino for say 5 seconds. During the 5 seconds, the arduino sends it’s data then goes back to sleep.

What is the arduino sending data to and have you thought about just a regular transmitter module that only transmits a simple signal to an arduino somewhere. Then on that arduino you can have it show a message when it receives said signal.

Yes, the door switch is just a normally open switch, currently connected to power. So it would quite easy to connect instead to an i/o pin. How does the sleep mode work? This might also cover the problem when the door isn’t closed completely, thereby leaving the circuit powered.

The code as it stands is super simple.

(code below, can’t figure how to embed within code block)

#include <VirtualWire.h>
//Remote Mailbox Code

const int trxpin=12; // 0 for tiny, 12 for uno

void setup() {
// declare the ledPin as an OUTPUT:


void loop()
Serial.println(“sent “open””);


void send(char *message)
vw_send((uint8_t *)message, strlen(message)); //virtual wire send message function
vw_wait_tx(); //Blocks til tx is done

Sleep mode explained. Thanks Nick.