While much attention has been focused on the built-in WiFi hardware, the Raspberry Pi 3 (1) also ships with on-board support for Bluetooth. Bluetooth is a wireless technology for exchanging data over short distances using 2.4 GHz radio signals.
When running the recommended Raspbian Linux distribution, the Raspberry Pi uses the standard Linux Bluetooth software stack called BlueZ (2). Qt's Bluetooth module (3) on the Linux platform also supports BlueZ, which means that it works on the Raspberry Pi.
Following the procedure in my recent blog post (4) to build Qt will provide support for Qt Bluetooth. The only additional step is to make sure that you install the development package libbluetooth-dev when initially setting up the image on the Raspberry Pi. When you build Qt, you should then get a working Qt Bluetooth module.
Qt Bluetooth comes with some example programs -- 10 of them in the Qt 5.7.0 release. You'll find them in your Qt install directory under examples/bluetooth if you built the Qt examples (for the procedure listed in the blog post the full path would be /usr/local/qt5pi/examples/bluetooth). Here are screen shots of a few of them running:
Bluetooth Low Energy (BLE) is a subset of Bluetooth aimed at low-power applications where devices can operate from small batteries. The Raspberry Pi 3 also supports BLE and recent releases of Qt have support for it as well. I ran the Qt lowenergyscanner example and it successfully found a low-energy device I have:
If you want to experiment with Bluetooth, including Bluetooth Low Energy, on embedded Linux the Raspberry Pi 3 is a low-cost solution that works with Qt.
Another option is to use a low-cost USB Bluetooth "dongle," which will work on older models of Raspberry Pi that lack on-board Bluetooth hardware or on desktop Linux systems. Many recent laptops also include on-board Bluetooth hardware that will work under desktop Linux if there is a suitable kernel driver for it.
The Qt Bluetooth module is also supported on Android, iOS and Mac OS X, allowing you to write Bluetooth-enabled applications that are portable to all of these platforms.
Join ICS and the Qt Community
at the largest Qt event of the year.
- Raspberry Pi 3 Model B, Raspberry Pi Foundation website, last accessed 11 Aug 2016, www.raspberrypi.org/products/raspberry-pi-3-model-b
- BlueZ project website, last accessed 11 Aug 2016, www.bluez.org
- Qt Bluetooth, Qt documentation website, last accessed 11 Aug 2016, doc.qt.io/qt-5/qtbluetooth-index.html
- Configuring Qt Creator for the Raspberry Pi, ICS blog post, last accessed 11 Aug 2016, www.ics.com/blog/configuring-qt-creator-raspberry-pi