# Universal Lithium-Ion Charger
I used this circuit in the [[tenet-brick|Tenet Brick]] build.
## Parts
- [Adafruit Universal USB / DC / Solar Lithium Ion/Polymer charger](https://www.adafruit.com/product/4755)
- Any 3.7V battery pack from Adafruit (like the [6600mAh model](https://www.adafruit.com/product/353))
- Optional solar panel like [Voltaic P126 2W](https://www.adafruit.com/product/5366)
## Wiring
The power board from Adafruit has
[some pins available](https://learn.adafruit.com/adafruit-bq24074-universal-usb-dc-solar-charger-breakout/pinouts),
which I wanted to learn how to use. I could have just connected the Pi to the
"Load Out" port (with a toggle switch in the 5V line), but I thought I could
provide the user with some more interface to the power circuitry.

Note: In the above diagram, the black wires on the breadboard carry `OUT`
voltage, between 3V and 4.4V.
The `CE` pin is for "charge enable". I wired this through a toggle switch to the
`OUT` pin (which stays between 3 and 4.4V). When the switch is closed, the `CE`
pin is pulled "high", which disables charging. This could be useful to the user
in a situation where the solar power available is not enough to both power the
computer and charge the battery.
The `PGOOD` pin is for "Power Good Status", and will be a ground when a valid
power source is connected. This means that connecting `OUT` to the voltage side
of an LED and `PGOOD` to the ground side will result in the LED turning on when
external power is connected to the board.
The `CHG` pin is for "Charge Status". Similar to the `PGOOD` pin, this will be a
ground when the battery is charging. I connected the `OUT` voltage line to a
10kΩ resistor, through a red LED to the `CHG` pin.
What all this means:
- When the green LED is on, there's a good external power source connected.
- When the red LED is on, the battery is charging.
- The switch controls whether or not the battery will charge, when the board is
connected to power.