Bluetooth DevicesBluetooth 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 PlatformSince 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. 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:
Once your BlueZ software is installed, try running:
Wait a little bit, and if there are any active Bluetooth devices near your Linux computer, you should see something like this:
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 DeviceIn 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 DescriptionThe 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:
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.
The Bluetooth Scanner Device will have the ID "sniffer" and use the vw_hcidump_command to create a scanner. Supported Bluetooth DevicesWe 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. |