I am trying to create a safety shut down system for a project that I am working on. part of the system powers a motor which opens and closes a valve and I need a secondary circuit which monitors the main systems power level and then, sounds a buzzer and closes the valve when the main systems power supply fails. I have no idea how to do this so any help would be much appreciated.