Compare some voltage to a value

Hey guys

For a class project, I'm doing the circuitry for a wind turbine that can power a light. We have the turbine constantly charging a battery, which will power the light. The idea is that it cuts down on cost, not eliminate it. So I need a way to switch between the battery as the power source and the power grid. My idea is to use an Arduino Uno microcontroller to sense the voltage output from the battery. If the voltage is below 0.7 V, send out a current on another specified pin to flip a relay so that the battery is taken out of the circuit and the grid is put in. If the voltage is above 11.7 V, send out a current to switch the relay back.

Other posts I've read mention using a voltage divider to take voltage readings, but I don't know if that's what I need or not. This is also my first time coding with an Arduino product. Any ideas on how to accomplish this are appreciated. Thank you.

The idea is that it cuts down on cost, not eliminate it

So, cut it down even further, use an op-amp, and cut out the expense of the microcoontroller.

We just want to set it and forget it. Wouldn't using an op amp be less reliable?

How does using an op amp enable the circuit to switch back and forth?

Wouldn't using an op amp be less reliable?

You mean, would a few common components be more reliable than a few common components and your software?

no i mean wouldn't the op amp be in danger of getting it's value changed if the device was hit

My group decided to use the Uno because one of our members already had one. Also, each member has to contribute to engineering a subsystem and programing counts, so we were intentionally adding some extra work.

How does using an op amp enable the circuit to switch back and forth?

The same way the Arduino uses op-amps to auto-switch between USB and external power sources.

Also what kind of batteries are you using?

Lefty

A 12V motorcycle battery I believe

I am familiar with most of the technical aspects involved with this but have trouble understanding how to actually implement them. Are there any good tutorials you've come across?