A downside of BLE is that it only supports data rates
up to around 100 Kbps whereas classic Bluetooth devices
can communicate up to 2 Mbps. The new Bluetooth 4. 2
revision blurs the lines between classic and low energy
Bluetooth even further.
Bluetooth Usage
Bluetooth (BT) devices must go through the process
of “pairing” before they can be used together. Not all BT
devices will pair together, however. For example, it
wouldn’t make sense to connect a BT mouse to a BT
headset, although you should be able to pair a BT headset
to a BT phone, or a BT mouse to a BT enabled computer.
Each BT device has one or more use “profiles” which
describe the types of services they can provide. Devices
that are meant to pair together share the same profile. A
current iPhone, for example, has seven different BT profiles
but curiously lacks the SPP (or Serial Port Profile) we require
for our use here. The SPP defines how to set up virtual serial
ports and connect two BT enabled devices. Since it has
been determined that two BT devices are compatible for
connection, a passkey will be required to complete the
pairing. Passkeys are generally simple numeric strings like
0000 or 1234. The Bluetooth module used for our
experiments uses 1234 for its passkey, though this can be
changed for security reasons. Yes, I was quite surprised
when I found out that I couldn’t use my iPad for these
experiments because it doesn’t support the SPP profile.
Luckily, my Nexus 7 Android tablet does.
Bluetooth Connected
Hardware
As I mentioned, I wanted to use the 8x8 RGB LED
matrix hardware I developed previously for my Bluetooth
experiments. As you may recall, this hardware used a
Teensy 3.1 microcontroller (from
pjrc.com) to control an
LED matrix using multiplexing. My thought was I would
get an inexpensive Bluetooth module and connect it to
the Teensy, then use my Nexus 7 tablet to control things.
This actually worked out to be much easier than expected.
Since I was going to use Bluetooth as “a replacement
for an RS-232 cable,” I had to choose a Bluetooth module
that could do so. Looking around on the Internet, I came
across the HC-05 serial Bluetooth module (Figure 1). I
subsequently got one for $8 (with free shipping) on eBay.
The HC-05 module is capable of being a Bluetooth master
or a Bluetooth client; we will only be using it as a client.
Only four connections are required to use the HC-05
module in its simplest configuration, with power and
ground being two of them. The two remaining signals —
RXD (receive data) and TXD (transmit data) — are
connected to the Teensy 3.1 microcontroller as shown in
the schematic in Figure 2. The TXD signal from the HC-05
is connected to the Teensy’s RX1 signal (pin 0), and the
HC-05’s RXD signal is connected to the Teensy’s TX1 (pin
1). The other HC-05 pins are not required for our use here.
June 2015 43
with a
Microcontroller
FIGURE 2. Schematic shows connection between a HC-05 serial Bluetooth module and the
microcontroller hardware developed in a previous article.