HC-06 hc01.comV2.0

HC-06_hc01.com_02_800

ZS-040_HC-06_hc01.comV2.0

The latest zs-040 HC-06 modules have an updated firmware, hc01.comV2.0. This firmware has the following defaults:
– baud rate = 9600
– password = 1234
– nl/cr line endings not required.
– AT commands are required to be in upper case
– Firmware version = hc01.comV2.0
– Name = HC-06
– No parity
– SLAVE mode

Since the Bluetooth hardware is the same as the previous zs-040 HC-06s the Bluetooth specs are also the same. Bluetooth 2.0 EDR, SSP.
These use a slightly different BT module than the other zs-040 boards and there is a blue LED at the top left of the daughter board.
Continue reading

Arduino to Arduino by Bluetooth

Updated 12.06.2016: Added example 2

In the Connecting 2 Arduinos by Bluetooth using a HC-05 and a HC-06: Pair, Bind, and Link post I explained how to connect a HC-05 to a HC-06 so that when powered they automatically made a connection. Here we look at using that connection to get Arduinos talking over Bluetooth. Before continuing you need to have the Arduinos and BT modules set up as per the previous post. Here I am using 2 HC-05s. One in master mode the other in slave mode. The setup process for the slave mode HC-05 is the same as the HC-06 in the previous post.

Arduino2ArdionoBT_Breadboards_01_1600

Continue reading

HC-05 FC-114 and HC-06 FC-114. Part 3 – Master Mode and Auto Connect

Update 19.09.2015
The FC-114 boards I have have the Bolutek firmware. User DS has reported that he/she has FC-114 boards that have the linvorV1.8 firmware. So if the below does not work for you then check what firmware you have.

I may be missing something but I can not get the HC-05 FC-114 boards in to Master Mode and connect to other BT devices with just AT commands. The modules say they have accepted the commands, such as AT+ROLE1 but when I try to connect to other modules I get the error message “Can only be used in Lord Mode”.

The modules accept “AT+ROLE1″ and report they have changed mode but they haven’t really.

In an earlier post I mentioned that it looks likes pin 27 or pin 28 has to be pulled HIGH to enter Master Mode and this does indeed seem to be the case. Everything I have tried without pulling the pin(s) HIGH has failed.

HC-05_FC-114_autoConnectSerialMonitor01
They reply with “OK” and if you interrogate with “AT+ROLE” they report “+ROLE=1″ but they are actually still in Slave Mode.

Continue reading

HC-05 FC-114 and HC-06 FC-114. Part 2 – Basic AT commands

Update 19.09.2015
The FC-114 boards I have have the Bolutek firmware. User DS has reported that he/she has FC-114 boards that have the linvorV1.8 firmware. So if the below does not work for you then check what firmware you have.

Since the HC-05 FC-114s and the HC-06 FC-11s share the same firmware the following should work on either module.

The default setting on start up is Slave Mode waiting for pairing or a connection and also accepting AT commands. This means it is fairly simply to start using AT commands.

HC-05 FC-114 & HC-06 FC-114_1200

Continue reading

HC-05 FC-114 and HC-06 FC-114. First Look

I have just received some new HC-05 and HC-06 Bluetooth modules. These were sold as zs-040s which is the module I actually wanted but I received modules marked FC-114. They share the same breakout board as the zs-040 but have different pins soldered between the Bluetooth module and the breakout board and have a very different firmware.

HC-05_FC-114_&_HC-06_FC-114_001_1600

The small push button switch still has traces to pin 34 and still pulls pin 34 HIGH, however, on the FC-114 boards, pin 34 is a regular IO pin and closing the button switch doesn’t do anything. On the zs-040 boards, closing the button switch and pulling pin 34 HIGH puts the modules in to AT mode. Since the FC-114 starts in AT mode this is no big loss.

It took me a while to figure out the differences.
Continue reading

HC-05 fs-040 State Pin

This post follows on from Arduino With HC-05 Bluetooth Module in Slave Mode

The STATE pin on the HC-05 zs050 board is connected to the LED 2 pin on the small bluetooth module and the LED 2 pin is used to indicate when there is an active connection. This means the Arduino can connect to the STATE pin and determine when we have a connection. The STATE pin is LOW when the HC-05 is not connected and HIGH when the HC-05 is connected.

As a quick visual indicator you can put a LED + suitable resistor on the STATE pin. When the module is connected the LED will light.

You can also use the Arduino to read the value of the STATE pin.

Continue reading

arduinoBTcontrol

Updated on 06.08.2016

Controlling an Arduino over Bluetooth from Android using App Inventor 2

Here is an example of controlling the Arduino over Bluetooth using a HC-06 bluetooth module and an Android app. The example uses an Arduino Nano but other Arduinos will work just as well. A HC-05 module can be used stead of the HC-06.

arduinoBTcontrol - breadboard

The Android app was created in app inventor and the aia file can be downloaded at the bottom of the page.

Continue reading

Arduino & ESP8266 Webserver

Update: This is a very old guide and there are much better examples available. If I were to to this again I would use one of the ESP8266 libraries that simplify the whole process. Libraries are available from the following links:
WeeESP8266
ESP8266_Simple
WiFi (ESP8266WiFi library)

 
Here is my first attempt at a web server using the ESP8266. It includes a request count and also a text input field.

ESP8266 webpage

Enter your name and hit submit

ESP8266 webpage 2

Continue reading

FTDI + ESP8266

Just started to play with the ESP8266-01 modules. Purchased from Taobao.
ESP8266-01
These, I believe, are version 2 and have the LEDs near the antenna. When first started they identify themselves as [Vendor:www.ai-thinker.com Version:0.9.2.4] and are version 018000902-AI03. This is a custom firmware from ai-thinker.

There seems to be quite a few different versions of similar modules. And the same module could have one of several firmwares.

Continue reading

Connecting 2 Arduinos by Bluetooth using a HC-05 and a HC-06: Pair, Bind, and Link

In a previous post I showed how the HC-05 can auto connect to other Bluetooth devices by setting the HC-05 to pair with any device using CMODE=1. This is quick and easy but does not give any control over which other device the HC-05 connects to.

In this post I show how to set up the HC-05 to always connect to the same HC-06. For this we use PAIR, BIND, and LINK.

I am using 2 separate Arduino IDEs; version 1.6.3 which is installed, and version 1.0.5 which I run from a folder (it is the non install version). This allows me to use 2 IDEs at the same time, each connected to a different Arduino. It also gives me 2 serial monitors, one for each Arduino.

The modules used are the zs-040 versions of the HC-05 and the HC-06.

The HC-05 has 2 AT modes which I refer to as “mini” AT mode and “full” AT mode and some commands only work when in “full” AT mode. To enter “full” AT mode pin 34 needs to be HIGH and kept HIGH. To accomplish this I have made a connection from pin 34 to +3.3v. See the diagram below (or after the jump).

If you are not sure about the different AT modes take a look at Arduino with HC-05 (ZS-040) Bluetooth module – AT MODE

If you are not familiar with how the HC-06 and HC-05 work it may be worth while checking out some of the other posts:
HC-05 and HC-06 zs-040 Bluetooth modules
Arduino and HC-06 (ZS-040)
Arduino With HC-05 Bluetooth Module in Slave Mode
Connecting 2 Arduinos by Bluetooth using a HC-05 and a HC-06: Easy Method Using CMODE

Continue reading

Connecting 2 Arduinos by Bluetooth using a HC-05 and a HC-06: Easy Method Using CMODE

Making a connection Between a HC-05 and a HC-06: Method 1

Using the CMODE command we have an easy way to connect the HC-05 and the HC-06. When the HC-O5 is configured to pair with any address (AT+CMODE=1) it should connect to a HC-06 automatically. No binding etc is required.

I am using the zs-040 modules and other modules should be the same. If you have issues check the data sheet for your modules.

The Set Up

I am using 2 different Arduino IDEs; version 1.0.5 and version 1.6.3 but this not required. You can run 2 instances of the same IDE which then allows yo to have 2 serial monitor open at the same time.

The Arduino connected to the HC-05 is on COM8 and the Arduino using the HC-06 is on COM17

ARD2ARD_SETUP_IDE

Continue reading

Arduino with HC-05 (ZS-040) Bluetooth module – AT MODE

Updated 19.07.2015
Updated 26.07.2015
Updated 30.10.2015

Update 2016-08-01
The zs-040 breakout boards are now being used for many different modules and you may not have the exact same boards as those shown below. Recently I received some new zs-040 HC06s and HC-05s that have a slightly different daughter board and a very different firmware. On the new HC-05s pin34 has to be pulled HIGH before connecting power to enter AT mode. Bringing pin 34 HIGH after powering the modules has no effect.

 
 

AT mode allows you to interrogate the BT module and to change some of the settings; things like the name, the baud rate, whether or not it operates in slave mode or master mode. When used as a master device AT commands allow you to connect to other Bluetooth slave devices.

There are many slightly different HC-05 modules, the modules I have are marked ZS-040 and have an EN pin rather than a KEY pin. They also have a small button switch just above the EN pin. They are based on the EGBT-045MS Bluetooth module.

Update: I now also have boards marked fc-114. See:
HC-05 FC-114 and HC-06 FC-114. First Look
HC-05 FC-114 and HC-06 FC-114. Part 2 – Basic AT commands
HC-05 FC-114 and HC-06 FC-114. Part 3 – Master Mode and Auto Connect

On the zs-040 modules there are 2 AT modes. I do not know if this is intentional but some commands only work when pin34 is HIGH. Other commands work when pin 34 is either HIGH or LOW. This fooled me for quite a while. For this post I have called the different modes “mini” AT mode and “full” AT mode.

HC-05 zs-040

To activate AT mode on the HC-05 zs-040 modules we can:
– 1. Hold the small button switch closed while powering on the module.
– 2. Set pin 34 HIGH (3.3v) when power on.
– 3. Close the small push button switch after the HC-05 is powered.
– 4. Pull pin 34 HIGH after powering the HC-05.

Method 1.
Enters AT mode with the built in AT mode baud rate of 38400. The baud rate cannot be changed by the user.
This method allows the module to enter AT mode on start but but does not keep pin 34 HIGH and uses the “mini” AT mode.

Method 2.
Enters AT mode with the built in AT mode baud rate of 38400. The baud rate cannot be changed by the user.
If you keep pin 34 HIGH you will enable the “full” AT mode which allows all AT commands to be used.
If you let pin 34 return LOW after power on then “mini” AT mode will be enabled.

Method 3.*
Enters “mini” AT mode using the user defined communication mode baud rate.

Method 4.*
Enters “full” AT mode using the user defined communication mode baud rate.

If pin 34 is kept HIGH then the HC-05 enters the “full” AT mode. If pin 34 is brought HIGH and returned to LOW it will put the module in to “mini” AT mode.

* added 21.07.2015

Method 1 and 2 are good in that you know the baud rate – it will always be 38400. This could be useful if you have modules other people have used or if you forget what communication mode baud rate you have previously set.

Method 3 and 4 adds convenience. You can enter AT mode, make changes and return back to communication mode without switching sketches and messing around with different baud rates.

Continue reading

Arduino With HC-05 Bluetooth Module in Slave Mode

Arduino and HC-05 in communication mode

Updated on 18.07.2015.

Here is the zs-040 version of the popular HC-05. The HC-05 is based on the EGBT-045MS Bluetooth module. It can operate as either a slave device or a master device. As a slave it can only accept connections. As a master it can initiate a connection.

HC-05 zs-040

The EGBT-045MS Bluetooth modules (the smaller daughter board) is a 3.3v device. The HC-05 break out board has a 3.3v regulator that allows an input voltage of 3.6v to 6v but the TX and RX pins are still 3.3v. This means you can use the 5V out from the Arduino to power the boards but you cannot connect the Arduino directly to the HC-05 RX pin.

For the HC-05 RX pin (data in) we need to convert the Arduinos 5V to 3.3v. A simple way to do this is by using a voltage divider made from a couple of resistors. In my case I use a 1K ohm resistor and a 2K ohm resistor.

As a quick guide to the voltage divider; 1K + 2K = 3K. 1K is a third of 3K so it reduces the voltage by a third.
One third of 5V is 1.66 and 5-1.66 = 3.33 which is what we want. Putting the resistors the other way would reduce the voltage by 2 thirds.
For more information on voltage dividers have a look at the Sparkfun tutorial

Since the Arduino will accept 3.3 volts as HIGH you can connect the HC-05 TX pin (data out) directly to the Arduino RX pin (The 5V Arduino takes a voltage of 3V or more as HIGH).

Continue reading