What is the best way to cut power from an Arduino nano without actually unplugging it?

I’m looking to create an alarm system (which is basically just a sound played from a speaker that is triggered when a magnetic Reed door switch is broken). However, as this is part of an installation, I’ve set it up so the alarm doesn’t go off even if the door gets closed.

I would like it to work in a way whereby the only way to disarm it would be to power off the Arduino itself. I would like to achieve this by having the user unplug an alligator clip from a contact point. I’m trying to figure out the best way to achieve this - I have one of these YwRobot Power MB V2 Units, so I was wondering if the was perhaps a way to wire up the alligator cable and contact point to this so I can have it power off this way?

Any help would be greatly appreciated.

It’s worth mentioning I’m using an Arduino nano.

Use the state of a pin to determine whether the alarm can sound or not. Use INPUT_PULLUP in the pinMode() for that pin and only sound the alarm if the pin is LOW. Connect the pin to GND using a wire that has an alligator clip on the end of the wire that connects to the pin so that the pin is normally LOW

So, the alarm is triggered and continues to sound because of your current code, which you have not posted, and because the pin is LOW. Removing the wire from the pin takes the pin HIGH and the alarm stops

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.