Skip to main content

No project description provided

Project description

MetaCloud is a cloud service by MbientLab providing data storage, visualization, and analytics for your sensor data.

In order to run the example code in this tutorial, you will need to have an active subscription. If you need to create an account, follow the instructions on this page to begin a free 3 day trial.


Use pip to install the metacloud package.

pip install metacloud --process-dependency-links

If you are syncing data from one of MbientLab’s sensor boards, install the package with the metawear extra.

pip install metacloud[metawear] --process-dependency-links


After installing all of the necessary package, open a new Python file in your favorite text editor, import the metawear and metacloud modules, and create the MetaWearClient and Session objects. The Session constructor requires several attributes that describe the device and your app:

  1. Firmware version
  2. MAC address
  3. Model name
  4. Friendly name identifying the device
  5. App name
  6. App revision

If you don’t have an app name or revision, simply use the __file__ variable for the app name and "1.0.0" for the app revision.

from ctypes import cast, c_char_p
from mbientlab.metacloud import Session
from mbientlab.metawear import MetaWear, libmetawear, parse_value
from mbientlab.metawear.cbindings import *

mac = "D4:5E:82:E1:15:01"
metawear = MetaWear(mac)

libmetawear.mbl_mw_settings_set_connection_parameters(metawear.board, 7.5, 7.5, 0, 6000)

raw = libmetawear.mbl_mw_metawearboard_get_model_name(metawear.board)
model_name = cast(raw, c_char_p).value.decode("ascii")
session = Session(["firmware"], mac, model_name, "Device #1", "metacloud_py_tutorial", "1.0.0")

Start a data stream from the device and add the received values to the Session object. Here we will stream accelerometer data thus will forward it to the add_acc_data method.

# Stream data at 100Hz
libmetawear.mbl_mw_acc_set_range(metawear.board, 16.0)
libmetawear.mbl_mw_acc_set_odr(metawear.board, 100.0)

def data_handler(ptr):
    value = parse_value(ptr)
    session.add_acc_data(ptr.contents.epoch, value.x, value.y, value.z)
data_handler_fn = FnVoid_DataP(data_handler)

signal = libmetawear.mbl_mw_acc_get_acceleration_data_signal(metawear.board)
libmetawear.mbl_mw_datasignal_subscribe(signal, data_handler_fn)

When you are ready to sync the data, stop the accelerometer then push the data to MetaCloud with sync method.

# Stop the stream
# Sync to MetaCloud, replace with actual login credentials
session.sync("username", "password")

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for metacloud, version 0.2.0
Filename, size File type Python version Upload date Hashes
Filename, size metacloud-0.2.0.tar.gz (3.5 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page