-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Battery measurement #13
Comments
Eried I have T8 1.7.1 board. Analog read finds a value in PIN35 around 2430. This level is present both with BATTERY connected and also with NO BATTERY. Are you sure that it correspond to V.bat? |
Yes, in that case is USB voltage |
But what is the scale of 0-4095.measurement? Because lithium battery is 3.0-4.2v. Board and pins volt are maximum 3.3v and 0-4095 usually are for 0-3.3v. How.did you manage that? |
Well, I didnt exactly need the voltage value, just the reference (because the analogRead changes for every analog input in reference to VBAT, so the values are all different if you are on battery power vs USB... futhermore they decrease once the battery wears down... so it is a big issue if you are calibrating something based on the analog inputs) So what I did is to map the range: For a simple mapping I would use:
For a more accurate reading, I would calibrate a mapping with few known voltages and an polinomial interpolation in excel. |
Also, consider that while reading the serial monitor via USB you will always get the same VBAT. Create a sketch with a simple bluetooth serial and try with different batteries. |
Hi!
I just wanted to add that it would be useful to have the following info in the repo:
The text was updated successfully, but these errors were encountered: