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

Since writing the below many more modules have been released using the zs-040 breakout boards. Some of the newer ones include modules with a version 3.0-20170601 firmware that work in a slightly different way. I still do not have any of these and so cannot help directly but searching for the firmware should get plenty of hits online and a good place to start is stack overflow and the Arduino forum.

 
Update 20.07.2017

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. The modules I am using here use the EGBT-045MS Bluetooth module and have the HC/Wavesen 2.0-20100601 firmware. They also have an EN pin rather than a KEY pin and they have a small button switch just above the EN pin.

There are now newer zs-040 modules that use the real HC SMD modules, these have a newer firmware and include a blue LED at the top right of the SMD daughter board.

There are also modules that use the same breakout board but have different board markings such as the fc-114 modules:
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

Read more

Arduino With HC-05 Bluetooth Module in Slave Mode

Arduino and HC-05 in communication mode

Updated on 18.07.2015.

Updated 01.12.2016
There are now newer HC-06s and HC-05s that use the zs-040 breakout boards. These new modules have a LED (usually blue) at the top left of the Bluetooth daughter board and have a different firmware to the below. See HC-06 hc01.comV2.0 for an introduction to the HC-06. I haven’t written up details on the HC-05 yet.

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

Read more

Turning a LED on and off with an Arduino, Bluetooth and Android. Part II: 2 way control

In the first part I showed how to control a single LED from an app created in App Inventor. This worked OK but was very limited. You could control only 1 LED and the control was one way; from the app to the Arduino. What if you want to have 2 way control of the LED and to be able to also control the LED from the Arduino side? What if you want to control more than 1 LED?

In this guide we look at adding two-way communication. Here we control an LED but you could have it doing anything.

Arduino-AI2-Bluetooth_1LED_01In first example you could only control the LED from the Android app, here we extend the example so that we can also control the LED at the Arduino side. When the LED is turned on or off by the Arduino we want the button in the app to update to show the correct LED status.

The first example used methods only suitable for controlling one LED, this time we will try to make it so the Arduino sketch and also the AI2 app can be easily scaled and so once you have the basic app in place adding extra buttons and controls should be fairly straight forward.

Read more

Turning a LED on and off with an Arduino, a HC-06 and Android

Although I use a HC-06 in the below examples the HC-05 in slave mode can also be used.

Using MITs app inventor it is fairly easy to create an app that can turn a LED on and off from an Android device.

This is a fairly simply example of sending commands to the Arduino to turn a LED either on or off. The Android app sends ascii codes to the Arduino via the HC-06 BT module; “ON” for on and “OF” for off.

Load the app, connect to the HC-06 and then use the LED button to turn the LED on and off.

Arduino_Android_LED_AppUse_Screen_001
Arduino_Android_LED_on-off_1600

You can also open the serial monitor to see the commands as they are received
Arduino_Android_SerialMonitor

Read more

Arduino and HC-06 (ZS-040)

The HC-06 is a slave only BT module that is fairly easy to use with the Arduino using serial communication. Once it is connected it simply relays what it receives by bluetooth to the Arduino and whatever it receives from the Arduino it sends to the connected device. There are several slightly different versions of the HC-06, however, all seem to use the same firmware and have the same AT commands. The ones I have are labelled as zs-040. I also have some HC-05s which share the same PCB and are also labelled as zs-040.

HC-06 zs-040

The HC-06 defaults to AT mode at power on. This is indicated by a rapidly flashing LED. After the HC-06 is connected to another device the LED stops flashing and is constant on.

Read more

HC-05 and HC-06 zs-040 Bluetooth modules. First Look

Update: If you have modules that have a blue LED in the top left hand corner then you have a newer model with a slightly different firmware although they should operate the same.

I recently bought some HC05s and HC-06 Bluetooth modules. These are pretty standard, especially when using with the Arduino and I was surprised at how easy it was to get basic serial communication working. There are several slightly different modules available. The ones I have are marked zs-040. The zs-040 boards differ from some of the other modules in that they have a EN pin rather than a KEY pin.

HC-05 & HC-06 - ZS-040

Read more