Voltage Controller

Suppose I had a system that needed 5V to 12V as power. Suppose, also, that I power it with a 9V battery. After a while, the voltage of the battery drops, potentially causing unwanted side effects in the system. Beside using a relay, is there a way that I can only allow current to flow if the voltage is above 5V, and below 5V, it shuts off, turning off the system? So only voltages above 5V would be allowed. Anything else would be 0V.
I know I could use an op amp, but I want this "regulator" to be independent of another power source, if possible.

Thanks.

One approach at those voltage levels is to use a CMOS set-reset flip flop. Have a power-on button to set it and a comparator to reset it when the voltage falls below 5V. The output of this then drives a logic-level MOSFET to switch power to the load. CMOS 4000 series are typically rated for 3V to 15V, the comparator circuit will need some sort of voltage reference but this doesn't have to be too critical, comparing that to a voltage-divider across the supply.

You want this power control circuit to only take a tiny current - otherwise it will drain the already low battery and start to misbehave itself. CMOS is ultra low power but the comparator and voltage divider will have to be carefully selected. The search term 'micro-power' is useful here.

How can I use a comparator if I don't have a steady ref. voltage to compare it to?

Some sort of voltage reference, say a zener diode, can be used. There are voltage reference chips too, of varying accuracy. Here the important parameter is current consumption - a zener is easy to bias at a very low current (although the voltage will be somewhat lower than nominal).

Its worth googling around for a power-management chip that already does all this...

the voltage regulator on the arduino stops working around 7 volts

So is a relay actually the easiest?

Technically, a Voltage regulator is an OP AMP with a voltage reference. Look at the design of a legacy LM723.

http://www.national.com/ds/LM/LM723.pdf

I think you are thinking about this too hard. You are describing regulator "drop out", which a regulator like a LM7805 will want to do somewhere between 6 and 7 volts.

Now, if you wanted to do this with a little bit more control... start looking at circuits based on the LM431. IN the design ideas section of the data sheet, there is "Over Voltage/Under Voltage
Protection Circuit" or a "Voltage Monitor" as good ideas to think about. http://www.national.com/ds/LM/LM431.pdf

...and "no" using a relay is not a good idea. It makes the solution too complicated. Simply pinching off a PASS TRANSISTOR is probably the best solution.