4. MetaHub

The MetaHub is built on the Raspberry Pi 3 Model B platform.

The MetaHub runs Raspbian.

The MetaHub comes with a 5V 2.5Amps power supply (USA), a 8GB Class 10 MicroSD card (Sandisk or similar), and a plastic case with screws.


The MetaHub can connect to up to 5 MetaSensors simultaneously with high reliability using the internal Bluetooth.

There are 4 USB ports on the MetaHub.

You can add a Bluetooth to USB Dongle to each port to connect to more MetaSensors. Each Dongle connects up to 5 additional sensors yielding a total of 25 simultaneous MetaSensor connections on the MetaHub at once.

The MetaHub can also receive advertising packets from Beacons.


The MetaHub runs Raspbian out of the box and is loaded with NodeJS and Python code to get you started. You will need to write code to use the MetaHub and therefore you should feel comfortable writing Python and Javascript code.

While we have done our best to make it accessible for everyone, you should be comfortable with basic Linux commands and working with terminals.

4.1. Setup your Hub

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

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

  3. Connect the MetaHub to power using the power supply (AC to micro USB).

  4. Once the MetaHub boots, login to the MetaHub.

    Use the following credentials:

    >>> Login: pi
    >>> Password: raspberry
  5. Connect the MetaHub to the internet.

    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 UI. You should see any broadcasting signals nearby. Enter your password and you should be connected.

  1. The MetaHub comes preloaded with the following to get you started:
  1. NodeJS implementation of MetaBase
  2. Python
  3. Javascript

4.2. Getting started with MetaBase

The easiest way to use the hub is to use the preloaded MetaBase App.

4.2.1. Setup and configuration

You will notice that there is a MetaBase app icon preloaded on the Raspian desktop. This is the easiest way to connect to a MetaSensor device from the hub. But first, you’ll need to configure the settings file.


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:

>>> MAC=E2:C3:6D:33:73:6F

Change the MAC address to the MAC address of the MetaWear you want to connect to. (You can use the smartphone apps to find the MAC address if you don’t already know. You can also do this programmtically eventually, but that will not be covered in this tutorial.)

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

4.2.2. Running MetaBase

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


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


4.2.3. Running MetaBase w/Command Line

If you are having trouble running the app from the desktop for some reason (sometimes there are permissions issues), then you can follow the instructions below.

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

>>> ~/Apps/MetaBase

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.


4.2.4. 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.


4.2.5. Advanced configuration

Once you are comfortable with the process of running MetaBase, you can go back and configure the “metabase-config.json” file further. You can increase the sensor reporting frequencies, the type of sensors you want to record data from, and much more. Please refer to the readme file in the MetaBase folder for detailed configuration settings.

4.3. NodeJS / Javascript Examples

The comes preloaded with several NodeJS/Javacript examples in addition to the MetaBase app. Let’s take a look at how to run a simple example script.

4.3.1. LED Example

In this example, we will connect to a MetaWear based on a known MAC address, and make the LED flash in a preprogrammed pattern.

First, open up the “led.js” file in the ~/Apps/Javascript-Example/ folder.

>>> vi led.js

Edit the mac address (highlighted above) and replaced it with your own MetaWear’s MAC address. If you have never used Vi before, it may help tofind a quick tutorial on Google. After you are done, save and exit using the following command:

>>> :wq

Now run the led.js file:

>>> node led.js

You should see your MetaWear start a green flashing pattern, which shuts off automatically after several seconds. Congratulations, you’ve successfully completed the first NodeJS example!

For more examples and information, please take a look at our Javascript/NodeJS tutorial.

4.4. Python Examples

The MetaHub also comes preloaded with Python examples, which function very similarly to the NodeJS/Javascript ones. For more details, please refer to the Python section of our tutorial.