In the previous article we have seen the main characteristics of the linear charger IC AAT3681A.
In this article I want to share an example of use, connecting the AAT3681A breakout board to an arduino M0 and a 18650Guard.

this is the project:

Arduino M0 is powered via USB, this USB provides also a serial port communication useful to communicate the state of charging

Pin 2 of the arduino M0 is an output pin and it is connected to EN pin of the AAT3681A breakout board:

  • a logic “HIGH” to EN pin enable the IC to starts charging the battery
  • a logic “LOW” to EN pin disable the IC and it stops charging the battery, the IC also go into shutdown state

Pin 3 of the arduino M0 is an input pin and it is connected to STAT pin of the AAT3681A breakout board:

  • reading a logic “LOW ” from STAT pin means that charging is complete and/or there is no battery charging activity
  • reading a logic “HIGH” from STAT pin means that the battery is in charging

The voltage reference for the STAT pin is decided by the voltage on VIO pin that in this case is 3.3V because arduino M0 works with 3.3V.

The IN pin is connected to the 5V of a USB cable: chose a good quality USB cable to avoid undesired voltage drop on it.

connect the BAT pin of the AAT3681A breakout board to the 18650Guard VBAT+ pin, choose short and wide cable as possible, however common cable should be ok cause the low charging current.

Here is the code for the arduino, a very simple code that allow you via USB serial to know the state of charging:


bool charging = 1;// state of charge, 0 is not charging , 1 is in charging

void setup() {
// put your setup code here, to run once:
pinMode(2,OUTPUT);//EN pin
pinMode(3,INPUT);//STAT pin
SerialUSB.begin(115200);
digitalWrite(2,LOW);//disable charging
delay(10000);
}

void loop() {
// put your main code here, to run repeatedly:
digitalWrite(2,HIGH);//enable charging
int readStat = digitalRead(3);

if(readStat==0)
{
SerialUSB.println("Charging battery!");
}

else if(readStat==1)
{
SerialUSB.println("Charging complete (no charging activity)");
}

delay(1000);
}

Battery charger ICs can works in standalone mode in the most cases, you obviously lose some features
(especially in ICs that offer serial communication), but the main feature that charge battery is easily
made by connecting only few pins

Here is the configuration of AAT3681A in standalone mode:

In this configuration you can’t read the state of charging but the breakout board has all its other features so as soon as you connect 5V to IN pin it starts charging the battery and stops to do it after charging complete, fault conditions or when you disconnect the 5V from IN pin.