Open entozoon opened 4 months ago
Hmm, if I set my refVoltage
to 3306, which is what I measure across the 3V3 pin and GND (despite powering from 5V USB) then the figures are much closer. Still half a volt out, but I guess it's better than nothing and I can fudge the numbers ..
Which MCU is your code being run on? The 5000 value passed as argument at the begin() method is the microcontroller’s beef value of the internal ADC…
Il giorno lun 8 lug 2024 alle 23:57 Michael Cook @.***> ha scritto:
Hmm, if I set my refVoltage to 3306, which is what I measure across the 3V3 pin and GND (despite powering from 5V USB) then the figures are much closer. Still half a volt out, but I guess it's better than nothing and I can fudge the numbers ..
— Reply to this email directly, view it on GitHub https://github.com/rlogiacco/BatterySense/issues/51#issuecomment-2215417329, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABQWMNTBCUNMSNNDEJH6YDZLMDMZAVCNFSM6AAAAABKRQW7BSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMJVGQYTOMZSHE . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Hi @rlogiacco, thanks. I have a Wemos S2 mini which is an ESP32-S2FN4R2. I do not understand how to discovery the correct ref voltage.. :(
This ESP32-S2 document mentions 1100mV as the ADC calibration reference voltage but that sounds way too low to me..
Yours is a 3.3V board and also the ADC seems to be recommending an external 100nF capacitor:
So, it would help if you change the begin
method parameter to 3300
(as for ´3.3V´) and add the capacitor. I also suggest measuring the real values of the two resistors used for the voltage divider to increase accuracy: unless you go for precision resistors, values might be quite different from what you expect.
To be clear, the ESP32 (the MCU at the core of your board) has a 1.1V
vRef (specs from the manufacturer state this is just a median value though), this is then converted to a 3.3V
reference by the board (by using a voltage divider, which might be introducing inaccuracy), on top of that you are using an additional voltage divider... Sadly the board you are using is not really the best choice for your goal if accuracy is key.
BTW, I do not own the board you are using, thus I’m only reading specifications found on the internet.
Hi, I'm surely doing something wrong, but here is my situation in designing a voltage tester for 3S li-ion batteries using a Wemos D1 Mini. Note the only connection to the arduino is the A0 sense pin and ground. The battery being tested is a separate entity, if that's significant.
At 10.5 volts (the minimum, which should report as 0%), the output is similar to:
Analog value: 675, Battery voltage: 16479.00 mV, Battery level: 100%
Perhaps I'm misunderstanding how the ohms law ratio works here, but the analog value seems to be safely within 1024 as expected but yeah, the battery voltage stated in mV is way too high