How to Create an Arduino Compatible Bluetooth 4.0 Module

279,791

412

64

Published

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...

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.


Share

    Recommendations

    • Planter Challenge

      Planter Challenge
    • Woodworking Contest

      Woodworking Contest
    • Make it Move Contest

      Make it Move Contest
    user

    We have a be nice policy.
    Please be positive and constructive.

    Tips

    Questions

    64 Comments

    Hi,

    I have Arduino Uno R3 and BLE 4.0 module(Please refer to Photos attached) with breakout board attached. When powered and searched, it broadcasts its name as CC41-A. I am pretty new to hardware. What I am trying for now is to change any default properties (for example name) of this BLE module which this is broadcasting. I am also unable to execute any AT commands in serial monitor of Arduino IDE. No AT Command is responding anything. My connections are as follows:

    Rx of BLE Module <-> Tx of Arduino (Pin 11 in my case)

    Tx of BLE Module <-> Rx of Arduino (Pin 10 in my case)

    GND of BLE Module <-> GND of Arduino

    +5V of BLE Module <-> 5V of Arduino

    (Left 2 pins of BLE Module unconnected - MCU-INT and CLEAR)

    My code is as follows:

    #include <SoftwareSerial.h>
    SoftwareSerial BLE_Serial(10, 11); // RX | TX
    void setup()
    {
    pinMode(9, OUTPUT); // this pin will pull the Module pin 34 (key pin) HIGH to switch module to AT mode
    digitalWrite(9, HIGH);
    Serial.begin(9600);
    Serial.println("Enter AT commands:");
    BLE_Serial.begin(38400); // Module default speed in AT command more
    }
    void loop()
    {
    // Keep reading from Module and send to Arduino Serial Monitor
    if (BLE_Serial.available())
    Serial.write(BLE_Serial.read());
    // Keep reading from Arduino Serial Monitor and send to Module
    if (Serial.available())
    BLE_Serial.write(Serial.read());
    }

    I am getting "Enter AT commands" message, but not getting anything further when I enter AT commands. Please help. Its urgent. Please tell me whether there is something wrong in my code or in my connections. Thanks. :)

    /perrygarg

    frontBle.pngbackBle.jpg
    8 replies

    Try using a FTDI module instead of the Arduino board for configuring the HM-10 module. I've done it and it works!

    https://www.youtube.com/watch?v=N57r_hwin3I

    Just following up on my preview reply. After searching Google and playing with it all day, I've found that you can flash the HM-10 firmware onto the fake CC41-A modules using an Arduino and a PC. The Arduino mimics a TI CCDebugger device, allowing you to flash the CC2541 chip on the board.

    The following github has the Arduino sketch and Windows executable. *Note that Malwarebytes flags this program as a Trojan, but I didn't have any issues. There is also no source code or a way to dump the chip's current flash memory.

    https://github.com/RedBearLab/CCLoader

    Module Pinout: https://flashandrc.wordpress.com/2014/08/26/bluet...

    You also need to get a full dump of a HM-10 firmware. This isn't the firmware on the manufacture's site. That firmware doesn't have the bootloader/low level firmware code. I Google'd for HM-10 open source firmware and found a project by jeremy-prater. He has on his site the stock firmware in the downloads section. I didn't care if I broke this module, so I changed the download file from .hm1 to .bin and flashed it. The module then booted to HM-10 v520 firmware, which I was able to flash using the official tool to the newest v540 firmware. So far I haven't had any issues with the module after flashing, but i haven't tested it extensively.

    If you try this, it's at your own risk. Only try it if you don't mind throwing away the module if it doesn't work. I haven't tested it on the CC2540 chip, and I think you would need different firmware for it to work.

    just to let you know that Jeremy Prater's website is back online since a few days ago on this new address.. http://blog.dev-smart.net/ some of the links are broken because of the domain change, but you can manually change the domain in the URL's and get all the files, here's the firmware http://blog.dev-smart.net/wp-content/uploads/2014/03/Stock-HM-10-Firmware.zip

    Hello.

    I am in same situation as perrygarg.

    It seems the jeremy-prater's firmware is no longer available in his blog. Is it possible to update firmware directly to HM-10 v540?

    Hello!! i'm looking to do just that!! but the EXE just shows a cmd screen for a moment and then dissapears.. and i didn't find the .hm1 file in this project https://github.com/jeremy-prater/OS-CC2540 could you help me sending me the right file to burn?? and what's up with the .exe?? does it have to find the arduino with the sketch already connected or what?? thanks!!

    aampudia,
    The EXE program is a DOS based application. You need to run it from the command prompt in Windows. When you run it from the command prompt, you will need to put in the COM port for your Arduino, the location of the firmware to flash, and other information before it will connect and flash.

    It looks like that project was finished/abandoned and the .hm1 firmware file was deleted.

    yup.. i figured the exe part out a little after posting this... thank you!! don't you have a copy of the bin file??? that would be really helpful!! or at least the original bolutek firmware? help!! xD

    Hi, and thank you for this information! I need to transfer data from my Arduino Uno to the PC via bluetooth 4.0. Hence, I decided to use the HM-10 module. Since my PC supports bluetooth 2.0, I need a dongle with bluetooth 40. BLE.
    Which dongle is useful for this case?

    Maybe this one?
    Thanks a lot!!

    I cant connect my hm 10 module with my phone. it displayed pairing rejected.. how do i solve it? plz help me..

    my BT05 is not visible to any device ???????

    Can you help me understand how I would make an arduino with an hm10 send string commands to a relay board with an hm12? What would I need to write on the arduino sketch to send the commands?

    For anyone that might be interested. I just published free iOS and Android app, that lets you control Arduino with gamepad style interface. The app is compatible with the most popular HM-10 BLE to Serial module.

    More info:

    https://www.instructables.com/id/Controlling-Arduino-Robot-With-IOS-IPhone-IPad-or-/

    Hi,

    great work you did. I bought two HM-10 modules from China and I have problems to connect with. If I power the module the LED begins to blink. If I scan for bluetooth devices I can find it. If I try to connect, I got "connection refused". I tried with my HTC M8 Android device and my laptop. On my laptop I got the device name "BT05".

    Could this be a problem with the firmware? Any suggestions how to solve it?

    Thanks, Chris

    5 replies

    Hey Webpicasso,

    Do you have a link to the modules you purchased? Often, the issue is counterfeit modules which do not conform to the original HMSoft firmware.

    Here it is http://s.aliexpress.com/ZVFRBJFf

    Any helpful suggestions?Thx Chris

    Most likely, they are counterfeit HM-10 modules, which means the firmware is your issue. If you looks at the comments below ours perrygarg and kcender discuss the matter.

    just to let you know that Jeremy Prater's website is back online since a few days ago on this new address.. http://blog.dev-smart.net/ some of the links are broken because of the domain change, but you can manually change the domain in the URL's and get all the files, here's the firmware http://blog.dev-smart.net/wp-content/uploads/2014/03/Stock-HM-10-Firmware.zip