03 November 2016

AVR Alkaline battery charger

Alkaline battery charger with ATtiny13


After some experimentation, here is the schematic of a design idea for an alkaline battery charger utilizing an AVR ATtiny13 microcontroller. The μC provides trickle charging with adjustable duty cycle and voltage sensing for automatic shut down.





The microcontroller program can be developed, compiled with arduino environment and easily uploaded  to the attiny13 chip with an arduino as ISP.


Alkaline battery recharging circuits

Before you carry on reading please notice: I constructed the circuits below out of curiosity for the subject and for the fun of it. My humble advice for those who extensively use batteries is to just buy rechargeable ones ...


If you do a bit of internet research concerning the subject of alkaline battery regeneration-recharging you will realize that actually yes, alkaline batteries can be recharged. Moreover, in order to design a successful charger you'll have to follow a few basic rules.
  1. Do not exceed 105% (or better still 100%) nominal voltage otherwise the battery will leak.
  2. Do not expect to get full capacity after recharging.
  3. Use trickle (pulse) charging. It seems to do a better job.
  4. Lower constant current decrease the risk of leakage but increase charging time.
  5. Alkaline take its time to charge, be patient.  
If you follow the rules above your design will successfully charge alkaline batteries and other batteries as well...
Before starting to design an AVR charger I did some experimentation on my own. I used a 555 timer and a FET to drive current through a set of alkaline batteries and watch the results. I used discharged batteries of various voltage levels, from 1V to 1.3V. The test circuit is shown below.  

By trying and changing the resistor in series, R1 and talking measurements regularly, I arranged so that the current was kept rather low, below 30mA peak (15mA average with 50% duty cycle). I kept on taking voltage measurements on the batteries until they were charged. The frequency of the pulses was about 0.5Hz (1 sec charging, 1 sec pause). The supply voltage was around 12Volts unregulated provided from a small power pack.
From my own experience I can confirm that the simple rules above are valid. If you use higher current than 25~30mA (peak of the pulse) the batteries may leak. If you exceed 110% nominal voltage (capacity) the batteries will leak. (Forget the batteries on the charger for just a few hours, after 1.5Volt per cell has been reached and they will make a mess ...)

Notice that you can experiment with trickle charging using just a 555 as astable multivibrator, a diode (LED) and a resistor  to limmit the current. The 555’s output can source or sink up to 200mA. You need 30~40mA. The output voltage is about 1.7v less than power supply. The diode and resistor connected in serial will drop the rest of the voltage. The NE555 operates safely up to 16v DC. (This circuit has not been tested.)



After the initial testing was done the next step was to design an automatic charger that 
  • would use variable duty cycle, pulse charging 
  • measure charging level and shut down on its own
The first circuit at the top of the page does exactly these things. It utilizes an ATtiny13 8pin microcontroller so that, apart from the duty cycle adjustments, battery voltage can be measured via its DAC.
Before making this first ATTINY circuit I hadn't relized how easy it was to write and burn code for the ATTinys and use them for simple projects. All you really need is the Arduino IDE and an arduino board. http://hobby-electrons.sourceforge.net/components/ATtiny13/index.html

The program is developed with the Arduino IDE 1.6  for simplicity. If you know basic arduino sketch programming nothing really is different apart from the pin numbering. You will have to add the ATtiny13 "boards".  To do this you can try the link below: 
https://github.com/MCUdude/MicroCore#how-to-install

The sketch can be uploaded to ATtiny13 directly from the IDE using an arduino board as ISP. For more info on the subject take a look at te following links. They refer to attiny85 but to other tinys as well.
http://highlowtech.org/?p=1695
http://blog.roguecode.co.za/make-dirt-cheap-electronics-with-attiny45-arduino-nano/


Here is the project developed on breadboard (nano ISP and charger):
With reference to the schematics at the top of the page, notice that the value of R2 can be varied from 220ohms, for lower currents, to 100oms  for higher. Its value also depends upon the power supply voltage you are going to use. I experimented with unregulated power pack that provided aproximately 12V. I used 220ohms to charge one 1,5V sell and 100ohms for two batteries in series (3V).
The push button is used to change, increase the on time (mark) of the pulse effectively changing the duty cycle (and frequency). Duty cycle is changed in steps from 20% to 33%, 43% and 50%. You can change these steps or produce duty cycle higher than 50% by altering the onTime, offTime variables in the sketch.
Pulse frequency is not really critical for this application. With the delays selected for ATtiny13 the frequency is about 0.5Hz (pulse duration of 2 sec for 50% duty cycle).

And here is the sketch for the project:


 #include <avr/io.h>   
 #include <avr/interrupt.h>  
 //#define F_CPU 96000000UL // 9.6 MHz  
 const unsigned int greenLed=0;     // pin 5  
 const unsigned int chargePin=3;     // pin 2  
 const unsigned int buttonPin =1;    // pin 6 INT0  
 //const unsigned int sensorPin =2;    // pin 3 -> Analog 2  
 int offTime =100;  
 int cellVoltage=0;  
 const int Charged=300; //(~1.50/5)*1024;    // ~330 -> fully charged 1.6Volt  
 volatile int onTime=50; 
 
           // Interrupt service function,  
           //changes onTime (mark time) effectively changing duty cycle.  
 ISR(INT0_vect) {  
  //cli();  
  onTime+=25;   
  if (onTime > 100) {onTime=25;}  
  //sei();  
  }

 void setup() {  
  pinMode(buttonPin, INPUT);   
  pinMode(chargePin, OUTPUT);  
  pinMode(greenLed, OUTPUT);  
  digitalWrite(chargePin,LOW);  
 }

 void loop(){  
         // protection - no battery connected or below 0.8V  
  cellVoltage=analogRead(2);  
  while(cellVoltage < 160) {  
  digitalWrite(greenLed, HIGH);  
  delay(5);  
  digitalWrite(greenLed, LOW);  
  delay(5);  
  cellVoltage=analogRead(2); //pin 3  
  }  
  MCUCR = 1<<ISC01;        // set INT0 as falling edge trigger  
  GIMSK = 1<<INT0;        // enable INTO in global interrupt mask  
  sei();                     // enable interrupt  
  while(1) {                 // Endless LOOP  
       // Charge  
   digitalWrite(chargePin,HIGH);  
   delay(onTime);  
   digitalWrite(chargePin,LOW);   // switch off and check  
       // checking if charging level has been reached  
   cellVoltage=analogRead(2);    // pin 3  
   if(cellVoltage > Charged){  
    digitalWrite(greenLed, HIGH);  
    offTime=1000;         // or 10000, slow charge, does not shut down completely.  
   }  
   else {  
    digitalWrite(greenLed, LOW);  
    offTime =100;          // if voltage dropped charge again  
   }   
   delay(offTime);          // wait with chargePin off (pulse space)  
  }  
 } 

Since this is a μC project, by changing the program (sketch)  a very different,  perhaps more intelligent charger may be developed. But this will be covered in another post...

No comments:

Post a Comment