Sampling magnometer

I found thie following command to create a magnometer sampels at 20Hz rate:

mbl_mw_mag_bmm150_configure ( const MblMwMetaWearBoard * board,
uint16_t xy_reps,
uint16_t z_reps,
MblMwMagBmm150Odr odr
)

but im not sure what are those fields:
uint16_t xy_reps,
uint16_t z_reps,

what should I enter if i want to have magnometer samples at 20Hz rate?

Comments

  • edited May 2020

    Please don't use this, it is for advanced users only (you can skip it).

  • so can you tell me what line of code is needed in order to set the magnometer sampling rate?

  • edited June 2020

    You are right, the only way to change the sample rate of the mag (which we don't recommend, we prefer people use the defaul) is to use "mbl_mw_mag_bmm150_configure".

    The data types for the configure API call:

    • libmetawear.mbl_mw_mag_bmm150_configure.argtypes= [c_void_p, c_ushort, c_ushort, c_int]
    • mbl_mw_mag_bmm150_configure ( const MblMwMetaWearBoard * board, uint16_t xy_reps, uint16_t z_reps, MblMwMagBmm150Odr odr)


    The way the magnetomter works is by oversampling (repeat measurement). This is how it gets better resolution.

    The "reps" are the number of samples the magnetometer will average before sending out a final value at the requested sampling frequency/rate.

    The acceptable magnetometer sampling rates:
    class MagBmm150Odr:
    _10Hz = 0
    _2Hz = 1
    _6Hz = 2
    _8Hz = 3
    _15Hz = 4
    _20Hz = 5
    _25Hz = 6
    _30Hz = 7

    Take a look at our test code: https://github.com/mbientlab/MetaWear-SDK-Cpp/blob/master/test/test_magnetometer_bmm150.py
    CPP docs for reference: https://mbientlab.com/cppdocs/latest/magnetometer.html
    CPP API docs for reference: https://mbientlab.com/documents/metawear/cpp/0/magnetometer__bmm150_8h.html

    Example usage:

    mbl_mw_mag_bmm150_configure(board, 9, 15, MBL_MW_MAG_BMM150_ODR_25Hz);
    

    More example:

    let magXYReps: UInt16 = 3
    let magZReps: UInt16 = 3
    let magFreq = MBL_MW_MAG_BMM150_ODR_25Hz
    mbl_mw_mag_bmm150_configure(device.board, magXYReps, magZReps, magFreq)
    
Sign In or Register to comment.