Table of Contents

The Result



This is the device itself.
If you plugin in the power to the d1mini, it will show you only the stats (discharge stats if a consumer is connected to the output). You can additionally connect a 5V source to the lipo module (micro usb) to start charging and the software will monitor the charge rate.
If you connect a powersource to the lipo charger only, the d1mini will be powered from that input, too. This what the diode is for. (I don't want to charge with the input from the d1mini as it can only do 0.5A)

This is a project to build your own 18650 Lipo charger, that can show you the batteries relative state of charge (i.e. x.y%), current charge rate, and discharge rate. There is a small 3V3 LDO voltage regulator (mcp1700), and pins to connect to 3V3 or 3V7-4V2 (directly to the lipo).

The battery protection circuit is used from the TP4056 module, to avoid emptying the battery to 0V.

Fun fact: 18650 batteries are used in teslas. Also: What’s inside a 18650/Tesla Battery

The Parts

The PCB

This is how everything is wired.
How the components are connected on the PCB.
Top view of the PCB.
Bottom view of the PCB.

The 3D model

This section will go into the details on how you can create a case for a PCB with Blender.

In the PCBNew view, export the PCB as VRML
Make sure to export with unit mm.
Create a new project in Blener, and import the .wrl file.
First, you might not see anything ...
... because it imported somewhere else on the screen.
Merge all the shapes to a single object (select and ALT-J), and center them.
Much better :)
Go to vertex selection mode, then add new object plane.
Resize the plane snapping it to the edges of the PCB. (Select and Grab)
Extrude the edges to add 0.5mm margin (or more, depends on your printer).
Extrude the edges again, to add a 2mm wall.
Then, Extrude the wall to the top (z-axis). Extrude the bottom perimeter by 2mm and fill it with a single Face.
Sometimes it's practical to remove doubles, if you are prone to mistakes like me.
Add holes for cables. (CTRL-R to loop-cut-and-slide, then remove (X) the top edges, and Fill the holes in the mesh.
Select the corner edges, and set the mean bevel weight to 1.0.
Then, add a bevel modifier and set it to weight mode, 9 segments, and 2mm width.
Add corner elements (cubes), and remove 2mm holes for screws.
I imported the object from my previously designed 18650 holder (thingiverse), and tuned the edges a bit.
I often export the objects as a single .stl file and open them with Slic3r to check it is slicable. If not: go to edit mode in blender and select non manifold vertices. Delete them, and fix the mesh.

The Code

This the repository of the code, that I wrote for this. Feal free to fork it: https://github.com/pauls-3d-things/arduino-esp-lipo-meter