Correctly Measure Battery Level - MAX17048
Battery-powered IoT projects require you to monitor your battery's percentage. Measuring battery voltage is not ideal, because the voltage doesn't drop linearly.
Fuel gauges are a better alternative. They work straight away, don't consume power while in standby, and they're accurate without any calibration!
Buy a Battery Fuel Gauge from DFRobot (They kindly provided me with this sensor)
Useful resources
Libraries you can use to interface with this sensor:
Also check out my blog post about how to use this sensor for a more in-depth explanation.
Full code
#include "MAX17043.h"
void setup(){
Serial.begin(115200);
FuelGauge.begin();
}
void loop() {
float percentage = FuelGauge.percent();
float voltage = FuelGauge.voltage();
Serial.print("Battery percentage: ");
Serial.print(percentage);
Serial.println("%");
Serial.print("Battery voltage: ");
Serial.print(voltage);
Serial.println("V");
delay(1000);
}
💌 Subscribe to my newsletter
(related to science, technology, biology, and other nerdy things)!
Check out past editions.