Closed FernandoGarcia closed 6 years ago
I think the problem are this conditions:
if (my_vfact < ADCDIVISOR * 0.8 || my_vfact > ADCDIVISOR * 1.2)
my_vfact = ADCDIVISOR;
It worked when I changed the ADCDVISOR to 251.95 and my_vfact to 252. But it doesn't worked when I changed my_vfact to 150 with ADCDVISOR = 251.95
To battery factor be updated the new value should be >ADCDIVISOR 0.8 and < ADCDIVISOR 1.2 otherwise the value will be changed to default it's ADCDIVISOR.
Now I have it working with my_vfact = 246.5 and ADCDIVISOR = 251.95
Battery factor > ADCDIVISOR * 0.8 246.5 > 201.56
Battery factor < ADCDIVISOR * 1.2 246.5 < 302.34
I didn't see any information about it here.
Just for info I'm using a 100K resistor between A0 and Battery + because I haven't 230K resistor at home and due this information: https://arduinodiy.wordpress.com/2016/12/25/monitoring-lipo-battery-voltage-with-wemos-d1-minibattery-shield-and-thingspeak/
Exactly that’s the reason why you need to add a 220k resistor because you are overloading the adc input at 5V now. Just use 2x100k in series if you don’t have them on stock. And the test you found is for a reason.
Hi!
Thanks for your reply.
In fact I didn't the calculation just followed the schematic.
Now I see that max voltage (5.5 V) while charging was not considered on link above. So for a 100 K resistor and 5.5 V charge input the ADC will get about 1.31 V.
While with a fully charged battery (4.2 V) the 100K resistor is fine because the ADC will get about 1 V.
I think you should add the info bellow on FAQ because if someone makes a wrong calculation will get crazy trying understand why the value doesn't change.
(displayed voltage / measured voltage) * current factor (191.8) = new factor
The new factor should be between current factor more or less 20% (191.8*0.8 - 191.8*1.2).
Best regards.
Now I have fixed it I did 100K + 100K +33K. I didn't it before to keep the build more simple and due the convenient info I found above.
The battery factor now is 188.6
Hi!
It's not a network problem as in #198
Here the console output:
As you can see here the value sent was 150:
And the value saved was 191.8 as you can see here:
I haven't any network problem because the MQTT broker is receiving all messages.
Firmware version: 5.9.1
Best regards.