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

Note

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.

The Raspbian OS loaded on the MetaHub does not have a GUI; it is in terminal mode only. You should be comfortable with basic Linux commands and working with terminals.

21.1. Setup your Hub

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

  2. Connect a keyboard to one of the USB ports. Because there is no GUI loaded with the Raspbian version, you do not need to connect a mouse.

  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. Finally, 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 scan for WiFi networks, use the command:

    >>> sudo iwlist wlan0 scan
    

    Once you know which network you want to connect to, run the command:

    >>> sudo vim /etc/network/interfaces
    

    You will see a place to put in the SSID wpa-ssid "ssid" and the password wpa-psk "password" to connect to the WiFi network.

  6. Save, exit, and reboot! Your MetaHub will be connected the next time it boots.

    >>> sudo reboot
    

    Alternatively you could restart the network interface:

    >>> sudo service networking restart
    >>> sudo ifdown wlan0
    >>> sudo ifup wlan0
    >>> ifconfig
    
  7. With MetaHub, you have two options to move forward:

  1. Python
  2. Javascript

Choose your prefered language and get started below.

21.2. Node / Javascript MetaBase

COMING SOON.

21.3. Python MetaBase

COMING SOON.

21.4. Build your own Hub

  1. Install the Raspbian OS on an SD card:

    Follow the instructions in the previous section link to boot and setup your MetaHub.

  2. Change settings (such as the keyboard layout):

    Use the GUI:

    >>> sudo raspi-config
    
  3. Add Wifi:

    Follow these RaspberryPi Instructions.

    Update packages:

    >>> sudo apt-get update
    

    Install GIT:

    >>> sudo apt-get install git
    

    Install pip:

    >>> sudo apt-get install python-pip
    

    Install Bluetooth dependencies:

    >>> sudo apt-get install pkg-config libboost-python-dev libboost-thread-dev libbluetooth-dev libglib2.0-dev python-dev build-essential python-dev
    

    Install Bluetooth libraries:

    >>> pip install pygatt
    >>> pip install pybluez[ble]
    

    Install Node:

    >>> sudo apt-get install -y build-essential
    >>> curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
    >>> sudo apt-get install -y nodejs
    

    Alternatively, for Node.js 8:

    >>> curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
    >>> sudo apt-get install -y nodejs
    
  4. Choose the most fitting Meta SDK repositories on Github:

  5. Clone the repositories of the Meta SDK you want to use:

    Make sure you are comfortable with GIT:

    >>> git clone REPO_NAME
    
  6. Go to the API part of the tutorial or get started by looking at the example code in the repository you just downloaded.