Software Overview  |  Sitemap  |  Downloads  |  Developers  |  Forums

Bluetooth Devices

Bluetooth is a popular wireless communications protocol. It is supported on most cell phones, and there are countless numbers of Bluetooth devices available for purchase. The most common Bluetooth devices are audio devices (e.g. headphones, headsets, and speakers), but there are also many Bluetooth sensors and actuators.

Bluetooth has two different operational modes. One is broadcasting, which is useful for low power sensing and status reporting, and the other is point to point (or "paired"), which is useful for communicating bidirectionally and for communicating securely. Virtual Wiring currently makes use of broadcasting Bluetooth devices. A typical Bluetooth broadcasting device is a battery powered remote sensor.

Currently, Bluetooth is not natively supported on Linux platforms, though it is supported on Macs. Bluetooth also runs differently on Macs than it does on Linux. As a result, supporting Bluetooth on different platforms (Macs, Linux) requires different approaches. For the moment, unless there is a strong demand, we are only supporting Bluetooth on Linux platforms.

Setting Up Bluetooth on Your Virtual Wiring Platform

Since Bluetooth is a wireless protocol, you need Bluetooth radios. To set up Bluetooth on Linux platforms, you have to have a Bluetooth radio and Linux Bluetooth software. Fortunately, the latest Raspberry Pis (Pi 3s and later models) come with a Bluetooth radio pre-installed. (Earlier Pis and other Linux platforms may not have a Bluetooth radio.) If your Linux platform does not have a Bluetooth radio, you can purchase (inexpensively) a USB Bluetooth dongle. Your dongle should support Bluetooth 4.0 or greater.

A Bluetooth Dongle
Bluetooth Dongle

Once you have a Bluetooth radio installed, you need to install the Linux Bluetooth software. We use software called BlueZ. To install BlueZ on Linux run:

sudo apt-get install bluez-hcidump

Once your BlueZ software is installed, try running:

sudo hcitool lescan --duplicates & sudo hcidump -x -R

Wait a little bit, and if there are any active Bluetooth devices near your Linux computer, you should see something like this:

HCI sniffer - Bluetooth packet analyzer ver 5.23
device: hci0 snap_len: 1500 filter: 0xffffffff
< 01 0B 20 07 01 10 00 10 00 00 00 
> 04 0E 04 01 0B 20 0C 
> 04 3E 28 02 01 03 00 73 34 3C 27 97 C0 1C 1B FF 75 00 42 04 
  01 80 60 C0 97 27 3C 34 73 C2 97 27 3C 34 72 01 00 00 00 00 
  00 00 D9 
> 04 3E 2A 02 01 03 01 A4 D2 4E 44 68 EC 1E 02 01 06 1A FF 4C 
  00 02 15 E1 F5 4E 02 1E 23 44 E0 9C 3D 51 2E B5 6A DE C9 00 
  64 00 64 B9 C8 

What you are seeing is a dump of Bluetooth packets. If there are no nearby Bluetooth devices active, you should still see an opening message. Hit cntl-c to stop the dump. You are good to go.

The Bluetooth Sniffer Device

In order for your Virtual Wiring Devices to receive Bluetooth broadcasts, you need to create a Sniffer Device. The Sniffer's job is to listen for all Bluetooth packets and present them to the Virtual Wiring system for processing. For each Virtual Wiring System, you should only need to set up one sniffer, as all Bluetooth Devices in the system share it.

Sniffer Device Description

The Sniffer Device listens to Bluetooth transmissions and reports them to the system. You need a Sniffer because it is the source of Bluetooth packets for all your Virtual Wiring Bluetooth Devices. As you can see in the drawing, Sniffers have no input or output terminals.

To set up a Sniffer, run the Sniffer Script in the Bluetooth Directory of your Scripts Directory.

The parameters for the Sniffer Script are:

  • scanner_name : a quoted string with the name of the desired Bluetooth scanner. Currently, there is only one scanner supported, the vw_hcidump_command. In time, there may be additional scanners supported.

Note: the vw_hcidump_command is actually the name of a script in your Scripts/programming directory. You can read it and modify it, if necessary. If you do choose to modify the vw_hcidump_command, you may want to move it into a directory in your Linux $PATH. That way, if at some point you decide to upgrade to a newer version of Virtual Wiring, your changes will be preserved. Just remember to delete vw_hcidump_command from your $PATH if you want to use the default version (which comes with your Virtual Wiring software).

Running the Sniffer Script with the parameters listed below creates a Bluetooth Sniffer Device.

id: "sniffer"
scanner_name : "vw_hcidump_command"

The Bluetooth Scanner Device will have the ID "sniffer" and use the vw_hcidump_command to create a scanner.

Supported Bluetooth Devices

We currently support a family of Bluetooth sensors made by a company called Estimote. Estimote offers a set of telemetry beacons which broadcast measurements about their immediate environment. For information on Estimote Telemetry Devices, go to our Estimote Devices page.

Catalina Computing, LLC.

Copyright © Catalina Computing, LLC. (2013-2018)

Page last updated: Tue May 29 21:21:05 2018 (UTC)