6 Replies Latest reply on Dec 4, 2017 8:59 AM by e.pratt_1639216

    cyble-222014-01 battery level

    martin_2536816

      Hi,

       

      I try to use the code example BLE_Battery_Level.

       

      I change the target decice to use CYBLE-222014-01 eval board with the CY8CKIT-042-BLE Pioneer kit.

       

      I connect the jumper from P3[5] to VREF on the Pioneer board

       

      The reading it not good. It's 100% all the time.

       

      How can I fix that?

       

      Regards

       

      Martin

        • 1. Re: cyble-222014-01 battery level
          srds

          Hi,

           

          When you connect positive input of the ADC (Vref pin (P3[5]) in your project ) to VREF pin on the BLE Pioneer Kit you will always see 100% (battery voltage equal to VDD voltage).

          Connect pin P3[5] to GND on the BLE Pioneer Kit and that should change the Battery voltage 0%.

          Refer to the Project Description section of the project datasheet (BLE_Battery_Level.pdf present in the project folder) for details.

          • 2. Re: cyble-222014-01 battery level
            martin_2536816

            Hi,

             

            So if I connect to VREF I always have 100% or connect GND it's 0%.

            How do I get the value ?

             

            Martin

            • 3. Re: cyble-222014-01 battery level
              srds

              What output are you expecting out of this project? What value are you trying to get?

              • 4. Re: cyble-222014-01 battery level
                martin_2536816

                I want to have the actual battery level

                • 5. Re: cyble-222014-01 battery level
                  srds

                  Ok, hope you are not powering the kit with any other sources than coin-cell battery (make sure to disconnect the USB cable after programming).

                  Also measure the actual battery voltage using a multi-meter. If the measured voltage is ~3V you are likely to see 100%.

                  • 6. Re: cyble-222014-01 battery level
                    e.pratt_1639216

                    To read the battery voltage on a chip that is powered by the battery you want to measure, then you will need to create your own scale of which voltages correspond to which % charge of the battery.

                    Otherwise, one method I am using that seems to work well, is to put a large resistor bridge with known resistor values across the battery voltage, and to measure the midpoint voltage with respect to the 1.2 V internal voltage reference on the chip (if available). Using the internal reference is the only good way that I've seen, as the comparisons with the ADC need to have a reference, and any reference to the battery voltage itself will be a tautological measurement

                    tl;dr; You need to setup your ADC to measure the battery voltage with reference to a fixed voltage level; The 1.2 V internal reference is useful for this and is normally available on Cypress' chips. You will need to scale the voltage value with resistors to be from 0 to 1.2 volts (the reference voltage that is fixed) to get a percentage reading. Some math will need to be used to compensate for the reading from the ADC being a numerical count from 0 to ~0 to be converted to 0% to 100%