Как сделать веб-приложение для вашего собственного bluetooth low energy девайса?

Содержание

Выбираем Блютуз адаптер для компьютера

При выборе Блютуз адаптера я советую ориентироваться по таким параметрам:

Вот фото характеристик моего адаптера:

Ориентируйтесь по параметрам, о которых я писал выше. Думаю, что этой информации вам будет достаточно для того, чтобы выбрать нормальный и подходящий Блютуз адаптер для своего компьютера.

Еще несколько советов по выбору и конкретные модели

Главное не спешите. Почитайте отзывы. Изучите характеристики. Так же советую не покупать самые дешевые адаптеры. Особенно, если вам нужен адаптер для подключения хороших Bluetooth наушников, для передачи файлов, подключения джойстика и т. д. Мало того, что они плохого качества, так еще и устаревшей версии. Да, они могут быть намного дешевле. Но не исключено, что вы его потом просто выбросите, или пойдете сдавать в магазин.

Вот например адаптер STlab B-122. Стоит всего чуть больше двух долларов (и это в наших магазинах). Но там Bluetooth версии 2.0 с поддержкой голосового режима и куча разных проблем при соединении с другими устройствами. Да, он будет работать, но подойдет далеко не для всех задач. Так же возможно придется повозится с поиском подходящих драйверов. Такие дешевые адаптеры вообще не советую покупать. И версию 2.0 лучше не берите.

Тот что выбрал я – Grand-X Bluetooth 4.0 (BT40G), стоит уже почти 9 долларов. Но там уже версия Bluetooth 4.0, первый класс и неплохие отзывы. Есть еще более дорогие модели. Например, Bluetooth-адаптер Trust 4.0. И более дешевые – F&D BD-10 и STlab 4.0 (B-421). Если вы привыкли доверять более популярным компаниям, то можете посмотреть ASUS USB-BT400.

HM-11. Non break out version.

For a future project I wanted a Bluetooth module that was as small as possible and the HM-11 without a breakout board looked suitable. However, After playing with them for a while I decided to stick with Bluetooth v2 and will use a HC-05 without the breakout board instead.

Basically the same as the HM-10 but in a small package.

CC2540 or CC2541 chip.
Bluetooth version 4.0
Firmware HMSoft V540
Default baud rate is 9600
Default PIN is 000000
Default name is HMSOFT
AT commands need to be uppercase
The HM-11 does not like line end characters (\r\n).

The HM-11 is Bluetooth 4.0 BLE only and not compatible with Bluetooth 2.0 or 2.1. The model I received includes the CC2541 chip as opposed to the CC2540 chip.

Pins

Since there is no break out board all pins are 3.3v

The minimum connections to get the modules working are TX, RX, VCC and GND. I also added a LED to pin 15 so that I had visual confirmation that the module was on. The extra white wire is attached to pin 16 (SYSTEM KEY) but this is not connected in the below photos. The wire is single core wire wrap wire which I find very convenient for this kind of work.

The HM-11 is operationally the same as the HM-10 and there is more information in the HM-10 guide.

HC-05 zs-040 hc01.com V2.1

Another version of the HC-05 on the zs-040 breakout board but this ones uses the real HC SMD Bluetooth board (you can tell by the logo and the blue LED).

The hardware is basically the same as the HC-06. The difference is the firmware. The HC-05s can operate as MASTER or SLAVE devices.

These start in communication mode and need to be put in to AT mode by bringing pin 34 HIGH. This can be done by closing the small button switch as you power the modules. When in AT mode the baud rate is set to 38400.
Unlike the other zs-040 HC-05 modules I have it looks like bringing pin 34 HIGH after the modules have started does not put them in AT mode. I haven’t really investigated this properly though.

Uses the CSR BC04 (BC417) chip
Bluetooth version v2.0 + EDR
Firmware hc01.comV2.1. by Wavesen.
Default communication baud rate is 9600
AT mode baud rate is 38400
Default PIN is 1234
Default name is HC-05
The small Bluetooth boards have a blue LED at the top left.

The EN pin when briefly brought LOW, breaks an active connection and resets the module.
The STATE pin goes HIGH when a connection is made.

AT commands require the nl/cr line endings and can be in upper case or lower case.

Downloads

Chinese data sheetEnglish data sheetChinese AT command guideEnglish AT command guide

As with the HC-06s the Chinese data sheets are more up-to-date than the English ones.

Further Information

Guangzhou HC website (Chinese only but google translate works)Website download page (Chinese only again). Note the English docs are not as up-to-date as the Chinese docs.Wavesen product page.Only the first photo shows the the correct (with LED) version. The other photos still show the the older no blue LED version.

Характеристики

Давайте подробнее разберёмся, какие характеристики имеет такой bluetooth модуль для ПК и различных проектов. Сами разработчики заявляют, что выдержали коммерческий стандарт в hc 05. Соответственно, для управления устройством будет достаточно специальной программы на смартфоне или компьютере, которая позволит отправлять и получать данные с датчика. Однако существует ограничение в области применения, ведь устойчивый сигнал, без использования усилителей, можно поймать лишь на 9 метрах от чипа

Учитывайте, что это сырые цифры, в которых во внимание не берутся преграды на пути волн

Сами hc чипы полностью совместимы с любыми адаптерами, что поддерживают SPP. На самой плате устройства размещается небольшая антенна, припаянная к верхнему слою в виде дорожки, похожей на змею. Характеристики девайса заявлены следующие:

  1. Активные частоты радиосвязи находятся в диапазоне 2.4-2.48 ГГц.
  2. Канал приспособлен к адаптивному переключению.
  3. Условная дальность связи – 10 метров, но в этой цифре не учитываются преграды и помехи.
  4. Максимальная скорость при обмене информацией – 115300 бод.
  5. Хранить чип можно в температурном диапазоне от — 40 до +85 градусов, а вот использовать – от -20 до +70.
  6. Для работы необходимо будет напряжение в 3.3 В, что мы рассмотрим чуть ниже.

Как пользоваться адаптером?

Просто подключите его в USB-порт компьютера.

И если вам повезет (как и мне), то Windows автоматически опознает Bluetooth адаптер и вы сможете сразу подключать устройства. В моем случае была установлена Windows 10. Адаптер от Grand-X определился сразу и появился в диспетчере устройств.

И на панели уведомлений появилась иконка «Bluetooth». Нажав на которую можно добавить новые устройства, отправить/принять файл, открыть настройки и т. д.

Понятно, что в зависимости от адаптера и установленной на компьютере операционной системы, он может не определится автоматически. И придется устанавливать драйвер вручную. Но с адаптером обычно идет диск в комплекте. Если драйвера с диска не подойдут, то нужно искать их в интернете. Желательно скачивать с официального сайта производителя. Правда, не всегда есть такая возможность.

Если у вас уже есть адаптер, вы его подключили и все работает, то вам может пригодится статья как подключить Bluetooth наушники к компьютеру или ноутбуку на Windows 10. На ее примере вы можете посмотреть, как подключать Bluetooth устройства к компьютеру с установленной Windows 10.

143

Сергей

Bluetooth

Bluetooth в Arduino проектах

Самыми популярными модулями являются устройства на основе чипа BC417. Эта серия называется HC. Модули HC-03 и HC-05 могут быть и сервером соединения, и клиентом, они обладают широким набором АТ команд.

Для подключения к ПК потребуются модуль Bluetooth, плата Ардуино, соединительные провода и компьютер. Скетч для управления платой Ардуино через смартфон и компьютер будет одинаковым, так как в обоих случаях данные в микроконтроллер буду поступать по протоколу UART. Схема подключения Bluetooth-модуля к плате представлена на рисунке. Пин RX на ардуино подключается к TDX, TX – к RDX, GND – к GND, 5V – к VCC.

При загрузке скетча нужно отключить Bluetooth-модуль, иначе будет появляться ошибка доступа к Ардуино.  Также нужно установить на смартфон или планшет, поддерживающий ОС Android, приложение для отправки данных на модуль.  После установки приложения нужно загрузить скетч и подключить модуль к плате Ардуино.  Пример кода мигания светодиода:


int val;

void setup()

{

Serial.begin(9600);

pinMode(13, OUTPUT); // 13 пин – светодиод, объявляется как выход

}

void loop()

{

if (Serial.available()) // проверка поданных команд

{

val = Serial.read();

if (val == '1') {digitalWrite(13, HIGH);} // при 1 включается светодиод

if (val == '0') {digitalWrite(13, LOW);}  // при 0 выключается светодиод

}

}

Теперь нужно настроить соединение телефона и модуля. Для установки соединения нужно зайти в настройки телефона и включить Bluetooth. Как только устройство будет найдено, нужно ввести пароль – обычно это «1234» или «0000». После этого нужно зайти в приложение, нажать на кнопку «подключить Bluetooth» и выбрать нужное устройство. При успешном сопряжении на модуле светодиод начнет мигать медленнее,  примерно 1 раз в 2 секунды.

В скетче светодиод включается и выключается при получении цифр «1» и «0». Кроме цифр также можно использовать буквы латинского алфавита с учетом регистра.

Аналогичным образом можно подключаться к модулю при помощи компьютера. Для этого существуют различные программы, которые подключатся к COM-порту. При запуске программы запрашивают номер порта, скорость  и тип подключения. При успешном подключении на экране появится поле терминала, в которое нужно ввести с клавиатуры цифры/буквы, включающие светодиод.

HM-10

There are 2 versions of the HM-10; the S version and the C version. There are slight component differences and the HM-10C does not have the pads along the bottom (26 pads instead of 34) but operationally they are the same. More details here.

The HM-10Cs I have have the Keyes branding.

HM-10S

HM-10C

When compared to other Bluetooth modules the pins are reversed and there is a BRK pin rather then a EN or KEY pin.

The STATE pin is connected to the on board LED. Blinking when waiting for pairing or a connection. Solid on when connected and just after pairing.
The BRK pin allows you to reset a connection. When there is an active connection, bring the BRK pin momentarily LOW breaks the connection. When there is no connection making the BRK HIGH or LOW has no effect.

CC2540 or CC2541 chip.
Bluetooth version 4.0
Firmware HMSoft V540
Default baud rate is 9600
Default PIN is 000000
Default name is HMSOFT
AT commands need to be uppercase
The HM-10 does not like line end characters (\r\n).

The HM-10 is a Bluetooth 4.0 BLE module and not compatible with Bluetooth 2.0 or 2.1. The model I received includes the CC2541 chip as opposed to the CC2540 chip.

For more information see the HM-10 Bluetooth 4 BLE Modules post

Описание модуля Bluetooth HC 06

Все существующие типы модулей Bluetooth имеют свои особенности, но по функциям и действию они похожи. Одним из видов модулей является Bluetooth HC 06. Со стороны Ардуино модуль выглядит как обычный последовательный интерфейс, поэтому можно сразу наладить взаимодействие с устройством на компьютере.

Основные характеристики модуля:

  • Питание 3,3В – 6 В;
  • Максимальное входное напряжение 5 В;
  • Максимальный ток 45 мА;
  • Скорость передачи данных 1200–1382400 бод;
  • Рабочие частоты 2,40 ГГц – 2,48ГГц;
  • Поддержка спецификации bluetooth версии 2.1;
  • Малое потребление энергии;
  • Высокий уровень защиты данных;
  • Дальность связи 30 м;
  • Для подключения к смартфону используются следующие данные – пароль «1234», скорость передачи данных 9600, имя модуля HС-06.

Модуль имеет следующие контакты:

  • VCC , GND – плюс и минус питания;
  • RX и TX – приемник и передатчик;
  • MCU-INT – выводит статус;
  • Clear (Reset) – сбрасывание и перезагрузка модуля. Последние два вывода обычно не задействованы в работе, поэтому сейчас производятся модули без этих контактов.

Модуль HC-06 используется только в режиме slave, то есть он не может самостоятельно подключаться к другим устройствам Bluetooth. Все настройки для подключения «пароль, скорость передачи данных» можно изменить при помощи АТ-команд.

В комплектацию модуля не входят соединительные провода.

HC-06 (ZG-B23090W) Bluetooth 2.0 EDR modules

HC-06 (ZG-B23090W): Basic Specs

Slave only module
Bluetooth 2.0 EDR
Based on the csr BC417 chip
Firmware is linvor V1.8 which is (I think) created by Wavesen and getting a little old.
Default baud rate for serial UART is 9600
AT commands need to be uppercase without line endings.

Hard to know if these are copies or not (I suspect they are). Wavesen are the manufactures of the original HC series of Bluetooth modules and their modules now feature the HC logo screen printed on the Bluetooth SMD board (the small daughter board) and a blue LED at the top right. Since these modules do not have the logo nor the blue LED I presume they are copies. But, the photos in the data sheet feature modules without the logo. Bare in mind the data sheets are from 2010 and 2011.

For more information see the HC-06 (ZG-B23090W) Bluetooth 2.0 EDR modules post.

Подключение

В печатной плате установлено несколько контактов под пайку, у торцов устройства. Но напрямую подсоединять провода к контактам девайса не стоит, ведь в плате применяется особая технология, позволяющая максимально компактно впихнуть габариты устройства в вашу систему.

Устанавливать модуль необходимо достаточно плотно, для чего подойдёт стандартный МК или специальные платы, в которых применяются вилки-соединители. Но вы можете приобрести и отдельную плату под девайсы серии hc, или же сделать их самостоятельно, если у вас есть навыки по проектированию и созданию электронных плат.

В подобном девайсе обязательно должен быть соединительный разъем\специальные отверстия для монтажа проводки, а также светодиоды, которые помогут определить, идёт ли ток и работает ли устройство. Помимо прочего, необходимы стабилизаторы, специальный переключатель для reset’а прошивки и преобразователи интерфейсов, по вашему желанию.

При первом подключении важно проверить работоспособность, для этого подойдёт смартфон или ПК. Просто подайте ток на модуль и просканируйте его соответствующими устройствами

Getting Started

Determining what modules you have and what firmware they are running is key to getting them to work and there are various things you can use to find more information.
1. Markings on the board or the breakout board.
2. Number and type of pins on the breakout board.
3. The type of Bluetooth.
4. The chip(s) used.
5. Talking to the module.

But the first thing you should do is try it. Power it up, make sure it works and see what name it transmits. If it transmits “HC-06” or “HC-05” you know it will be Bluetooth 2.0 or 2.1. HMSoft, AT-09, BT05, CC2540, CC2541 all mean BLE.

I am an Android user (sorry I can’t help with IOS) so all the examples will be from Android devices.

On Android devices (that have Bluetooth), all Bluetooth 2.0/2.1 devices should show up in Settings => Bluetooth => Scan for devices. BLE modules may or may not show up depending on the Android device you have and the version of Android it is running.

For BLE you should use one of the many BLE apps. I generally use BLE Scanner or B-BLE but there are many others.

Markings on the board / breakout board

There are many different modules available and a few have become fairly popular. These general have a brand or some kind of marking on the board; either on the small SMD Bluetooth board or the breakout board. Commons ones are:

  • zs-040
  • FC-114
  • JY-MCU
  • CZ-HC-0x
  • SJ
  • Keyes Bluetooth 4.0
  • HM-10

Of course, some of these are pretty obvious. If your module has HM-10 clearly stamped on it the chances are it’s a HM-10. It gets tricky when there are no markings or when the same board gets used again. I now have several different modules (BT 2 and BT 4) that all use the zs-040 breakout board and modules using the FCC-114 boards have at least 2 different firmwares.

Number and type of pins on the breakout board

The number and type of pins can give you some information. For Bluetooth 2 modules HC-05s tend to have 6 pins and HC-06s tend to have 4 pins.
The pin labels can also help. Besides the common TX,RX, GND and vcc, there may be EN, WAKEUP, STATE, BRK, KEY, or LED pins

Type of Bluetooth and chip used

This should be obvious but you never know. The chances are, if you bought a BLE module then you will get a BLE module just maybe not the HM-10 you thought you ordered. If you are not sure, start it up and use a Android device to scan and see what appears. The chip used on the small Bluetooth board (the daughter board) can help. Google the chip name and you will soon have a datasheet.

Talking to the module

To configure any of the modules you need to talk to it using a serial UART connection (see below for more on this). This can also be frustrating because different modules have different requirements for the format of the AT command. Some require uppercase, some lowercase. Some like line ending characters, other do not. Most default to 9600 baud rate but some have a different rate (38400 is also common). When trying new modules I have kind of settled on the following routine.

I start with 9600, line endings, and uppercase. If no joy, I try lower case. If no joy, I remove the line endings and try uppercase again. After going through the various options at 9600 I try 38400. 9600 and 38400 are the 2 most frequent baud rates. If I still don’t get anywhere I will try the other baud rates.

I will also cycle the power while connected with a serial connection. Some modules, like the ones that use a Bolutek firmware, have a start up message.

Getting garbage characters is a sign that you have the wrong baud rate.

Адаптеры среднего ценового сегмента

В ТОПе рассмотрены устройства с наилучшим соотношением «качество-стоимость» в пределах 550-1000 рублей.

3 место – TP-LINK UB400

Производитель – TP-LINK, Китай.
Радиус работы – 10 м.
Цена – 670 рублей.

В приборе установлены протоколы технологии Bluetooth версии 4.0. Внешний вид напоминает флеш-накопитель, вставляемый в гаджеты и ПК с помощью USB 2.0. Прошивка подходит для последних версий операционной системы Windows 10; 8.1; 8. Для установки на Windows 7 и XP придётся поискать дополнительные драйвера. При использовании устройства в помещении необходимо соблюдать определённые условия: относительную влажность воздуха от 10% до 90%, конденсата быть не должно; температуру выше нуля до 40 градусов. Адаптер подходит для большинства девайсов: планшетов; смартфонов; контроллеров; Bluetooth-наушников; принтеров, мышек, клавиатур с Bluetooth. Рабочий диапазон по отзывам покупателей меньше. При использовании в другой комнате на расстоянии 6 и более метров возможны зависания и шумовые помехи, если рядом находятся радиоволны других приборов, а устройство используется в колонках или акустической системе. Габаритные размеры миниатюрны как на маленькой флешке: ширина — 14,8 мм, длина — 6,8 мм, высота — 18,9 мм.

TP-LINK UB400
Достоинства:

  • компактный;
  • универсальный;
  • без зарядки;
  • простой в использовании и настраивании.

Недостатки:

  • фактический радиус действия меньше заявленного;
  • старая версия Bluetooth.

2 место – Vention CDDB0

Страна – Vention, Китай.
Дальность действия – 10 м.
Стоимость – 620 рублей.
Адаптер внешне похож на флешку с маленьким полукольцом-державкой. В продаже можно найти разные цвета адаптера: белый, чёрный, голубой, светло-фиолетовый. На одной стороне корпуса из АБС-пластика красуется фирменный логотип Vention. На моделях основных цветов надпись яко голубая, на цветных моделях надпись белая. Контакты покрыты позолотой в 24 карата, проводник выполнен из чистой бескислородной меди. Данные передаются посредством внутренней антенны в диапазоне 10 метров по Bluetooth нескольких версий — 2.0, 2.1, 3.0, 4.0. Внутри используется технология Plug and Play, благодаря которой не надо устанавливать дополнительные драйвера и специальное программное обеспечение. Модель совместима с разными версиями ОС.

Vention CDDB0
Достоинства:

  • необычный дизайн;
  • маленькие размеры;
  • качественная сборка;
  • большая цветовая гамма;
  • соотношение цена –качество соблюдено;
  • простая настройка;
  • стабильность сигнала;
  • отличная совместимость.

Недостатки:

нет поддержки aptx без дополнительных настроек.

1 место – HAMA H-53188

Страна – HAMA, Китай.
Радиус действия – 100 м.
Стоимость – 780 рублей.
Адаптер с большим диапазоном действия. В пределах квартиры среди бетонных и других перекрытий сигнал намного стабильней, чем у обычных устройств. На свежем воздухе прибор можно использовать на расстоянии до 100 метров. Подключается к технике как обычная флешка, через разъём USB 2.0, к беспроводным наушникам – с помощью технологии Bluetooth 4.0. Весит гаджет всего 4 грамма, работает на частоте 2,4 ГГц. Скорость передачи данных составляет 3 Мбит/сек. Для наращивания максимальной пропускной способности, для стабильной работы при подключении нескольких устройств одновременно внутри адаптера установлен и поддерживается метод EDR. Внешне выглядит как маленькая чёрная флешка. На пластиковом корпусе по торцам расположены зазубрины, чтоб устройство не скользило в руке при подключении / отключении. На одной стороне имеется надпись hama. Габариты компактны: длина 23мм, ширина 12мм, толщина 4мм. При покупке оригинального изделия в упаковке найдётся инструкция на трёх языках и диск с драйверами под ОС Windows-7, На 10-й версии ОС адаптер установится автоматически.

HAMA H-53188
Достоинства:

  • большой радиус действия;
  • лучшее соотношение цена-качество;
  • миниатюрные размеры;
  • классический внешний вид;
  • стабильность в работе;
  • поддержка EDR;
  • отличная комплектация оригинального товара.

Недостатки:

не обнаружены.

Общая таблица характеристик

Параметры HAMA H-53188 Vention CDDB0 TP-LINK UB400
Дальность, м 100 10 10
Подключение к устройствам USB 2.0 USB 2.0 USB 2.0
Беспроводное подключение Bluetooth 4.0 Bluetooth 2.0/2.1/3.0/4.0 Bluetooth 4.0
Скорость передачи 3 Мбит/с 3 Мбит/с
Аккумулятор нет нет нет
Размеры, мм 12 х 4 х 23 14 х 6 х 25 14,8 × 6,8 × 18,9
Материал корпуса пластик, металл пластик, медь, позолоченные контакты пластик, металл
Цена, руб 780 620 670

Connecting To A Computer

Please note that I am a Windows user so all examples use a Windows system.

There are a couple of ways you can connect the serial Bluetooth modules to a computer; either via a serial UART to usb adapter, or with an Arduino + serial in – serial out sketch (or any other similar microprocessor). I tend to use an Arduino.

I have a few slightly different sketches but I start with a very basic one. This takes wha ever you enter in the serial monitor and sends it to the connected module. Anything it receives from the module it displays in the serial monitor main window.

Basic Serial Communication Sketch

Hardware serial is used to talk to the host computer/Arduino serial monitor and AltSoftSerial is used to talk to the Bluetooth module. The sketch can be used to talk to any module that uses serial communication.

The sketch can be used to talk to any module that uses serial communication.

//  Basic serial communication sketch using AltSoftSerial (ASS). 
//  Uses hardware serial to talk to the host computer and ASS for communication with the Bluetooth module
//
//  When a command is entered in the serial monitor on the computer 
//  the Arduino will relay it to the Bluetooth module and display the result in the serial monitor.
//
//  Pins
//  BT VCC to Arduino 5V out. 
//  BT GND to GND
//  Arduino D8 ASS RX - BT TX no need voltage divider 
//  Arduino D9 ASS TX - BT TX through a voltage divider
//
 
#include <AltSoftSerial.h>
AltSoftSerial BTSerial; 
 
char c=' ';
boolean NL = true;
 
void setup() 
{
    Serial.begin(9600);
    Serial.print("Sketch:   ");   Serial.println(__FILE__);
    Serial.print("Uploaded: ");   Serial.println(__DATE__);
    Serial.println(" ");
 
    BTSerial.begin(9600);  
    Serial.println("BTserial started at 9600");
 
    // If using an HC-05 in AT command mode the baud rate is likely to be 38400
    // Comment out the above 2 lines and uncomment the following 2 lines. 
    // BTSerial.begin(38400); 
    // Serial.println("BTserial started at 38400");
 
    Serial.println("");
 
}
 
void loop()
{
 
    // Read from the Bluetooth module and send to the Arduino Serial Monitor
    if (BTSerial.available())
    {
        c = BTSerial.read();
        Serial.write(c);
    }
 
 
    // Read from the Serial Monitor and send to the Bluetooth module
    if (Serial.available())
    {
        c = Serial.read();
        BTSerial.write(c);   
 
        // Echo the user input to the main window. The ">" character indicates the user entered text.
        if (NL) { Serial.print(">");  NL = false; }
        Serial.write(c);
        if (c==10) { NL = true; }
    }
 
}

Connections

All modules are connected in a similar way.
vcc to 5V
GND to GND
TX to Arduino RX (pin D8 when using AltSoftSerial)
RX to voltage divider then to Arduino TX (pin D9 when using AltSoftSerial)

On some modules like the HM-10, the pin order may be reversed. Just make sure the above connections are used.

Trouble Shooting

If you can’t get communication with the Arduino working, try the following:
1 – Check your connections. Make sure you have Arduino TX to BT RX and Arduino RX to BT TX.
2 – Check the value of the resistors.
3 – Check that the resistors are in the correct order (the 1K ohm resistor connects to the Arduino).
4 – Different baud rates. Not all modules use 9600 as the default.
5 – Change the line endings (\r\n). Some modules need them, other don’t.
6 – Try upper and lower case.
7 – Check your connections.

AT-09 Bluetooth V4.0 CC2541

Also sold as Bluetooth v4.0 BLE CC2540/CC2541 iBeacon and another module that is similar to the HM-10. Has the same firmware as the BT-05A above.

Another one where I bought twice due to the same module being sold under a different name.

Uses the zs-040 breakout board.
Features the CC2541 chip.
Default baud rate is 9600.
Default PIN is 000000.
AT commands require line ending characters (\r\n).
Firmware is reported as Firmware V3.0.6,Bluetooth V4.0 LE.
The firmware is by Bolutek and AT+HELP gets you a list of the available commands.
The modules report themselves as BT05.

The STATE pin is normally LOW and goes HIGH when the device is connected.
The EN pin doesn’t seem to do anything. I haven’t really looked at this though.

Sony Z3 Compact:
The AT-09 shows up in Settings => Bluetooth as “BT05”. If you try to pair you briefly get a “trying to pair message” and then it goes back to just showing the name. The B-BLE app connects without any issue and does not need the PIN.

Huawei honor 6 Pro:
Does not show up in the Bluetooth settings => scan for Bluetooth devices.
Using the B-BLE app it shows as “BT05” and connects without a problem and does not require the PIN.

A Windows based PC connects and does not need the PIN.

BT05-A mini BLE Bluetooth V4.0 iBeacon

Similar modules sold as DX-BT05. This module is based on the Bolutek CC41-A. This is the same form factor as the HM-11, however, the layout is different. The BT05 is sometimes sold as a HM-10 and regarded as a copy of the HM-10, however, I don’t see these as copies more like a different version of the same thing. Not sure where these originate from as I can’t find this version on the bolutek website nor can I find a manufacturer (didn’t spend too long looking though).

The break out pins are standard layout with a STATE pin and a EN pin.

CC2540 or CC2541 chip.
Bluetooth version 4.0
Firmware is reported as Firmware V3.0.6,Bluetooth V4.0 LE.
Default baud rate is 9600
AT commands can be upper or lower case but require line end characters (\r\n)
Default PIN is 000000
The modules report themselves as BT05-A.

This is a Bluetooth 4.0 BLE module and not compatible with Bluetooth 2.0 or 2.1. The model I received includes the CC2541 chip as opposed to the CC2540 chip.

AT commands require line ending characters (\r\n). Since the firmware is by Bolutek AT+HELP gets you a list of the available commands.

The modules boot in to AT mode and go in to communication mode when a connection is made.

These are smaller than most other modules. Both the breakout board and the actual Bluetooth board are smaller than similar modules. The modules include a small push button switch which I have not investigated yet. A Google search for “DX-BT05 4.0” will get results for similar boards using the regular sized breakout board.

The STATE pin is LOW when no connection and HIGH when there is an active connection.
The EN pin looks like it is connected to pin 16 on the small Bluetooth board (not confirmed), when brought LOW, it will break an active connection. It does not disable the module though.

Pins

Pin 16 (P0_6)
When the module is in sleep mode, briefly bringing PIN 16 LOW will wake up the module and the module will respond with “+WAKE\r\nOK\r\n”.
When there is a connection, briefly bringing PIN 16 LOW will initiate a disconnection request.

Sleep Mode

Sleep mode is entered using “AT+SLEEP\r\n”. The module will return “+ SLEEP\r\nOK\r\n”
To wake, either send a string of 80 or more characters (the string cannot contain AT commands) or bring pin 16 LOW for a short period. If the module wakes successfully it will return “+WAKE\r\nOK\r\n”

LED in slave mode

– slow flash (800ms on, 800ms off) – waiting for pairing
– on – connected

According to the seller this is compatible with Android 4.3 or later as long as the device supports Bluetooth 4.0/BLE. It is compatible with iphone 4s onwards and also ipad 3,4,and the ipad minis.

If your Android device does not find the BT module the module may be in master/central mode. Change to slave/peripheral mode using the command AT+ROLE0

Sony Z3 Compact:
The modules show up in Settings => Bluetooth as “BT05-A” but it does not pair (I think is it not required). If you try to pair you briefly get a “trying to pair message” and then it goes back to just showing the name.

The B-BLE app connects without the need for the PIN.

Huawei honor 6 pro:
The BT-05A does not show up in the Settings => search for Bluetooth devices. It does show up in the B-BLE app as a BT05-A

Serial Connection:
The HMBLE Terminal app on the Sony finds and connects to the BT-05A and serial communication works as expected:

A PC running Windows 8.1 with Bluetooth BLE finds and connects. A PIN is not required to make a connection.

Заключение

В этой статье мы рассмотрели варианты подключения и работы с одними из самых распространенных Ардуино модулей Bluetooth HC05, HC06. Никаких особенных сложностей с этими модулями у вас быть не должно – просто подключайте его к пинам с аппаратным или программным UART, после чего используйте традиционные библиотеки (Serial для модуля, подключенного к 0, 1 пинам, SoftwareSerial в случае присоединения к другим).

Подключение Bluetooth к вашему Arduino-проекту может существенно увеличить ваши возможности по взаимодействию с другими устройствами. Вы сможете контролировать состояния датчиков и изменять параметры системы без перезагрузки контроллера. И. конечно же, вы сможете без проблем создать роботы и машинки на ардуино, управляемые через bluetooth со смартфона. Будем надеяться, что вы сможете сделать свой первый проект после прочтения этой статьи.