MetaWear-SDK-JavaScript icon indicating copy to clipboard operation
MetaWear-SDK-JavaScript copied to clipboard

Weird battery values

Open iBicha opened this issue 8 years ago • 4 comments

This is probably cpp sdk related, but I'm getting weird values from the battery readings of my MetaTracker.

Voltage jumping from 6 to 27 volts, and charge from 25% to 80% randomly.

Here's a function I use to get the voltage

function GetBattery(device, callback) {
    if(!device || !device.connectedAndSetUp)
        return;

    if(device.battSignal){
        MetaWear.mbl_mw_datasignal_unsubscribe(device.battSignal);
        device.battSignal = null;
    }

    if(!callback){
        return;
    }

    device.battSignal = MetaWear.mbl_mw_settings_get_battery_state_data_signal(device.board);
    MetaWear.mbl_mw_datasignal_subscribe(device.battSignal, MetaWear.FnVoid_DataP.toPointer(function gotTimer(dataPtr) {
        var data = dataPtr.deref();
        var val = data.parseValue();
        callback({
            address: device.address,
            epoch: data.epoch,
            battery: val
        });
        //Unsubscribe
        if(device.battSignal){
            MetaWear.mbl_mw_datasignal_unsubscribe(device.battSignal);
            device.battSignal = null;
        }
    }));

    MetaWear.mbl_mw_datasignal_read(device.battSignal);

}

Is there anything I'm missing? I'm calling this function about twice per minute for now

iBicha avatar Jan 05 '18 22:01 iBicha

What sensors are you using in addition to reading the battery values?

scaryghost avatar Jan 08 '18 11:01 scaryghost

Oh I see, I'm using several sensors, including accelerometer and gyro, so drawing power is probably interfering with the readings, is that correct?

iBicha avatar Jan 08 '18 15:01 iBicha

See this thread on our community forum: http://mbientlab.com/community/discussion/comment/1923/#Comment_1923

scaryghost avatar Jan 09 '18 09:01 scaryghost

Understood, thanks

iBicha avatar Jan 09 '18 09:01 iBicha