IoT RedBoard ESP32 Development Board Hookup Guide

Pages
Contributors: Ell C, SparkFro
Favorited Favorite 3

Example 5: LiPo Fuel Gauge - MAX17048

If you look closely at the board, there's also a built-in LiPo fuel guage to monitor your LiPo battery!

In this case, we did not need to solder anything! The IoT RedBoard - ESP32 has a built in LiPo Fuel Gauge (MAX17048). By simply connecting a LiPo battery to the 2-pin JST connector and uploading code, we should be good to go!

LiPo connected to IoT RedBoard

SparkFun MAX1704x Fuel Gauge Arduino Library

Just like the previous example, you will need to install the Arduino Library for the MAX17048.

The SparkFun MAX1704x Fuel Gauge Arduino Library can be downloaded with the Arduino library manager by searching 'SparkFun MAX1704x Fuel Gauge' or you can grab the zip here from the GitHub repository to manually install.


Example Code

From the menu, select the following: File > Examples > SparkFun_MAX1704x_Fuel_Gauge_Arduino_Library > Example4_MAX17048_KitchenSink. If you have not already, select your Board (in this case the SparkFun ESP32 IoT RedBoard), and associated COM port (in this case COM27). Then hit the upload button.

alt text

Open the Arduino Serial Monitor and set it to 115200 baud to view the serial output. You should see the voltage, battery percent, alert flag, and several more readings. In this case, the single cell LiPo battery that was connected to the IC was fully charged and at about 4.10V.

Serial Output

Click on image for closer view.

But wait! If you looked closely at the circuit of the SparkFun IoT RedBoard - ESP32 Development Board, there is also... a charge circuit built in. Try closing out the Arduino Serial Monitor, disconnecting the USB, and disconnecting the LiPo battery. Then reinsert the LiPo battery, connect the USB cable, and reopen the Arduino Serial Monitor. The IC will recalculate everything. In the image below, the voltage is a bit misleading since the charge IC is charging the LiPo battery and may not be the true representation of the LiPo battery's voltage. The remaining charge was closer to what was expected.

Serial Output

Click on image for closer view.