-
Notifications
You must be signed in to change notification settings - Fork 11
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
Very basic Heltec V3 battery support #30
base: master
Are you sure you want to change the base?
Conversation
We will have to wait for someone to volunteer to test this, at present. Could you also please undo your last commit in this PR? One feature per PR please :) |
Thanks for understanting, I removed the wrong commit 👍 |
How would you like me to test? I have this device and some free time. |
Hi, I started on mine, but without a serial output for debug is quite difficult to understand wether it's working or not (I actually don't know how to accomplish it as it only has kiss messages over serial and I jave to decode them by hand). When battery is connected and charging it shows not all bars, while when connected to USB shows full bars. If you want, in the mean time you can check if it's at least reading different states (indicated by battery bars on the screen) when battery is connected or not. Thanks! |
That's totally fine :) I will probably just squash the commits when I merge anyway. You could always add a simple print statement to your code which prints out the percentage for you to read. Don't commit that change, though. That will let you check if it functions correctly. If you have a multimeter to hand, you can calculate the percentage yourself by measuring the battery voltage and then see if the device matches :) I can see an issue in the implementation. Basically, when a battery is charging, the voltage that's fed into it is actually fed in on the same line that you're reading from to check the voltage. This obviously creates a problem, because the value you're reading when charging is useless for telling the battery percentage. If you have a look here, I added the functionality on the RAK4631 to check if it's currently charging to fix this behaviour, as has been done on most of the previous boards as well. So, your next task is to figure out what you can check on the board to see if you're connected to USB power or not :) |
Hi, I managed to get the factory calibrated ADC results instead of the raw ones and they're much better. Now it should show the "plug" icon only when the battery is disconnected. On the other hand this device has an onboard LED that lights up when the device is charging so if it's not a problem for you I'll leave If that's fine all add this commit containing all these changes |
Okay, some good progress.
I reckon it probably is possible to tell if the device is charging. Look around for any ESP32 APIs you could use. Does the board have a PMU you can access? Things like that.
You can commit your changes of course, they are most welcome. However I won't consider merging until support is a bit more fleshed out :)
…On 4 September 2024 11:56:58 BST, Marco Veneziano ***@***.***> wrote:
Hi, I managed to get the factory calibrated ADC results instead of the raw ones and they're much better.
Now it should show the "plug" icon only when the battery is disconnected.
Unfortunately (as far as I know) there's no way to get whether the device is plugged id on USB or not.
Furthermore the device ADC is not precise enough (at least on my board) to get stable and consistent readings and check if the battery is charging or not simply by reading the ADC and checking if the voltage is rising or falling.
This device has an onboard LED that light up when the device is charging so if it's not a problem for you I'll leave `battery_state = BATTERY_STATE_DISCHARGING` so it always shows the current battery percentage (and plug icon when no battery connected) and the charging process would be indicated only by the onboard charging LED.
If that's fine all add this commit containing all these changes
--
Reply to this email directly or view it on GitHub:
#30 (comment)
You are receiving this because you commented.
Message ID: ***@***.***>
|
Actually the device only "pmu" is the battery charging circuit and a voltage divider on battery to measure voltage through and ADC (which could be enabled by closing a mosfet). |
I will take a look into this myself soon when I have time. Thanks for your work on this thus far. |
It should be more readable now.
Thanks.
In case you haven't read from the other pull request before closing it:
Offtopic: is there any way to debug through serial console (for example read battery voltage and serial messages)?
I read from the code that the default baudrate for serial should be 115200 but doing screen /dev/ttyUSB0 115200 only spits out wrong characters.