11-25-2024, 11:03 AM
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:
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
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:
- platform: adc
pin: 36
name: 'Battery Charge - Voltage'
id: battery_charge_voltage
accuracy_decimals: 5
device_class: "voltage"
state_class: "measurement"
unit_of_measurement: "V"
update_interval: 5s
filters:
- multiply: 24.6
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