Reading battery level on MetaWear R using Android

Is it possible to read the battery level on the metawear R using android? 
I am always getting a value of 99 back from the MetaWear App.

Also, tried it on iOS device with the same result.

Comments

  • edited November 2016
    The firmware calculates battery level based on the battery voltage.  The battery gatt service only provides the battery level but if you use the readBatteryState function (only firmware v1.1.0 and higher), you can get at battery voltage value which will be more useful for characterizing your use case.
  • Is this now readBatteryLevel? I'm using the android SDK and readBatteryState is not available.

    I'm also only seeing values of 99 or 98. I've never seen lower. I'm connected over BLE and streaming accelerometer data at 10hz. I'd expect 15 hours or so of battery life, and the battery level to at least drop over time.

    I'm issuing readBatteryLevel commands every 5 minutes while connected.
  • No, readBatteryState is a different function from readBatteryLevel.  You can read up about it in the documentation.
  • Eric, have you tried the sample code?

    I'm running firmware version 1.2.5, copy/pasted the sample (using android) and I never get a call to the MessageHandler. The CompletionHandler success method is called.

    I've called readBatteryState right after the route code (as shown in sample) and called it in a loop every 5 seconds. Neither works for me.
  • The code from the documentation works fine for me.  Are you using the latest api?
  • 2.5.9, what about you? I just tried 2.6.0 and got the same result. Is that the latest?
  • Latest is v2.7.0.
  • v2.7.0 is working! Thanks Eric!
  • I hate to open this back up, but I'm still struggling with how I use the voltage and charge properties. I want the same experience you get with your cell phone. ex. 55% charge. It doesn't need to be extremely accurate.

    Right now I'm doing the following (below). I've never seen batterLvl go below 80, and then the sensor runs out of battery anyway. What's the best way to use this data to emulate the battery % you get with cell phones today?

    static final int MAX_BATTERY_V_MA = 4200;

    float batteryLvl = msg.getData(Settings.BatteryState.class).voltage();
    batteryLvl = batteryLvl / MAX_BATTERY_V_MA * 100;
  • See this post by Matt.
This discussion has been closed.