Bluetooth Extends Open Source Applications

By Steven Keeping for Mouser Electronics
Buoyed by the success of open-source software, Arduino pioneered the open-source hardware
(OSHW)
model—encouraging amateur and professional engineers alike to study, modify, distribute, make, and sell
hardware whose design is publicly available. The role of open source hardware in personal and commercial
applications has expanded with built-in (or readily available) Bluetooth® connectivity. While the
Bluetooth 5.0 spec and the subsequent mesh networking addition are important milestones, Bluetooth’s low
energy continues to help open source hardware more widely applicable. What’s more, configuring Bluetooth
and
accessing the Cloud are viable processes as well, making open source hardware combined with Bluetooth wireless
connectivity a potentially powerful tool for hobbyists and engineers alike.
The Role of Open Source Hardware
For several years, OSHW remained low-key, adopted mainly by makers and hobbyists. Early products were based on
mature, unsophisticated silicon such as Atmel’s
ATmega328 8-bit microcontroller
(MCU) family,
which
made them inexpensive and accessible. However, within a few years, start-ups and established companies alike
discovered OSHW permitted short-circuiting of expensive and time-consuming hardware (and software) development
schedules, enabling greater focus on differentiating the application from the competition. Moreover, using OSHW
reduced risks and encouraged innovation.
The advantages of OSHW soon attracted both established silicon vendors and new entrants alike, resulting in the
billion-dollar business served by established silicon vendors and new entrants alike. For every chip giant such
as
Intel and Texas
Instruments there’s a newer, nimble outfit like Seeed
Studios and SparkFun selling single-board
computers (SBCs)
that
meet the terms of the open-source model.
This mature and stable OSHW sector is a boon for the consumer. Engineers can now choose from a range of SBCs
sporting high-end silicon. For under $100 (and often under $50) anyone—from a high-school student to the
most
senior engineer in a blue-chip electronics firm—can purchase a product such as BeagleBoard’s BeagleBone Black
(Figure
1).
Figure 1: The device also integrates enough Flash memory to store the GestIC
library.
The SBC incorporates a Sitara ARM Cortex-A8 32-Bit RISC microprocessor, 512MB capacity of DDR3L 400-MHz SDRAM,
4GB
Flash, USB 2.0 client and host ports, Ethernet, and more. BeagleBone Black is powerful enough to run operating
systems such as Linux and Android, control a sophisticated robot, or manage a home security system.
To complement these capabilities, the latest generation of OSHW SBCs is taking advantage of recent rapid advances
in RF wireless chips that enable connectivity to the Internet of Things (IoT)
and Industrial
IoT
(IIoT). The IoT/IIoT is a global network of connected and “smart” computers, software, appliances,
machines, actuators, and sensors that exchange data and instructions, forming the platform for thousands of new
applications.
Through the support of web-based (typically Arduino compatible) integrated development environments (IDE), an
engineer with basic coding skills and no RF expertise can take advantage of wireless connectivity
to open-up many
new
applications for OSHW. These applications range from simple data logging (for example, humidity and temperature)
using a paired smartphone to connectivity with Cloud servers enabling measurement results to trigger an action
(such
as a text or an alarm).
The Role of Wireless Connectivity for the IoT
While connectivity to the Internet seems straightforward to a smartphone-equipped consumer, it’s far from
trivial. Complex (and therefore expensive) modems running advanced protocols built in to those smartphones (and
computers, tablets, and routers) are required to keep things connected. While some progress toward equipping
simple,
resource-restricted sensors with Internet Protocol (IP) wireless interoperability has been made, formidable
engineering challenges remain before previously dumb objects are cheaply, routinely, and reliably connected to
the
IoT/IIoT.
Several short- and long-range RF technologies will form the foundation of routine connectivity, but Bluetooth low
energy (a low-power form of Bluetooth wireless connectivity) has some key advantages. These advantages include
low
power consumption (ensuring less maintenance due to long life from small batteries), a frequently revised open
standard, and multi-vendor support. Further advantages comes from adoption by most smartphone, tablet, and
wearable
makers.
The Bluetooth Low Energy specification details a Physical Layer (PHY) and a firmware stack. The chip vendor
typically supplies a standards-compliant stack, allowing customers to focus on developing their own application
code
which is then compiled by development tools to form an additional stack layer (Figure 2). For
example, an engineer may add some application code to BLE energy firmware to process, format, and periodically
transmit data to a smartphone to display a temperature trend. The process sounds simple, but even when aided by
user-friendly development tools, wireless application code development can still be somewhat daunting for the
inexperienced.
Figure 2: The Bluetooth Low Energy application code is compiled and added as
an upper layer (blue) to the factory firmware stack (gray). (Source: Texas Instruments)
OSHW SBC suppliers have attempted to address the concerns about application layer development by integrating
Bluetooth low energy configuration into the more familiar SBC’s IDE. An engineer confident enough to
configure
the SBC to communicate via Ethernet or USB, for example, should find it just as easy to set up a wireless link
to a
smartphone or other Bluetooth-equipped device.
Configuring Bluetooth Low Energy
The UDOO Neo is
a
credit card-sized OSHW SBC powered by a Freescale i.MX 6SoloX applications processor with embedded ARM Cortex A9
and
M4 cores. The device also features a SAM3X8E microcontroller (also known as an MCU), supports Android and Linux
OSs
and sports a combination wireless chip (Texas Instruments’ WiLink) for both Bluetooth Low Energy and Wi-Fi
(IEEE 802.11b/g/n) wireless connectivity.
An engineering student can take advantage of the Arduino IDE and educational materials, Arduino Sketches (the
company’s name for a block of code uploaded and run on an Arduino board), and libraries to write code for
the
SAM3X8E MCU, while more experienced users can generate code in C/C++, Python, Java and several other programming
languages for both the MCU and the i.MX applications processor.
UDOO has made it easy to take advantage of Arduino IDE familiarity to configure the Neo’s wireless
capability. The Bluetooth Low Energy functionality is enabled by connecting the SBC to a PC via a USB cable and
then
accessing a web control panel (Figure 3). The web control panel includes a dashboard which
indicates the status of the Neo’s BLE energy connectivity (as well as the status of Wi-Fi, Ethernet, and
USB).
The panel also provides handy access to an Arduino web IDE enabling immediate Sketch origination. From the web
control panel, the Neo can be made “discoverable” to other Bluetooth-enabled devices. Choosing a
device
from the list of available devices activates the Neo’s wireless link. The process is essentially as simple
as
pairing a Bluetooth-equipped smartphone with a Bluetooth speaker.
Figure 3: UDOO's web control panel makes it easy to activate the Neo's
wireless capability. (Source: UDOO)
However, pairing an OSHW SBC with a smartphone and using the wireless connection to do something useful are two
different things. Controlling data transfer over the link requires some basic coding skills but should not be
beyond
an engineer who’s familiar with using an Arduino-compatible IDE to, for instance, program an SBC to flash
a
set of LEDs in sequence.
Adding wireless to an OSHW SBC without the capability is as simple as attaching a compatible daughter board or
“shields” as they are widely known in the OSHW community. The daughter board plugs into Arduino
connectors built in to the SBC. For example, STMicroelectronics’ Nucleo—an OSHW
SBC
incorporating an STM32 MCU (with ARM Cortex M4 core)—can be teamed with an X-NUCLEO-IDB05A1
daughter board to endow it with Bluetooth Low Energy capability (Figure 4).
Figure 4: The IDB05A1 daughter board adds Bluetooth Low Energy wireless to a
Nucleo SBC. (Source: STMicroelectronics)
An extra advantage of the Nucleo/IDB05A1 derives from STMicroelectronics’ participation in the ARM mbed
initiative—a collaboration to develop IoT devices based on ARM MCUs—which provides code libraries
that
enable straightforward Nucleo configuration for a range of common projects such as a heart rate application.
After
locating the project in the mbed library, the code can be imported and compiled, and the image loaded onto the
Nucleo SBC using the mbed IDE.
The STM32 BLE profiles app, hosted on the smartphone can then be used to select the heart rate sensor peripheral
(the Nucleo) and then display heart rate on the mobile’s display.
Accessing the Cloud
In these examples, the OSHW SBC acts as a peripheral sending its data (for example, received from a rotary angle
encoder) to a smartphone (central) device. However, developers planning more complex wireless projects can use
the
UDOO, Intel, and STMicroelectronics SBCs as central devices collecting data from several wireless peripherals,
such
as third-party Bluetooth Low Energy temperature and humidity sensors. Data could be collected in the SBC’s
Flash memory for later transfer to a smartphone app (by reverting the SBC to peripheral operation and using the
smartphone as the central device).
An extension of this project could be to use the temperature and humidity data to trigger actions by forwarding
the
information from the central device to the Cloud and employing a service such as ThingSpeak.com. ThingSpeak (and
similar services) operate as “If This Then That” (IFTTT) action hosts, instigating an output
dependent
on the input. For example, an output could be to send a message to a smartphone to switch on a dehumidifier when
the
humidity in three rooms of a dwelling exceeds 70 percent.
Connecting an SBC directly to the Internet using Bluetooth low energy is challenging; although many BLE firmware
stacks do include Internet Protocol (IPv4 or IPv6)-over-Bluetooth Low Energy technology, there are virtually no
compatible commercial wireless routers to form a relay. One option is to configure a second OSHW SBC to provide
a
relay, but this is tough and demands expert knowledge of both Bluetooth Low Energy—and IPv6-firmware and
development tools.
A simpler solution for the non-expert RF engineer is to employ an SBC with a combination wireless chip (for
example, the Arduino 101). With a combination chip the SBC can use Bluetooth low energy to gather data from
sensors
and then switch to Wi-Fi to relay the information to the Cloud (via a ubiquitous Wi-Fi router).
The set-up for this operation is simplified by the availability of open-source resources like ThingSpeak’s
Arduino Library, which makes it easy for an SBC to join a local Wi-Fi network and periodically upload its data
to
the ThingSpeak server.
A bidirectional wireless link can be used to receive data from sensors, send data to an Internet gateway device
(or
via Wi-Fi to the Cloud) and, crucially, receive data or instructions from other computing devices. The wireless
link
endows an OSHW SBC with “intelligence” by connecting it to the rapidly expanding IoT. Moreover, the
link
can be used to update OS and wireless chip firmware and maintain security through software patches.
Conclusion
The addition of wireless connectivity to OSHW SBCs—readily accessible at a modest price and backed by
development tools that are easy to use even for an engineer with little or no RF knowledge—is dramatically
increasing the number and extent of applications to which these already popular products can be adapted. As a
result, wireless-enabled OSHW SBCs are accelerating the culture of invention and sharing that spawned the
open-source movement in the first place.
Steven Keeping is a contributing writer for
Mouser Electronics and gained a BEng (Hons.) degree at Brighton University, U.K., before working in the
electronics
divisions of Eurotherm and BOC for seven years. He then joined Electronic Production magazine and subsequently
spent
13 years in senior editorial and publishing roles on electronics manufacturing, test, and design titles
including
What's New in Electronics and Australian Electronics Engineering for Trinity Mirror, CMP and RBI in the U.K. and
Australia. In 2006, Steven became a freelance journalist specializing in electronics. He is based in Sydney.