Avatar for user138058

user138058

Member since Dec 2021 • Last active Jul 2022
  • 1 conversations
  • 9 comments

Most recent activity

  • in Bangle.js
    Avatar for user138058

    @fanoush You're right, only hi should be needed. I'm now experimenting with trying to get getBattery to be more accurate since volts/% is not linear. My daughter noted that her watch was claiming 40% remaining battery shortly before it shut down. Based on a discharge graph shown here https://learn.adafruit.com/li-ion-and-li­poly-batteries/voltages, I've come up with the following:

    E.getBattery = function () {
        const hi = 0.48;
        var v = analogRead(D3) / hi * 4.2;
        if (v >= 4.2) {
            return 100;
        } else if (v >= 4.1) {
            return Math.round(97 + 30 * (v - 4.1));
        } else if (v >= 4.0) {
            return Math.round(87 + 100 * (v - 4.0));
        } else if (v >= 3.9) {
            return Math.round(75 + 120 * (v - 3.9));
        } else if (v >= 3.8) {
            return Math.round(59 + 160 * (v - 3.8));
        } else if (v >= 3.7) {
            return Math.round(26 + 330 * (v - 3.7));
        } else if (v >= 3.6) {
            return Math.round(12 + 140 * (v - 3.6));
        } else if (v >= 3.5) {
            return Math.round(6 + 60 * (v - 3.5));
        } else if (v >= 3.4) {
            return Math.round(3 + 30 * (v - 3.4));
        } else {
            return 0;
        }
    };
    
  • in Bangle.js
    Avatar for user138058

    @Gordon What kind of battery is in the Bangle.js 2? I read that that analog input is supposed to read 1/4 of the battery voltage, which means that a full battery is about 1.25V. That sounds about right for a NiMH battery. A lithium battery would be quite a bit higher (3.7V?)

  • in Bangle.js
    Avatar for user138058

    Thanks for the tip!

  • in Bangle.js
    Avatar for user138058

    I've worked around it for now by editing widbatpc.wid.js on the watch, replacing E.getBattery() with a call to a custom getBattery() function:

    function getBattery() {
        var battery = Math.round((analogRead(D3) - 0.375) / .00106);
        return battery;
    }
    

    That should tide me over until @Gordon returns.

  • in Bangle.js
    Avatar for user138058

    I've done some experimenting and it looks like my watch maxes out around 0.481 on the D3 when fully charged and shuts down around 0.375. These values are about 1.5x the values used to calculate battery percentage (0.246 and 0.3144). Not sure if my watch was built with the wrong value resistors for the voltage divider that feeds D3 or if the ADC is programmed incorrectly for that input.

    analogRead(D3)

    Fully charged:

    analogRead(D3)
    =0.48046875
    analogRead(D3)
    =0.48120117187
    analogRead(D3)
    =0.48022460937
    analogRead(D3)
    =0.48095703125

    Just prior to shutdown:

    0.37524414062
    100
    0.37451171875
    100
    0.37377929687
    100
    0.37548828125

  • in Bangle.js
    Avatar for user138058

    I've already updated the watch firmware to 2v11 last week and unfortunately it didn't help.

  • in Bangle.js
    Avatar for user138058

    Here's what I get for a sequence of E.getBattery() and analogRead(D3) calls:

    E.getBattery()
    =100

    analogRead(D3)
    =0.45239257812
    analogRead(D3)
    =0.451171875
    analogRead(D3)
    =0.45263671875
    analogRead(D3)
    =0.45239257812
    analogRead(D3)
    =0.45190429687
    analogRead(D3)
    =0.4521484375
    analogRead(D3)
    =0.4521484375
    E.getBattery()
    =100
    E.getBattery()
    =100
    analogRead(D3)
    =0.45263671875
    analogRead(D3)
    =0.453125
    analogRead(D3)
    =0.45190429687
    analogRead(D3)
    =0.45288085937
    analogRead(D3)
    =0.45239257812

  • in Bangle.js
    Avatar for user138058

    I received my Bangle.js 2 a couple weeks ago. I was giving it as a Christmas present, so I didn't do much with it other than charge it fully and install the latest software/apps including the newest firmware update. Since yesterday, it has mysteriously shut down several times and would not power back up until connected to the charger. Once on the charger, it will immediately boot up and the battery shows as 100% charged. At that point, if you disconnect it from the charger, it will run for a few minutes and then shut down again. I finally figured out that the indicated battery level always shows as 100% even when it's almost discharged. I charged it for a couple of hours and it has run overnight without shutting down (but the battery still shows 100%). Has anyone else seen this behavior?

Actions