Battery Charger - Ino
Battery Charger - Ino
Battery Charger - Ino
batteries (LAB),
* but it can easily be adapted for another LAB's and/or charge values.
* Before I give an explanation, intended as a guide, about charging LAB's; an
important note:
* ***** Do NOT leave a LAB in a discharged condition or discharge it too low
******
* This will drastically shorten its life, if not completely destroy it! Always
charge
* a LAB after usage, a.s.a.p.! There are different types of LAB's, each with its
own characteristics.
* There are open LAB's and closed LAB's, also called VRLA (valve-regulated-lead-
acid), such as gell-
* and AGM-batteries. Batteries are build for different purposes; deep-cycle, car,
marine, etc, etc. Each
* have their own characteristics and charge patterns. If you want to know more
about LAB's, a highly
* recommended read would be: http://www.victronenergy.dk/upload/documents/Book-
Energy-Unlimited-EN.pdf
* Each LAB knows 3x charge-stages; Float-, Absorption- and an Equalisation-
charge. Normally an
* absorption-charge is sufficient to recharge the battery and to keep it in a
good shape. After
* the absorption-charge, a float-charge can be applied to keep the battery
constantly "topped-up".
* An Equalisation-charge is only required either; every few months or when the
specific-gravity of
* the acid in a individual cell differs more than 0.02 sg compared to the other
cells, from
* the same battery. Via a switch, the charger can be set for 6V or 12V. Another
mode-switch selects
* absorption-charge (Trojan 6V T-225: 7.40V, 12V: 14.8V) or equalization charge
(Trojan: 7.75V / 15.5V).
* In either case, this sketch will keep the voltage at the absorption voltage /
float level,
* or at the equalization voltage level; whichever charge-mode has been selected.
* In the absorption-mode, when the current reaches 2% of the battery capacity,
* the battery is considered to be full; in this case 2% of 225Ah = 4.5Amps @
7.40V.
* When in absorption charge, this sketch switches to float-charge as soon as the
"battery full
* current" is reached. Be aware that this isn't the case in equalization mode!!
* The duration of an Equalisation-charge should be no longer until the acid
specific gravity of all cells
* have an equal, or nearly equal readings. An Equalisation charge is very hard on
the battery
* and should only be performed when necessary, as short as possible and
manually / observed.
* In no way the charger & battery should be left unattended during an
equalisation charge.
* Each type of LAB has its own manufacture recommended charge-voltages. Check
yours first!!
* Since charging of a LAB is a chemical process, it needs time to occur. The
charge-current
* for a LAB is therefor max. 10% of the battery capacity. For a 225Ah LAB, this
is no more
* than 22.5 Amps (lower is fine too). Of course, the charge-source self, the
Mosfet and the cables,
* all have to be suitably rated for these high currents.
* During charging, a close eye needs to be kept on the temperatures of all
components involved;
* the Mosfet, the battery, the cables, panels / transformer etc.
* The same schematic pricipals were used as from lewis Loflin
(http://www.bristolwatch.com/solar1.htm).
* If you like an excellent thorough explanation of how the schematic works,
please visit his website.
* An Arduino (in this case a Arduino mini pro) steers, via a NPN transistor, a
"P-channel" Mosfet.
* The In/Out voltage is read via a resistor voltage divider and the current is
measured via
* a 25Amp ASC711 Hall Sensor.
* Combined with LED-indicators, a 16x2 LCD is added for read-out, checks &
messages.
* The Arduino is powered via a 5V L7805, 1.5 Amp voltage regulator. The regulator
is connected to
* the incoming voltage on the charge-side.
* When, instead of Solar-panels, a transformer is used, a circuitry protection
against induction
* Voltage-spikes has to be included.
* When the charger is connected the the battery and switched on, best is to press
the reset-button.
* This will ensure that the Arduino has the latest correct Voltage readings.
Failure to do so,
* may cause that the Arduino has incorrect readings in its memory, taken while
starting up / connecting up.
* For in the 12Volt charging mode, a cooling fan with an LM35 temperature sensor
can be included.
* To include, all the code in between the "optional cooling fan" dotted lines
have to be Uncommented.
* This example code is in the public domain.
*
modified 24 November 2015
by RvD.
*/
void setup() {
void loop() {
//---------------------------Begin of 6V Equalisation
loop------------------------------
// Because the Charge-Transformer is AC, more Voltage readings are taken and
then averaged out
int j = 1; // set, or reset, counter
averageChargeReading = 0; //reset averageAmpVoltage
while (j <= 2 * periodTime) {
averageChargeReading += analogRead(chargeReading);
j++;
delay(1);
}
Serial.println(chargeVoltage);
LCD.home();
LCD.print("Batt Volt LOW!");
LCD.setCursor(0, 1);
LCD.print(" ");
}
LCD.home();
LCD.print("Equal ");
LCD.print("Batt=");
LCD.print(batteryVoltage * conversionFactor6V);
LCD.print ("V");
delay(0.5 * chargeON);
digitalWrite(transistorPin, LOW); // transistor turns off, Mosfet gate goes
HIGH => OFF
digitalWrite(zenerByPassPin, LOW); // set zener bypass Mosfet LOW, to
include Mosfet Vgs protection zener
} // end of if statement
} // end of if statement
else {
LCD.home();
LCD.print("Batt Volt LOW! ");
LCD.setCursor(0, 1);
LCD.print(" ");
}
LCD.home();
if (absorptionVoltage12V == floatVoltage12V) {
LCD.print("Float ");
}
else {
LCD.print("AbsP ");
}
LCD.print("Batt=");
LCD.print(batteryVoltage * conversionFactor6V);
LCD.print ("V");
delay(0.5 * chargeON);
digitalWrite(transistorPin, LOW); // transistor turns off, Mosfet gate goes
HIGH => OFF
digitalWrite(zenerByPassPin, LOW); // set zener bypass Mosfet LOW, to
include Mosfet Vgs protection zener
} // end of if-statement
// Because the Charge-Transformer is AC, more Voltage readings are taken and
then averaged out
int j = 1; // set, or reset, counter
averageChargeReading = 0; //reset averageAmpVoltage
while (j <= 2 * periodTime) {
averageChargeReading += analogRead(chargeReading);
j++;
delay(1);
}
LCD.home();
LCD.print("Batt Volt LOW! ");
LCD.setCursor(0, 1);
LCD.print(" ");
}
delay(0.5 * chargeON);
digitalWrite(transistorPin, LOW); // transistor turns off, Mosfet gate goes
HIGH => OFF
} // end of if statement
else {
LCD.home();
LCD.print("Batt Volt LOW! ");
LCD.setCursor(0, 1);
LCD.print(" ");
}
LCD.home();
if (absorptionVoltage12V == floatVoltage12V) {
LCD.print("Float ");
}
else { LCD.print("AbsP ");}
LCD.print("Batt=");
LCD.print(batteryVoltage * conversionFactor12V);
LCD.print ("V");
int chargeON = (absorptionVoltage12V - batteryVoltage) * 100; // determine
the Mosfet ON time
chargeON = abs(chargeON); // make it alway a positive number
delay(0.5 * chargeON);
digitalWrite(transistorPin, LOW); // transistor turns off, Mosfet gate goes
HIGH => OFF
} // end of if-statement
LCD.home();
LCD.print("Float charge ");
LCD.setCursor(0, 1);
LCD.print("Batt: ");
LCD.print(batteryVoltage * conversionFactor12V);
LCD.print("V ");
delay(20);
}
switchPosition = digitalRead(modeSwitchPin); // check swithMode for changes
chargeVoltage = analogRead(chargeReading); // check the chargeVoltage again
for 6-12V chargeMode
delay(10); // to allow anolagReading to
settle
} // end of else statement
//-----------------------------------End of 12V Absoption
loop------------------------
} // end of else statement.