1. Linux Installation

MetaSensors are supported on Linux.

For this tutorial, most images will reflect Ubuntu Desktop on a VM. Ubuntu is one of the most popular distrubutions in existence today and highly recommended. We will also run a few commands on Raspbian OS.

Linux developers can create their own Apps using Javascript (Node.JS) and Python.

You should be comfortable with basic Unix commands and getting around your choice of Linux OS.

Note

Some installation steps may change or look slightly different depending on your Linux distro of choice.

1.1. Requirements

1.1.1. Bluetooth

You will need to consider the following before starting the installation:

  • Make sure your hardware supports Bluetooth

  • Make sure you are comfortable working with Linux

1.2. Installation

Simply follow the Ubuntu install steps on the Ubuntu website :

_images/ubuntu-0.png

The great thing about Ubuntu is that it comes with many packages installed. Please note that if you choose to install a bare-bones Linux distro, you may need to install many utilities, libraries and packages needed to support MetaWear development.

If you are going to use Raspbian OS, we recommend the “Raspbian Buster with desktop”, the lite and the max versions have either too much or too little pre-installed.

Just follow the steps here.

1.3. Recommendation

1.3.1. OS Updates

If Ubuntu or your OS asks for an update, be kind and update!

At the very least, run:

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

1.3.2. Bluetooth

Now, just make sure that the Bluetooth hardware (adapter) is recognized by your OS by using the following command:

>>> hcitool dev
_images/ubuntu-1.png

If your distro does not come with Bluetooth drivers installed, open a terminal window and install the required packages with their dependencies:

>>> sudo apt-get install bluez-utils

Connect your Bluetooth device and restart the Bluetooth services:

>>> sudo /etc/init.d/bluetooth restart

Verify your Bluetooth device is detected along with the appropriate modules:

>>> lsusb
    Device 005: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)

Finally review the output of hcitool dev:

>>> hcitool dev
    Devices:
        hci0    00:11:95:00:1A:CF

If you are having difficulties, please consult the community forum and manual for your OS of choice. The Ubuntu forum has already addressed many issues you may come upon.

1.3.3. Dongles

Linux systems typically support USB to Bluetooth Dongle; they might even support multiple Dongles.

You can use these Dongles to get more sensors connected via the BLE link simultaneously.

First, plug in the USB to BLE Dongle. 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 it 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.

Warning

If you have two of the same dongles, sometimes the second dongle may not be recognized by the system.

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

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

1.3.4. Virtual Machines (VMs)

If you are running in a virtual environment, you will need to take extra care to make sure the Bluetooth drivers and adapters are working in the VM before you do anything else.

For example, VirtualBox guest OS doesn’t recognize the Bluetooth adapter by default. There are many great tutorials to get this working like this one here.

_images/vm-0.png

Steps you can take:

  1. Disable Bluetooth Adapter on Host OS

  2. Launch Guest OS

  3. Enable Bluetooth Adapter on Host OS

  4. Enable Bluetooth Adapter in the usb device list (Guest OS): Devices->usb->check my device

You may also need to install the VirtualBox extension Pack or similar support software, see more information here.

MbientLab is not responsible for VM support. Please consult the forum for the appropriate VM software you are using if you run into issues.

1.3.5. Internet

You also need to make sure you have internet access. The quickest way to test this is to use ping in the terminal:

>>> ping www.google.com

Also check with:

>>> ip address show
>>> ip link show
_images/ubuntu-2.png

If you are having trouble, you can Google “How to connect to the internet on Ubuntu” or similar. There are many options to connect to the internet including wireless and LAN; we quickly highlight them below.

You can troubleshoot through the Ubuntu Network manager. If your local network connection isn’t working, ensure the Enable Networking and Enable Wi-Fi options are selected here in the menu:

_images/ubuntu-11.png

Connect to a Wireless Network

If you have a wireless-enabled computer running the Ubuntu operating system, you can connect to a nearby wireless network to get to the internet. To do this:

  1. Open the System Menu on the right side of the top bar.

  2. Click on Wi-Fi Not Connected to expand the menu.

  3. Click on Select Network.

  4. Look through the names of the nearby networks. Select the one you want. If you don’t see the name of the network you want, click More to see additional networks. If you still don’t see the network you want, it may be hidden or you may be out of range.

  5. Enter the password for the network and click Connect.

_images/ubuntu-26.jpeg

Configure to a Wired Network

To set up most wired network connections, all you need to do is plug in a network cable. The wired network icon (settings) is displayed on the top bar with three dots while the connection is being established. The dots disappear when you are connected.

If this does not happen, you should first of all make sure that your network cable is plugged in. One end of the cable should be plugged into the rectangular Ethernet (network) port on your computer, and the other end should be plugged into a switch, router, network wall socket or similar (depending on the network setup you have). Sometimes, a light beside the Ethernet port will indicate that it is plugged in and active.

If you are still not connected, your network may not support automatic setup (DHCP). In this case you will have to configure it manually. Please consult the appropriate documentation.

_images/ubuntu-27.png