MetaHub

Please note MetaHub is entirely optional. A MetaHub is not required to operate your MetaSensor.

_images/metahub1.jpg

The MetaHub is a linux based WiFi to BLE bridge that allows anyone to connect and retrieve data from multiple MetaSensors at once. The Metahub is programmable but it also comes with a plug-n-play dashboard for those who do not want to code.

The MetaHub is a great way to connect sensors without the need for a smartphone, tablet, or computer. It can also be configured to work automatically on boot.

The MetaHub can be mounted on the wall. When part of a building infrastructure such as a hospital, it can be used to locate nurses, patients, and doctors.

The MetaHub can graph sensor data live on screen, store sensor data locally, or push sensor data to the Cloud (if connected to the internet).

On our Store

The MetaHub comes with a

  • 5V 2.5Amps power supply,

  • a 8/16/32GB MicroSD card (Sandisk or similar),

  • and a black plastic case with 4 screws.

The SD card is loaded with the software mentioned below.

Hardware

The MetaHub is a mini computer built on the Raspberry Pi 3 Model B and Raspberry Pi 3 Model B+ platform:

  • Broadcom BCM2837B0, Cortex-A53 (ARMv8) 64-bit SoC @ 1.4GHz

  • 1GB LPDDR2 SDRAM

  • 2.4GHz and 5GHz IEEE 802.11.b/g/n/ac wireless LAN, Bluetooth 4.2, BLE

  • Gigabit Ethernet over USB 2.0 (maximum throughput 300 Mbps)

  • Full-size HDMI

  • 4 USB 2.0 ports

  • 4-pole stereo output and composite video port

  • Micro SD port for loading your operating system and storing data

  • 5V/2.5A DC power input

Note

Your MetaHub can also use the new RaspberryPi 4 model.

You can add a Bluetooth to USB Dongle to each port to connect to more MetaSensors. Each Dongle connects up to 7 additional sensors yielding at least 20 simultaneous MetaSensor connections on the MetaHub. This will require experience in programming.

Bluetooth dongles also add Bluetooth range; they perform better than the internal antenna. Two Bluetooth dongles are provided with the MetaHub bundle.

Software

The MetaHub runs Raspbian OS and comes pre-loaded with our APIs and MetaBase App.

Raspbian comes pre-installed with plenty of software for programming and general use. It has Python, Java, editors and more. Junk such as games and Scratch have been removed from the OS.

Warning

While we have done our best to make it accessible for everyone, you should be comfortable with Linux before using the hub. You can learn more in the Raspberry Pi website.

Build your own Hub

Download Image

Email us at hello[at]mbientlab[dot]com to request the image for our custom hub based on the raspberry pi. We will send it to you entirely free.

The image files are very large, don’t be surprised if they take a while to download.

Get the Hardware

  1. Raspberry Pi Model3 B/B+. Please don’t buy any other model, the image will not load.

  2. 16GB micro SD card. We recommend 16GB class 10 cards.

Writing an image to the SD card

You will need access to a computer where you can plug in that SD card.

You will also need to use an image writing tool to install the image you have downloaded on your SD card.

Etcher is a graphical SD card writing tool that works on Mac OS, Linux and Windows, and is the easiest option for most users. Etcher also supports writing images directly from the zip file, without any unzipping required. To write your image with Etcher:

  1. Download Etcher and install it.

  2. Connect an SD card reader with the SD card inside.

  3. Open Etcher and select from your hard drive the Raspberry Pi .img or .zip file you wish to write to the SD card.

  4. Select the SD card you wish to write your image to.

  5. Review your selections and click ‘Flash!’ to begin writing data to the SD card.

Assembly

Insert the SD card into the RaspberryPi board and continue with the Getting Started guide below.

Getting Started

Power your Hub

_images/metahub2.jpg

To get started, setup your RaspberryPi like a computer:

  1. Connect a LED/LCD screen via the HDMI port.

  2. Connect a keyboard and mouse to the USB ports.

  3. Optionally connect a Bluetooth dongle to the USB port if you have one.

  4. Connect the MetaHub to power using the power supply (AC to micro USB). The MetaHub will boot automatically.

  5. Login to the MetaHub using the following credentials (some images may not require a login):

>>> Login: pi
>>> Password: raspberry
_images/raspbian-0.jpg
  1. Connect the MetaHub to the internet.

_images/metahub_pi0.png

The quickest way to get your MetaHub connected is to use an Ethernet cable and just plug it into the back of your router/switch. As soon as you plug your cable in, you should see the network LEDs start to flicker.

To connect to WiFi networks, look for the wifi icon at the top right hand corner of the Desktop. You should see any broadcasting signals nearby. Enter your password and you should be connected.

Warning

If nothing works, you can connect the RaspberryPi to the WiFi using the commandline. Follow the instructions here.

Dongles

Raspbian Linux supports Bluetooth Dongles. Since there are 4 USB ports on the RaspberryPi3, you can connect up to 4 dongles and use the internal dongle all at the same time (5 hci devices total).

Each dongle means you can connect more MetaSensors simultaneously. That being said, there will still be a data throughput limit at the OS and BLE link level and we recommend a max of 4 sensors per dongle for maximum reliability.

In a typical setup, two of the USB ports are used for the mouse and keyboard on the Pi. This means that of the 4 USB ports on the Pi, only two USB port remain free. This is why our MetaHub Bundle comes with two USB to BLE Dongles!

First, plug in the USB to BLE Dongle(s). Second, type the commands:

>>> lsusb
    Bus 002 Device 005: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
>>> hciconfig
    hci0:   Type: USB
>>> hciconfig -a hci0
    Manufacturer: Accel Semiconductor Ltd. (74)

If the dongle(s) shows up as an hci device, great, you are done!

If not, there are a couple things to consider. First, you need to make sure it is actually a Linux supported dongle: https://elinux.org/RPi_USB_Bluetooth_adapters. If your dongle is not on this list, you are out of luck and need to purchase a new one that is on the list.

Once you have determined that your BLE Dongle(s) is Linux supported, run the following commands with the Dongle(s) plugged-in:

>>> sudo apt-get update
>>> sudo apt-get upgrade
>>> sudo reboot

Issues

If you run into any issues setting up your hub hardware, please refer to the RaspberryPi documentation here.

If you run into any issues with the hub software, please post on our forum.

Understanding the Hub

Once logged in, you will see the Raspbian Desktop.

Everything is based in the App folder. You can open a terminal and navigate to the /home/pi/Apps:

/home/pi/Apps
├── MetaBase-Node
├── MetaBase-Python
├── MetaWear-JavaScript
└── MetaWear-Python
_images/metahub_pi1.png

MetaBase-Node is a node app which allows anyone to configure the MetaSensors using a configuration file placed on the RaspberryPi Desktop. Once the configuration file is complete, double-click the icon and the javascript runs automatically. No coding is needed but all the source code is provided.

MetaBase-Python is a django app which provides a python based web app and dashboard to program, command, download sensor data, set rules and more. All of this without having to write any code. The source code is provided as well.

MetaWear-JavaScript is our JavaScript repository (our Javascript API), downloaded and ready to go with all the supporting libraries and requirements loaded/compiled. This is for those that want to code a Javascript App using our sensors.

MetaWear-Python is our Python repository (our Python API), downloaded and ready to go with all the supporting libraries and requirements loaded/compiled. This is for those that want to code a Python App using our sensors.

MetaBase in Node

The easiest way to connect to a MetaSensor device from the hub is to configure the metabase-config.json file.

_images/metahub_pi2.png

Open the metabase-config.json file on your desktop by right clicking it and using the “Text Editor”. You will see some configuration options that must be set before you can use MetaBase. Find the line that allows you set your MAC address. It should look something like this:

>>> " devices": [
>>>     "E2:C3:6D:33:73:6F"
>>> ],

Change the MAC address to the MAC address of the MetaWear you want to connect to.

Save the file. Now you are ready to run MetaBase.

To run MetaBase, simply double-click the MetaBase App icon on the desktop.

_images/MetaBase_pi4.jpg

If you entered your MAC address correctly, the MetaBase app should successfully connect to your MetaWear and start streaming data at the default rates.

_images/MetaBase_pi2.jpg

Follow the instructions on the screen to terminate the session.

_images/metahub_pi3.png

Data and Logs

Once you terminate your MetaBase session, all the logs can be found in the directory on the Desktop as shown below. The number of logs you will have and how frequent they log data will depend on your configuration file.

_images/metahub_pi4.png

Usage

To understand how to use the configuration file, please refer to the MetaBase README on the Desktop. The README will explain all of the different ways you can configure the sensors through this interface.

_images/metahub_pi5.png

Configuration

Don’t forget, if you use stream mode, the MetaSensor will continue to send sensor data to the MetaHub until you fully reset the device and terminate the session.

If you use log mode, first you must set the sensor to log. Then, when you are done, update the configuration file to download the data as per below:

_images/metahub_pi6.png

Command Line Instructions

If you want to run MetaBase from the command line, you can follow the instructions below.

Open up a terminal from the top left hand menu and navigate to:

>>> ~/Apps/MetaBase-Node

If you browse the directory, you will see that there is an app.js, which is the main MetaBase app, along with supporting files. Open the metabase-config.json file on your desktop and modify the MAC address in the config file if you haven’t already by following the steps in the previous section. Now, copy the “metabase-config.json” from your desktop to the ~/Apps/MetaBase/ directory.

Launch the MetaBase App using the following command:

>>> sudo npm start -- --config metabase-config.json

This will start MetaBase and connect to your MetaWear with the default settings specified in your config file. It will continue to stream, graph and log data until you press [Enter], which terminates the app.

_images/MetaBase_pi1.png

Data and Logs

Once you terminate your MetaBase session, all the logs can be found in the ~/Apps/MetaBase/output directory as shown below. The number of logs you will have and how frequent they log data will depend on your configuration file.

_images/MetaBase_pi3.png