Multiple MetaMotionR connection


I purchased 10 or so MetaMotionR earlier and I am writing iOS app to read the accelerometer data from MetaMotionR.
Can I connect multiple MetaMotionR into one iPhone and read the accelerometer data simultaneously from multiple MetaMotionR?
If yes, could you please share an example script to connect multiple MetaMotionR with one iOS app?



  • edited June 26

    The iPhone allows only up to 6 connections at once and I have only been able to get 3 sensors connected at the same time reliably (that's iOS for you).
    Basically you cannot do this with an iOS App; you need to do it with a mini Linux PC like a raspberryPi.

  • Hi Laura,
    Thanks for the information.
    So, an iOS app in an iPhone can connect 3 MetaMotionR at the same time and acquire synchronous data from the 3 sensors at the same time. Is my understanding correct?
    If yes, would it be possible to share the key elements of the script for multi-sensor connection and synchronous data recording?


  • @qpal1012
    You are correct.
    There is no hidden elements or secret sauce, we simply use our APIs which rely on the Bluetooth Core libraries from Apple. You can check out our sample App as a good starting point.

  • Hi Laura
    we have developed an POC App with using following Package in Phone Gap.

    wondering is it mean we can connect multiple MetaMotionR using same connect command and asynchronously to connect MetaMotionR sensors or any other command to be used .

    I started looking at Swift sample app and here is my question
    can we able to connect multiple sensors and able to start acquiring accelerometer data and stop ... how to handle and download the for each sensor recorded accelerometer data ?
    device.connectAndSetup().continueWith(.mainThread) { t in
    it would be helpful if any reference

  • @Srinivasa,
    You want to replicate the code for each MetaSensor:

    var tasks: [Task<MetaWear>] = []
        for device in devices {
            var disconnectTask: Task<MetaWear>?
            tasks.append(device.connectAndSetup().continueOnSuccessWithTask(device.apiAccessExecutor) { t -> Task<MetaWear> in
                return t
            }.continueWithTask { _ in
                return device.connectAndSetup()
            }.continueOnSuccessWithTask(device.apiAccessExecutor) { t -> Task<Int32> in
                disconnectTask = t
                return CommandLog.start(device, configs: SensorConfig.sensors)
            }.continueOnSuccessWithTask(device.apiAccessExecutor) { _ -> Task<MetaWear> in
                return disconnectTask!
  • @Laura
    Thanks for the snippet.
    I could see it was based on Xmaarin or C# based logic. it would be great if you can give the sample link for the Xmaarin. ios sample project as we also would like to try to integrate into Xamarin App.
    is there any package is available to use multiple MetaMotionR connections and get the corresponding data of each sensor.
    I would be happier if I can get a sample app/reference document to integrate into Xamarin.IOS applications.

    Thanks a lot .........

  • @Srinivasa,
    We don't have any Xamarin examples unfortunately.

  • @Laura
    I followed the MetaWearApiTest sample code and checked for the single sensor we can have all options to perform the operation with senor such as streaming accelerometer and logging accelerometer data

    Now I am wondering how to connect multiple sensors and start accelerometer logging at the same time and stop accelerometer logging and download respective data from sensors.?

    Any swift based code will help


  • This is also in our examples.

  • That's really helpful

    Can you please give a reference view controller name or link of an example .?

    currently, I explored this link
    where I could see DeviceDetailViewController.swift file it has below code responsible for start logging data but it was single for sensor

    @IBAction func accelerometerBMI160StartLogPressed(_ sender: Any) {
        accelerometerBMI160StartLog.isEnabled = false
        accelerometerBMI160StopLog.isEnabled = true
        accelerometerBMI160StartStream.isEnabled = false
        accelerometerBMI160StopStream.isEnabled = false
        let signal = mbl_mw_acc_bosch_get_acceleration_data_signal(device.board)!
        mbl_mw_datasignal_log(signal, bridge(obj: self)) { (context, logger) in
            let _self: DeviceDetailViewController = bridge(ptr: context!)
            let cString = mbl_mw_logger_generate_identifier(logger)!
            let identifier = String(cString: cString)
            _self.loggers[identifier] = logger!
        mbl_mw_logging_start(device.board, 0)

    But I am wondering how to do for multiple sensors to it.

  • Again, this is in our examples and tutorials. Please go through them carefully.

Sign In or Register to comment.