I want to power my Arduino using a Lithium-Ion battery. When the battery is below 3.0V, the power to the Arduino should be disconnected, and when it rises high enough again is should be reconnected again. The problem is I don't know how to do that. I thought about using a transistor that connects in series with one of the battery power lines, and let the Arduino check the voltage and if needed disconnect the transistor. The problem is, how to power it up again? Also if the Arduino provides power to enable the transistor, how should it get power to do that in the first place? Is there any better way to do this? The batteries get charged by a solar panel btw
You are correct - you can't use the Arduino to do it. You'll need to make a separate voltage monitor/control circuit which does nothing but watch the battery. In principle, something like
For this circuit, CMP1 is either a comparator or a rail-to-rail op amp which can operate at low voltages. D1 is either a zener or shunt regulator which gives a voltage of less than 3 volts (2.5 is common enough). M1 is a PMOS MOSFET with a low gate voltage requirement (well under 3 volts, and less than 2 would be better) as well as a low enough ON-resistance ($V_RDS(ON)$) to avoid much voltage drop at the Arduino. R4 is important to establish hysteresis - otherwise when the Arduino is turned off, with no load the battery voltage will rise, turning the Arduino back on, dropping the battery voltage and turning the Arduino off, etc.
The biggest problem with this setup is that it will constantly drain the battery, with the voltage reference, R1/D1 being the worst offender. But there is really not much you can do about it.
Protection circuits are available to do what you want without using the Arduino at all. If you are powering your project from a single 18650 Li-Ion cell, e.g., just search ebay for "18650 Protection PCB 1S", and you'll find lots of choices for less than $1. (Some 18650 cells are a little longer and include a protection board - these are sold as "protected") The protection boards are fairly self explanatory and typically provide overcurrent and over/under voltage protection. Connect the cell to the battery pads, typically labelled "B+/B-", and use the power/charge/discharge pads (P+/P-) to connect lithium power to your project. The board will shut off current to your project when the cell voltage falls below the cut-off threshold, typically around 3.0 V, but check the specs on the board you use. The specs will also tell you the voltage at which the board will recover from the undervoltage condition and allow power to be supplied from the cell again. The solar panels can charge the cell through the P+/P- pads as well, and will not overcharge the cell. If you are not using 18650 cells, find an appropriate protection board based on your maximum current demands. I'm assuming you are using a single 3.7V cell, or "1S" configuration. There are also protection boards for various numbers of cells in series, such as 2S (7.4V) and 3S (11.1V) and so on. Enjoy!
I know it's for a Lithium Ion battery, but could you get a Li-po battery alarm, and when the alarm sounds, activate a relay to disable the battery connection to the Arduino?
I saw a video about this a while back, but I'm not sure if it would work with a Lithium Ion battery.
Here is a link to the video, it may help you: http://www.youtube.com/watch?v=1Fs4SfVSsLk