Omega2+: Battery Level with Power Dock 2



  • Hello, I have just tried the script in this post (from 3 years ago, I know) but it doesn't work anymore.

    https://www.hackster.io/onion-corporation/onion-omega2-battery-level-and-current-date-indicator-451739

     python oled-display-battery.py
     Traceback (most recent call last):
       File "oled-display-battery.py", line 14, in <module>
         Vcurrent = float(output[-7:-2])
     ValueError: could not convert string to float: el:
    

    Also if I try this on the command line, it doesn't work:

     ~# power-dock2 -p
     Error: Read failed
     /usr/bin/power-dock2: line 136: arithmetic syntax error
     (standard_in) 1: syntax error
     Error: Read failed
     /usr/bin/power-dock2: line 136: arithmetic syntax error
     (standard_in) 1: syntax error
     (standard_in) 1: syntax error
     (standard_in) 1: syntax error
     Battery Voltage Level:  V
     Battery Level Percent:  %
    

    Could you help me? I'd like to show the battery level percentage on the OLED screen


  • administrators

    @Fabrizio-Codello Just tested out the code with a Power Dock 2 and it still works.

    Note that only the Power Dock 2 has an ADC circuit for detecting the battery level. The older Power Dock 1 does not have this same functionality - might be the cause of the issue you're seeing.



  • For the record, that's exactly the response you get when there is no ADC at the expected address (I2C: 0x4D). Which suggests tool and h/w don't match. What does i2cdetect -y 0 produce?



  • @Lazar-Demin said in Omega2+: Battery Level with Power Dock 2:

    @Fabrizio-Codello Just tested out the code with a Power Dock 2 and it still works.

    Note that only the Power Dock 2 has an ADC circuit for detecting the battery level. The older Power Dock 1 does not have this same functionality - might be the cause of the issue you're seeing.

    @Lazar-Demin Ah, dang šŸ˜

    @Marko-Lukat said in Omega2+: Battery Level with Power Dock 2:

    For the record, that's exactly the response you get when there is no ADC at the expected address (I2C: 0x4D). Which suggests tool and h/w don't match. What does i2cdetect -y 0 produce?
    root@Omega-67F5:~# i2cdetect -y 0

    @Marko-Lukat This is the output:

          0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
     00:          -- -- -- -- -- -- -- -- -- -- -- -- --
     10: UU -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
     20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
     30: -- -- -- -- -- -- -- -- -- -- -- -- 3c -- -- --
     40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
     50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
     60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
     70: -- -- -- -- -- -- -- --
    

    I guess i have the first one and can't do much about it šŸ™‚



Looks like your connection to Community was lost, please wait while we try to reconnect.