Bluetooth is a low-power radio technology used to link devices wirelessly. Most commonly recognised as the way to link a mobile phone to a car or speaker, it has many uses beyond that. The "low power" aspect is not a shortcoming, as a large proportion of devices that use it run from batteries.
There are four classes of Bluetooth device, each utilising a different output power and thus achieving different ranges (maximum distance between devices). Pycom devices support Class 1, 2 and 3 which provide a maximum of 100, 10 and 1 metre respectively. As Bluetooth uses radio frequencies in the range 2.40 to 2.48GHz (gigahertz), like Wi-Fi does, the practical range drops off sharply as more interference is encountered. The "maximum range" should be considered achievable only in ideal circumstances:
- When in line-of-sight: one device can literally 'see' the other with nothing in between (no, not even a tree or a fence)
- When in a radio quiet environment: not running in the same area as a Wi-Fi network, cordless (land-line) phone or microwave oven.
Every Pycom microcontroller comes with Bluetooth! The WiPy being the simplest of these. A skim through the data sheets will reveal all Pycom devices have the same Bluetooth capabilities. We can say with certainty that any Bluetooth functionality you develop will work the same on all of them. Did I mention they all have an on-board antenna for Bluetooth and a u.FL connecter to which an external antenna can be attached?
All Pycom devices use the same ESP32 microprocessor so they all support Bluetooth 4.2 including BR/EBR and BLE. Let's play What's That Acronym!
Data sheets: Current: WiPy 3.0, SiPy, LoPy4, GPy, FiPy. Superseded: WiPy 2.0, LoPy 1.0
More About Bluetooth
Acronym |
Meaning |
BR/EBR |
The point-to-point topology available on Bluetooth Basic Rate/Enhanced Data Rate (BR/EDR) is used for establishing one-to-one (1:1) device communications and is optimized for audio streaming, making it ideal for wireless speakers, headsets, and hands-free in-car systems. |
BLE |
The point-to-point topology available on Bluetooth Low Energy (LE) is used for establishing 1:1 device communications, is optimized for data transfers, and is ideal for connected device products like fitness trackers and health monitors. |
Bluetooth version 4.2 provided new features for Internet of Things (IoT) applications, making Bluetooth more secure and adding Internet Protocol version 6 (IPv6) capability.
What does all this mean? A BR/EBR connection is ideal if we want to stream audio from a Pycom device to a Bluetooth speaker. Likewise, BLE is the method of choice to connect a Pycom device to anything that wants to download or upload data. The addition of better security to Bluetooth makes it harder for someone to 'hack' Bluetooth communications so you can worry less about your neighbours taking control of the IoT smart lighting you just installed!
IPv6 will eventually be a requirement for all devices that want access to the Internet, but it's not essential yet. We can use a Pycom device as an Internet gateway using both WiFi and Bluetooth, then let other Pycom devices connect to the gateway over Bluetooth and access the Internet using only their Bluetooth radio.
Many other uses for Bluetooth are possible. You can, for example, use BLE to broadcast a 'beacon'. A Bluetooth beacon can be used for all kinds of applications. For example, when at an underground train station, where your smartphone can't get a GPS signal, a Bluetooth beacon can let the phone know where it is. A smartphone app can then show the train timetable for that station. Three beacons in a room can be used for trilateration – estimating the position of a Bluetooth device in the room using approximate distances to the beacons.
Although it would seem Bluetooth is the ideal technology to use for a once-in-a-blue-moon software update to devices that are inconvenient to access, it seems this isn't possible. While various device-to-device scenarios will work, programming over Bluetooth or software updates over Bluetooth are not (yet?) possible. Documentation could be better too. If you want to build a Bluetooth device with Pycom, you will find the Pycom Forum is your best source of information.
To learn more about Bluetooth, read our Introduction to Bluetooth.
Sample code is available from:
- The Pycom Libraries on Github
- Pycom documentation:
- 5.2.3 Bluetooth (All Pycom Device Examples)
- 6.2.2.3 Bluetooth (Network)