> For the complete documentation index, see [llms.txt](https://andreas-organization-3.gitbook.io/mini-rak-tracker-or-rak3172/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://andreas-organization-3.gitbook.io/mini-rak-tracker-or-rak3172/hardware/lipo-charger.md).

# LiPo Charger

## 🛆 Brief description

It is always more convenient to be able to recharge the battery without having to dismantle the whole system. The addition of a battery charger seems to me to be essential in any electronic project.

***

## 🛆 LiPo Charger Chip

The MCP73831 offers linear charging in a miniature package at an attractive price. It can be used with any type of battery by programming its charge current through an external resistor. It also features an automatic shutdown when the charged battery is full. This makes it an excellent charger for our card.

<figure><img src="/files/f8K7ZrMNwRSeoU0THJM6" alt="" width="150"><figcaption></figcaption></figure>

### Technological capabilities

| Features       | Description                                                                         |
| -------------- | ----------------------------------------------------------------------------------- |
| Charge Current | Programmable from 15mA to 500mA                                                     |
| Power Down     | Automatic                                                                           |
| Charge Status  | <p>Pin #1 in high state: LiPo full </p><p>Pin #1 in low state: LiPo in charging</p> |

### Current Regulation

The speed at which a battery is charged depends on the amount of current applied during the charging period. The greater the current applied, the faster the battery will charge.&#x20;

This charge current is set by adding a resistor to pin #5 of the MCP73831. So it's easy to change the resistor value to change the charge rate. The charge current is defined by the formula below:

$$
I\_{REG} \ \[mA] = \frac{1000 \ \[V]}{R\_{PROG} \ \[k\Omega]}
$$

In this project I've used a 10kOhm resistor, which allows a charge current of 100mA. So to charge a 100mA battery you'll need 1 hour of charging time, to charge a 200mA battery you'll need 2 hours of charging time, and so on.

{% hint style="danger" %}
Although we are tempted to set a high charge current to minimise charge time, all batteries have a maximum charge current. Be careful not to overcharge the battery. This can cause the battery to deteriorate prematurely or catch fire.
{% endhint %}

***

## 🛆 Hardware Integration

### Pin Configuration & Description

The MCP73831 is available in two packages: 8-lead DFN (2x3mm) or 5-lead SOT-23 (2.9x2.8mm). Due to availability, only the SOT-23 package was available, so this is the package in which the LiPo charger is mounted.&#x20;

The available pins are listed in the table below:

<table><thead><tr><th width="145">Pin Number</th><th width="145">Name</th><th>Description</th></tr></thead><tbody><tr><td>1</td><td>STAT</td><td>Charge Status Output</td></tr><tr><td>2</td><td>Vss</td><td>Battery Management 0V Reference</td></tr><tr><td>3</td><td>VBAT</td><td>Battery Charge Control Output</td></tr><tr><td>4</td><td>VDD</td><td>Battery Management Input Supply</td></tr><tr><td>5</td><td>PROG</td><td>Current Regulation Set and Charge Control Enable</td></tr></tbody></table>

#### The Pin #1 STAT

Pin #1 indicates the state of charge of the battery. The pin is low when the battery is being charged / no battery detected, or high when the battery is full.&#x20;

Based on this principle, I've added a pair of resistors and two LEDs (red and green) to indicate the state of charge of the battery. When the battery is charging, the red LED is on and the green LED is off. When the battery is fully charged, the green LED is on and the red LED is off (see figure: Kicad | Lipo charger stage).

### Kicad - Rooting

The charger chip is wired according to the datasheet (see page 1). A 4.7µF input and output is used for load transient response. Pin #4 is connected to the resistor to set the charge current. Pin #1 is used to set up the indicator LEDs.

<figure><img src="/files/5wM9G4mtM09QeqHZ274C" alt=""><figcaption><p>Kicad | LiPo Charger Stage</p></figcaption></figure>

{% hint style="success" %}
The charging stage is connected directly to USB C. This means that even if the card is switched off (via the switch) but still powered by USB, it will still charge your battery.
{% endhint %}

***

## 🛆 Documentation

{% embed url="<https://www.microchip.com/en-us/product/mcp73831>" %}
Web Site | Microchip | MCP73831
{% endembed %}

{% file src="/files/AoBkMQL8Biy6HO1OsiGG" %}
Datasheet | LiPo Charger | MCP73831
{% endfile %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://andreas-organization-3.gitbook.io/mini-rak-tracker-or-rak3172/hardware/lipo-charger.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
