Closed Jelle7and9 closed 11 months ago
Thanks for your reply. Still I am concernd about the 0.4V voltage difference in WebUi and measurement with multimeter. (Brymen 789) I don't want to overcharge the battery.
The value measured by board is based on analog to digital conversion and a formula. It is not calibrated at all. The correct value is your multimeter. 4.1V is ok. The voltage should not be greater than 4.2V or less than 3.2V.
Can these errors be ignored?
I think so. Most of them are coming from libraries.
Is there a workaround for calibration and cut off for over- or undercharge protection? Auto power off? And how to power off the PedalinoMini when battery attached? It never powers off unless I detach the battery. That is not so fine when everything is build in ;-) Power Off in WebUI results in reboot. It directly powers on again.
The fix the calibration change the following formula
There are no risk of over/under charging because the battery recharge is managed by MCP73831 chip.
To power off PedalinoMini use a switch to cut off the battery power or the Power On/Off action to put the board into deep sleep.
In another project I finally got to this method to show the voltage: batteryV = ((float)analogRead(14) / 4095) * 7.26; It shows 4.2V and 3.6V like my multimeter. I use a small battery from a broken mini cam.
I will try to make litle adjustments in the code soon. And somehow deep sleep mode don't work. Something triggers an wake up / start up. No idea right know. Floating pins perhaps?
The fix the calibration change the following formula
There are no risk of over/under charging because the battery recharge is managed by MCP73831 chip.
To power off PedalinoMini use a switch to cut off the battery power or the Power On/Off action to put the board into deep sleep.
I changed the code to:
uint16_t voltage = ((uint32_t)v * 2.25 * 33 * vref) / 10240;
Now its more accurate. I don't know this is the right way.
The battery icon/image is disappeared?
Also sometimes I get these errors in the terminal when building. It has something to do with the platformio packages and platforms, include path I think. I can't get an constant building output without errors. Any thoughts where to look or configurate?
Yellow message are just warnings. Errors are in red.
Allright, with some trial and error.
When I change the value 10240 to 8850 the battery voltage is showed like the metering does and battery indicator on oled look good.
uint16_t voltage = ((uint32_t)v * 2 * 33 * vref) / 8850;
Changing the vref will give strange outcome.. Althoug Vref is between 1000 and 1200 margin conform ESP32 documentation.
The dividing value does the calibration likely. I have read data with serial.print and it seems a voltage of 4,17V is equal to battery_pin value of ~2070 (out of 4095)
I run firmware 3.1.10 an added a battery connected to JST 2pin connector on a BPI Leaf S3.
If I add the BATTERY_PIN to +BATT then the oled show's charging battery symbol without and with a battery in de holder. And the WebUI shows 7.3V (but shows plugged correctly) Also when BATTERY_PIN connected and running only on battery a power reset will result in not be able to connect to my home network. When I remove BATTERY_PIN it instantly connects to my home network. I have already soldered a new connector to the battery holder to exclude bad connections. Any thoughts?
Additional info: PlatformIO shows a couple of issues when I run the inspect command. Don't know of these are important. Running windows 11 + Visual Studio Code + PlatformIO extension I only changed PIN 46 to 15 and pin 47 to 16 so the onboard I2C connector works with the OLED. Furthermore 6 buttons to the first 6 pins[D], potentio to pin 17 and pin 48 for the LEDs