Multiple MetaMotionR connection

Hello,

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?

Thanks.

Comments

  • edited June 2020

    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?

    Thanks.

  • @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. https://github.com/polyglotprogramminginc/cordova-plugin-metawear

    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
                device.clearAndReset()
                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
                mbl_mw_debug_disconnect(device.board)
                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

    Thanks
    Srinivasa.

  • 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
    https://github.com/mbientlab/MetaWear-SDK-iOS-macOS-tvOS
    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
        updateAccelerometerBMI160Settings()
        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)
        mbl_mw_acc_enable_acceleration_sampling(device.board)
        mbl_mw_acc_start(device.board)
    }
    

    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.

  • @Laura said:
    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, I was wondering if there is a list on how many sensors can be connected reliably for each operating system. Can you help me?

  • You have to google-fu this. It depends on the hardware, firmware, OS, and drivers installed.

  • @Laura said:
    You have to google-fu this. It depends on the hardware, firmware, OS, and drivers installed.

    Can you please help me by giving a clear reference link from your examples?
    The requirement is to the ability to start logging from multiple near sensors(probably 3 or more) and stop logging and collect respective sensors accelerometer data.

    Do i need to use MetaHub to connect multiple sensors at the same time to iPhone
    https://mbientlab.com/tutorials/MetaHub.html

    Thank you Appreciated your timely support.
    Regards
    Srinivasarao Ladi.

  • Hi Laura,

    I tried to modify the swift sample to connect multiple saved sensors. here is I am facing an issue with storing the data based on device MAC as i need to download each data separately. Note I am able to download the data for a single senor. I would like to do it for multiple sensors (#3 sensors )

    Can you please help me to know the way to store back data based sensor some unique parameter
    attached modified MainTableViewController with txt extension please rename to .swift as its not allowing in attachement for your reference.

    Please help me to understand how to save these data based on sensors .its really important when working with multiple sensors need to know which data is coming from which sensors

    Appreciated your quick response .
    Thanks


    q

  • @Srinivasa,
    Sorry for the late response, I don't have time to look into code right now. Have you been able to get it working?

  • @Laura said:
    @Srinivasa,
    Sorry for the late response, I don't have time to look into code right now. Have you been able to get it working?

    Yes > @Laura I was figure out but sampling rate is not consistent can you please look at
    https://mbientlab.com/community/discussion/3771/sampling-rate-metabase-motion-r-not-consistent#latest

Sign In or Register to comment.