Read 12V battery charge - Printable Version +- Smart Home Automation Forum (https://www.kincony.com/forum) +-- Forum: Technical Support (https://www.kincony.com/forum/forumdisplay.php?fid=20) +--- Forum: KC868-A6 (https://www.kincony.com/forum/forumdisplay.php?fid=22) +--- Thread: Read 12V battery charge (/showthread.php?tid=7113) |
Read 12V battery charge - darsh - 11-25-2024 Hello, I am powering the board with a solar panel connected to a charge controller and a 12V battery. I have installed the ESPHome system on the board connected to Home Assistant, and it is working perfectly. I would like to read the battery charge level using the analog sensor A1, but I know that this sensor reads a maximum of 5V, so the 12V from the battery (13V when fully charged) needs to be reduced. For this, I tried using a voltage divider circuit with two resistors, one 200KOhm and one 100KOhm. I connected the GND and A1 terminals of the analog sensors across the 100KOhm resistor, with the GND terminal going to the negative terminal of the battery. +12V (Battery) | | [R1] 200kOhm | +------ A1 | [R2] 100kOhm | | GND (Battery -) The configuration in ESPHome is: Code: sensor: This configuration gives me readings of values below 0, which I had to multiply by 24.6 to get battery voltage values close to what I read using a voltmeter connected to the battery terminals. Additionally, the values read are not stable, while the voltmeter provides a rather stable value. Can you tell me if I am making any mistakes in the configuration or in the circuit? Is there a simpler way to perform this reading? Thank you. Darsh RE: Read 12V battery charge - admin - 11-25-2024 suggest you add KinCony MB board, it mainly use for monitor battery , support ESPHome, easy to use. here is details: https://www.kincony.com/esp32-battery-monitor.html RE: Read 12V battery charge - darsh - 11-25-2024 Than for your reply, the battery monitoring board would be ideal for a more complex project but for a small and simple project like mine it seems a bit too much. I would like a more precise reading of the battery charge but if this add too much complexity I can live with the values I read with the voltage divider. What I would like to understand is why I get values less than 1 (0.15) from the analog to digital converter instead of having positive readings. Thanks Darsh RE: Read 12V battery charge - JULIO - 11-25-2024 (11-25-2024, 11:57 AM)Ojalá Wrote: Gracias por tu respuesta, Saludos, Dependiendo de los AH de tu batería, puedes usar módulos como el INA219 que te brindarán los datos más estables a través de I2C. RE: Read 12V battery charge - admin - 11-26-2024 yes, add INA219 extend small module is a easiest way. RE: Read 12V battery charge - darsh - 11-26-2024 (11-25-2024, 03:31 PM)JULIO Wrote: Saludos, Hello, the battery is a small 7ah gel deep cycle battery. I wasn't familiar with the INA219 module; a quick search suggests it's exactly what I need, thank you for pointing it out to me. Hola, la batería es una pequeña batería de gel de ciclo profundo de 7ah. No conocía el módulo INA219; una búsqueda rápida parece que es justo lo que necesito, gracias por indicármelo. Darsh RE: Read 12V battery charge - darsh - 12-01-2024 Hi, I was able to measure the battery charge using the INA219 module connected to the I2C bus of the KC868-A6 board. To measure the voltage but not the current, I had to:
This connection allowed me to connect the INA219 board in parallel with the battery instead of in series, as is often done. In EspHome, I added a section dedicated to the sensor: Code: sensor: Thank you again for pointing me to this solution. RE: Read 12V battery charge - admin - 12-01-2024 You can refer to these, this use by INA226 chip: ESPHome yaml: https://www.kincony.com/forum/showthread.php?tid=3975 |