Go Down

Topic: Switch controlled soft-shutdown (Read 1 time) previous topic - next topic



In adding an ON/OFF switch to my Arduino project, I'm looking to implement a circuit that creates a timed delay following the switch being moved to the OFF position for the Arduino to do some clean-up before losing power.

I received some advice to add a resistor-capacitor circuit (2.2k ohm & 100microfarads)

The resistor and capacitor sit in series in a circuit parallel to the Arduino and battery circuit so that the Ardiuno-capacitor-resistor circuit remains closed when the switch is flipped to OFF.  When toggling the switch back and forth however, I see no delay from the Arduino's 'ON' LED.

Any help or advice is greatly appreciated... I am not very well electrically versed.




In my mind you need something where the arduino is responsible for turning its own power off, so something like a relay in parallel to the switch. When the switch is turned on the software also turns on the relay. When the switch is turned off the arduino detects this and shuts itself down, switching power off as the last thing.
Arduino Libraries https://github.com/MajicDesigns?tab=Repositories
Parola for Arduino https://github.com/MajicDesigns/Parola
Arduino++ blog https://arduinoplusplus.wordpress.com


What sort of timed delay are you hoping for? If you calculate the amount of charge in that capacitor and the current taken by the Arduino you'll see that the capacitor will only keep the Arduino powered up very briefly. You'd need to be monitoring the input voltage and do your shutdown code pretty promptly if you intend to do anything before the board dies.

Alternatively, if you can get away with the Arduino swoitching itself off (i.e. you don't need to cope with power supply failures etc) you can put a transistor in the power supply and let the Arduino decide when to switch itself off.

Coding Badly


Go Up