Connect Teensy to Bluetooth module

Nowadays there are multiple ready to use Bluetooth solutions, however, a few years back when I start using BT EDR 2.x (Bluetooth 2.0) I was struggling to find

10 years ago

Latest Post The Great Escape Tunnel by Mario Esposito public

Nowadays there are multiple ready to use Bluetooth solutions, however, a few years back when I start using BT EDR 2.x (Bluetooth 2.0) I was struggling to find information that end to end would walk me through that implementation.

At some point, I mastered it and as I usually do before I forget I log it on my blog so if I should forget, and I know that I will, I can go back and hit my head followed by “ah! Damn it!”

The post was originally documented on my blog ISensoria hosted on Blogspot since I moved it with its own domain and such it has collected a huge massive of visits and comments. In light of that, I decided to revive it and repost it deleting the old blog.

What you need:

The same works as well with HC-x modules. The wiring as well is pretty much the same.


Let’s focus on getting the hardware setup so you can focus on the script to run on the microcontroller of your choice. Since Arduino and clones are ultra-popular in my example below I am going to a user just that.

Wiring for Arduino


Wiring for Teensy for BT Module Option 1


You can leave all the other pins on the BT module disconnected unless your project requires them explicitly.

Wiring for Teensy BT Module Option 2

This module is pretty much what is hosted on the Sparkfun module the only difference is that you have to sold (painfully) directly on the pins.



For the Arduino the code is very simple. Whatever you print over the serial will be posted over the BT channel. On this playground page, you find everything you need.

For Teensy 2.x instead you need a slight change as shown below:

 HardwareSerial bt = HardwareSerial();void setup(void){  bt.begin(115200);  bt.println(); }void loop(void){bt.print("hello BT over UART world"); }

Once the wiring is in place. The code has been uploaded in the usual fashion you’re doing today with your Arduino/Teensy code then just establish a new BT connection with your BT module and enjoy.

To visualize what data is coming over the BT you have multiple choices and each one has some good and bad. I am sharing a few options as a quick jump start from this post to your next smile.

Terminal Client

There are many other options, I just got comfortable with those three.

I will describe the last one as it is not obvious as for the first two options.

After you have established a BT connection from Preferences you want to list what devices you have attached so you know the name of the device to talk to.

ls /dev/tty.*then you want to connectscreen /dev/tty.Keyserial1 9600

To quit the screen app, type control-A, then control-\.

HOLD control-A while you press the second character or it won’t be detected.

If you really want to use Screen, you may need to practice the commands a bit, it’s powerful and convenient in some cases, but it’s not a walk the part for most.

The BT module will present itself with a default name that you may don’t want to use after you figure out the building blocks. To make any change:

  1. Connect to the device
  2. Within the 60 seconds of boot time, you can type $$$ followed by the Enter key
  3. You can now change all the settings. Don’t adventure yourself if you haven’t taken a look at this doc first.

You don’t need to read the entire document but at least, get familiar with the basic commands and take baby steps. It is easy to mess up and enter a weird status. The firmware is solid if you walk the most known path, at least in my experience at the time that I wrote this.

I tried to cover the end to the end of the whole process because I couldn’t find any source out there, I hope this brings you joy and success.

Mario Esposito

Published 10 years ago