Skip to content

Getting Started With a Raspberry Pi 3 and the Bosch XDK

Günter Obiltschnig edited this page Oct 28, 2018 · 10 revisions

This page describes how to get started with a Raspberry Pi 3 (running Raspbian Jessie Lite), Bluetooth LE and the Bosch XDK.

The Bosch XDK must have the Virtual XDK firmware. That's the same firmware also required by the Virtual XDK app for iOS and Android.

Bluetooth support in macchina.io requires the bluepy-helper executable that's part of the bluepy project.

Prerequisites

First, install the packages requried by macchina.io and bluepy.

$ sudo apt-get update
$ sudo apt-get install git 
$ sudo apt-get install libssl-dev
$ sudo apt-get install bluetooth
$ sudo apt-get install build-essential libglib2.0-dev libdbus-1-dev

Building macchina.io

Get the macchina.io sources from GitHub and build them.

$ git clone https://github.com/macchina-io/macchina.io.git
$ cd macchina.io
$ make -s -j2 DEFAULT_TARGET=shared_release

Building bluepy (for bluepy-helper)

Build the bluepy-helper executable and install it in /usr/local/bin

$ cd ..
$ git clone https://github.com/macchina-io/bluepy.git
$ cd bluepy/bluepy
$ make
$ sudo cp bluepy-helper /usr/local/bin/

Enabling Bluetooth

Make sure bluetooth is enabled.

$ sudo hciconfig hci0 up

Search for a XDK

Turn on your XDK and find its Bluetooth address.

$  sudo hcitool lescan
LE Scan ...
FC:D6:BD:10:17:CB BCDS_Virtual_Sensor
FC:D6:BD:10:17:CB (unknown)
^C

Enable XDK in macchina.io Configuration

Edit macchina.io/server/macchina.properties and add the following lines (it does not matter where):

#
# Bluetooth LE/XDK
#
btle.bluez.helper = /usr/local/bin/bluepy-helper
xdk.sensors.1.address = FC:D6:BD:10:17:CB

The XDK address must match the address discovered with sudo hcitool lescan.

Run macchina.io

$ export MACCHINA_BASE=/path/to/macchina.io
$ export LD_LIBRARY_PATH=$MACCHINA_BASE/platform/lib/Linux/armv7l:$LD_LIBRARY_PATH
$ cd macchina.io/server
$ bin/Linux/armv7l/macchina

The sensors from the XDK should now be visible in the Sensors & Devices app in the web user interface.