🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Vmeter only reads upto 3v and then the ADC value loops

    Modules
    3
    7
    828
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • E
      erkel
      last edited by

      The ADC value at 0v volts is approx 65,536 and then decreases to 0 as the voltage is increased until approx 3v, and then will reset again to 65,536 then decrease again to 0 for 3-6V. So I can only measure over the 3v range.
      Trying to change the gain has no affect.
      I am using a raspberrypi.
      ie
      i2cget -y 1 0x49 0x00 w

      H 1 Reply Last reply Reply Quote 0
      • H
        holofloh @erkel
        last edited by

        @erkel
        This sounds like a poor solder joint at the internal voltage divider (the 11k and 680k resistors).

        E 1 Reply Last reply Reply Quote 0
        • E
          erkel @holofloh
          last edited by

          @holofloh
          I have three of them and they are all the same.

          E 1 Reply Last reply Reply Quote 0
          • E
            erkel @erkel
            last edited by

            @erkel
            Here is the E2prom data

            root@raspberrypi:/projects/battery_blancer/battery_balancer# ./c6
            Address 0x00 - 0x0f: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
            Address 0x10 - 0x1f: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
            Address 0x20 - 0x2f: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
            Address 0x30 - 0x3f: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
            Address 0x40 - 0x4f: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
            Address 0x50 - 0x5f: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
            Address 0x60 - 0x6f: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
            Address 0x70 - 0x7f: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
            Address 0x80 - 0x8f: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
            Address 0x90 - 0x9f: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
            Address 0xa0 - 0xaf: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
            Address 0xb0 - 0xbf: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
            Address 0xc0 - 0xcf: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
            Address 0xd0 - 0xdf: ff ff ff ff ff ff ff ff 01 1d d9 1d d8 00 00 00
            Address 0xe0 - 0xef: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
            Address 0xf0 - 0xff: 04 13 e6 13 e2 00 00 00 ff ff ff ff ff ff ff ff

            Or is the calibration data wrong and that is why the reading it simply rolling over every 3 volts.

            The voltage divider seems ok.
            I get ~0.4v at the mid point between the resistors with a 24V supply.

            teastainT 1 Reply Last reply Reply Quote 0
            • teastainT
              teastain @erkel
              last edited by teastain

              @erkel Well, seeing as how you are not connecting it to a M5Stack product, but a RPi, what library (driver) are you using?
              Also: What language are you programming it in?

              Cheers, Terry!

              100% M5Stack addict with several drawers full of product!

              E 1 Reply Last reply Reply Quote 0
              • E
                erkel @teastain
                last edited by

                @teastain

                Not using any drivers / library abstraction.
                Just reading the registers over the I2C bus.

                Have tried both Python, C and simply i2cget -y 1 0x49 0x00 w on the command line etc.
                Just one layer above bit banging sort of thing.

                Does the E2PROM calibration data look correct?

                E 1 Reply Last reply Reply Quote 0
                • E
                  erkel @erkel
                  last edited by

                  @erkel
                  It is working now.
                  Just a noob issue.
                  It was the endianesse of the values. it gives the output as expected when converted to little endian, rather naturally reading the value.,

                  1 Reply Last reply Reply Quote 1
                  • First post
                    Last post