Introduction: How to Create an Arduino Compatible Bluetooth 4.0 Module

About: I'm a homeless outreach worker in Fort Worth, Texas. I hack away on electronics as a way to deal with the stress; a type of meditation in hopes I don't fall prey to compassion-fatigue or burnout. I spend a…

UPDATE: Lets Make Robots, my home digital hackerspace, was purchased by RobotShop. I don't want to go into, but the new owners banned myself and most of the veteran members. That stated, most of the links there will be broken. Luckily, I was able to make a copy of my content (the reason they banned me?) and moved it to a Github site.

UPDATE:

For Windows users I wrote a GUI terminal app for changing the HM-1X's settings, you can find it here,

HM-1X Aid


UPDATE: I published a free iOS serial terminal app for a client, but it works well for other applications.

I've also created a walkthrough on how to write an iOS app for the HM-10.

UPDATE: I had some people mention I screwed-up and posted the wrong breakout board. For that I'm sorry, please email me and we'll talk.

I have corrected the link with a new version of the breakout that should correct "all" issues (working RX/TX LEDs).

But I'll add, please use this Instructable at your own risk. I'm a Psychology major :P

I had been looking for a cheap alternative to some of the Arduino Bluetooth devices I'd seen, which in my opinion are overpriced.

Redbear's Mini: $39.95 (Note: This is a uC and BLE combo).
Redbear's Uno Shield: $29.95
BLEDuino: $19.95 (if part of Kickstarter)
Bluegiga Shield: $69.95

After seeing these, I thought I'd try to make one; this is my bumbling process for making an Arduino Bluetooth 4.0 device at home:

I highly recommend reading details about the HM-10 and interfacing with it:

Variants of the PCB can be found here; though, many are untested.


This is a fellow to keep an eye on. He is working on creating open-source firmware to replace the HM-10 firmware.

Step 1: How to Create an Arduino Compatible Bluetooth 4.0 Module

This guide is intended to show how to interface one of these HM-10 Bluetooth Low Energy modules to an Arduino.

I started working with these little Bluetooth modules in attempt to add Bluetooth 4.0 to my robot projects.

 

Step 2: Arduino BT 4.0 Module -- Overview

There are a few bits of information I'd like to offer upfront. First, I'm a homeless outreach worker; I'm not an engineer of any sort. So, there will be mistakes in my design.

Second, although I was able to interface these BT 4.0 modules with an Arduino, I've not fully interfaced them with a PC or mobile device. This is due to the BT 4.0 software stacks being very different than earlier versions of Bluetooth (<3.0).

Still, I've shown that is possible to make this bridge using the Lightblue app for iOS.



It's also one reason I write. I'm too cheap to pay to develop an iOS app to interface with these modules and I don't own an Android device with BT 4.0. So, I'm hoping someone in the crowd will let me know when they've finished the software needed. :)

I will state that Jellybean 4.3 offers a Bluetooth 4.0 API.

Now, price is a big concern with me, so I'll givet the breakdown up front:

The bill-of-materials (BOM):
1.HM-10 x 1
2.BS1138 x 1
3.0603 LEDs x 3 (best if assorted colors)
4.0805 Resistors 10k x 3
5.0805 Resistor 20k x 1
6.0805 Resistors 470 x 3

7.0805 1uF capacitor x 2

8.(OPTIONAL) SOT-23-5 LDO Voltage Regulator (it doesn't make sense to use this, but I put the option on the board just in case. I'll explain).

This should bring your total just under $10 USD. And the boards I purchased from OSHPark, which come out to be less than $2 a piece. Therefore, I figure around $12 for a BT 4.0 module.

I felt this price was better than some of the options available:

Redbear's Mini: $39.95 (Note: This is a uC and BLE combo).
Redbear's Uno Shield: $29.95
BLEDuino: $19.95 (if part of Kickstarter)
Bluegiga Shield: $69.95

Step 3: Arduino BT 4.0 Module -- Order the Parts

Alright, if I've not scared you away then the first thing to do is select a layout.

I designed two different layouts, a Xbee footprint and a full breakout, which will fit nicely into a breadboard.


Breadboard breakout (v.9.9). $6.80 for 3 boards.

Order the components listed

The bill-of-materials (BOM):

  1. HM-10 x 1
  2. BSS138 x 1
  3. 0603 LEDs x 3 (2 x Green, 1 x any other color)
  4. 0805 Resistors 10k x 3
  5. 0805 Resistors 20k x 1
  6. 0805 Resistors 470 x 2
  7. 0805 1uF capacitor x 2
  8. (OPTIONAL) SOT-23-5 LDO Voltage Regulator (it doesn't make sense to use this, but I put the option on the board just in case. I'll explain).


The total time on the boards is ~16 days.

If you are interested in my other HM-10 boards (like the ones that don't work). I've a lot of variants on the Github.

Step 4: Arduino BT 4.0 Module -- Soldering

A few notes on soldering the SMD pieces:

DON'T BE SCARED. It's really not that hard.
1. There are three musts to SMD, at least from my perspective: a small iron tip, precision tweezers, thread-like solder (at least .022" solder wire).

2. Other important soldering tools: A wet sponge and brass-ballwill keep your fine soldering tip fine. Sponge the solder tip, then run it through the brass-ball after each component to prevent build-up.

3. To speak blasphemy: Flux is ok, but I find the tweezers often take place of the flux.

4. Practice using both hands during soldering. Tweezers in one and solder-iron in the other.

5. The drag-to-solder method will be what you use on this board.

6. Patience.

7. Have a cup of wine. Alcohol reduces performance on most skills, except, skills that involve fine motor control, there is a marked 20% improvement. Though, this relationship is curve-linear. One glass is good, two glasses and you'll smoke something.

8. Honor the age old tradition: Don't solder in your boxers.

Here is a video of me soldering the first iteration of the breakout board.

Step 5: Arduino BT 4.0 Module -- Design Notes

Ok. As I'm sure it is apparent by now, I'm all hack.

The interface between the HM-10 and the Arduino are really a pure steal from Sparkfun's posted schematic on level conversion. I believe it actually comes from the NXP application note here.

As for the linear regulator: I added this option to the board in case there is no pre-regulated 3.3v source, but it inherently contradicts the purpose of using a Bluetooth 4.0 module: extremely low power consumption. I tried to get a reading on the milliamps the HM-10 pulls, but my multi-meter only goes to the tenths (ma) and the module wouldn't show at all, even during active use. And as many already know, the linear regulator is extremely inefficient. So, it's much better to solder the jumper bypassing he regulator and leave it un-populated.



Step 6: Arduino BT 4.0 Module -- Firmware Master

The hookup is pretty simple.

    BT-3.3v <---> 3.3v
    BT-RX <---> FTDI-TX
    BT-TX <---> FTDI-RX
    BT-IO1 <--> LED <--> 220 Res. <--> GND
    BT-GND <---> FTDI GND

(For the 3.3v I used an external regulator and tied my grounds).

A few notes, the RX and TX lines are translated from 3.3v to 5v by way of a voltage divider and the BS1138.  All other lines will die at >3.3v. 

Now, as I've stated, I'm connecting two modules together, so you have to set one module as the slave.

I used RealTerm to access the HM-10s firmware via AT commands (full list in the manual).

    Under the "Port" tab
    Baud: 9600
    Parity: None
    Data Bits: 8
    Stop Bits: 1
    Hardware Flow Control: RTS/CTS
    Software Flow Control: Receive--Yes, Transmit--Yes
    Under the "Echo Port" tab
    Echo On: Yes
    Monitor: Yes

Then, under the "Send" tab type in AT commands and hit "Send ASCII":

   Send: AT
   Response: OK

Now, setup one unit as the slave (they default as master).

   Send: AT+ROLE1
   Response: OK+Role:Slave

That should be all we need to do to setup the connection.  Now, whenever they power on they will automatically try to mate.  You'll know if they are connected if the LED goes from blinking to solid.

Step 7: Arduino BT 4.0 Module -- Firmware Slave

BT-3.3v <---> Arduino 3.3
BT-RX <---> Arduino TX
BT-TX <---> Arduino RX
BT-IO1 <--> LED <--> 220 Res. <--> GND (or if you've soldered on the 0603s you can skip that connection).

Notice the mistakes routing my board? :(
It was salvageable though.

Step 8: Questions and Gripes

That's it.

I'm still working with these little modules; so if I come up with new versions I'll try to keep this updated.

If someone wants to review my full work log, you're welcome to.

First Go
Second Go

If someone finds a mistake, just let me know, I'll correct it as quick as possible.   

Can't say it enough: I'm all hack.  And publishing my crap so someone can tell me what I'm doing wrong helps me a lot.


I Could Make That Contest

Participated in the
I Could Make That Contest

Microcontroller Contest

Participated in the
Microcontroller Contest