Any recommendations for finding Sealed Lead Acid battery capacity using an ESP32?
Planning to log capacity and send alert once capacity reaches a set point. I have seen Amazon Smart Battery Monitors
Regards,
William
Prompted Google’s Bard; this is the response for using a INA219
sensor:
Sure, here is an example of integrating the current over time to calculate the battery capacity:
C++
#include <Wire.h>
#include <INA219.h>
INA219 ina219(0x40);
long totalCharge = 0; // Variable to store the total charge consumed
long startTime = 0; // Variable to store the start time
void setup() {
Serial.begin(115200);
Wire.begin();
ina219.begin();
startTime = millis(); // Record the start time
}
void loop() {
long current = ina219.getCurrent_mA(); // Read the current in mA
long elapsedTime = millis() - startTime; // Calculate the elapsed time in milliseconds
totalCharge += current * elapsedTime; // Update the total charge consumed
startTime = millis(); // Reset the start time for the next iteration
Serial.print("Total Charge: ");
Serial.println(totalCharge);
delay(1000); // Delay for 1 second
}
This code will print the total charge consumed by the battery to the serial monitor every second. You can modify this code to calculate the remaining battery capacity by dividing the total charge by the battery’s nominal capacity (in mAh).
Will investigate and experiment further.
Regards,
William
Good Morning,
Planning to use a INA226, I2C Current, Voltage, and Power device for measurements. INA226 will be part of the EByte, E220-900T30D project:
Remote-Relay-with-Battery-Monitor (a work inprogress..)
William
Good Afternoon,
Progress is good on project; mostly complete, want to add two-way messaging, that will come later. Now the project uses two, EByte E220-900T30D transvievers to wake a sleeping ESP32 with the first WOR preable message, When a person sends a URL request to view camera; the solar charged, battery power is switched on with a KY002S mosfet switch, happening at same time a count down timer is started to turn off battery power once timer expires. When the battery power is turned on battery status is checked using a INA226 Battery monitor module. Battery data is logged to LittleFS file. Stand alone FTP sketch allows access to file for viewing.
Camera is a Wyse Cam v3 that draws 180 mA; that until now used battery 24/7 on a 10,000 maH power bank that only lasted about day. This improvement; should conserve the majority of lost battery power.
William