Post navigation

Getting Bluetooth Working with JY-MCU BT_BOARD V1.06

For my embedded course at the University of Lucerne of Applied Sciences and Arts I needed more Bluetooth modules for the Zumo/Sumo robots. I run out of stock as the modules are getting popular and are used in many student projects. So I ordered a handful more from DX/DealExtreme of the same HC-06 type/part number I already ordered a while back. I expected that they will work as the modules I had ordered from DX half a year ago. Was that naïve? Probably. Because they did *not* work, and caused me to reverse engineer the modules and to apply a hardware fix to get them working….

Set of JY-MCU Bluetooth Modules

Failed to get Response from V1.06 Module

I wired up a V1.06 module with one of my FRDM-KL25Z boards, using 9600 baud (usually the default baud setting):

FRDM-KL25Z with JY-MCU BT_BOARD V1.06

But wen I tried to communicate to the module, it failed: No response back from the module, or unknown response:

Failed to get a response back from V1.06 module

Checking with the signals with a logic analyzer shows that the microcontroller sends the ‘AT’ command, but no response back from the Bluetooth module:

Failure to get response from Module

I checked all the wires, and they were looking ok. Maybe a different baud by default on the module? I tried 2400, 4800, 14400, 38400, 57600, all did not work?

I tried the other modules: all failed, so it was not a single failure :-(.

I can connect to it, and asks me for the Pairing Code, and it accepts the default pairing code 1234:

Enter Device Pairing Code

I was able to connect to the board from the host PC, and the red LED turned on permanently (good!). But whatever I send from the host to the Bluetooth module, does not arrive at the microcontroller :-(.

Communication from Microcontroller to Bluetooth Module works?

In desperation, I tried the AT+Name command with 9600 baud to assign the name ‘Hola’ to the module. The module did not report back to the microcontroller. But to my surprise, the module showed up with the ‘Hola’ name on the host!

Hola Module Name

So, that’s interesting! It tells me that:

The module is able to connect with the host (ok!)

The default baud is indeed 9600 (ok!)

The microcontroller is able to communicate with the module (ok!)

However, the microcontroller does not receive anything from the module (NOT ok!)

I verified this with the module connected: the AT commands from the microcontroller end up at on the host:

Communication to Host

Different Modules!

And all my existing modules work as expected, so it is definitely not a wiring or software issue. But then I realized: the new boards have a different version number on the board!

V1.05 and V1.06 Module

V1.06 Board

To inspect the differences, I removed the shrink tube around the board with a sharp knife cutting the tube on the side (be careful!):

Removing the Shrink Tubing from the JY-MCU Board

💡 I carefully cut the tube on the side so I can fix it later (see below) with a scotch tape.

Board bottom side:

JY-MCU BT_BOARD V1.06 Bottom Side (click for high resolution)

Board Top side, with the HC-05 pin functions as I know it (see this post):

JY-MCU BT_BOARD V1.06 Top Side Details (click for high resolution)

Made direct connection to the Rx and Tx pins of the module:

Probing V1.06 Bluetooth Module Signals

With this I can see what is getting to the connector, and what ends up at the Bluetooth module itself. Sending an AT from the Microcontroller shows that the command arrives at the Bluetooth module too:

Bluetooth Module Probing (send from Microcontroller)

On the other end, if I send a ‘Hello!’ from the host, it arrives at the Bluetooth module Tx pin (which goes to the microcontroller Rx pin), but not at the connector to the microcontroller:

Probing V1.06 Bluetooth Module Signals from Host

The string from the host arrives on the Tx pin with 9600 baud too: so definitely my baud settings are correct. So what is wrong that nothing arrives on the connector pin to the microcontroller?

No Schematics? Reverse Engineering of the JY-MCU BT_BOARD V1.06

I searched the internet, but there are no schematics available for the JY-MCU board. And if there are, then only for older boards like the V1.03. So I had no choice than to reverse engineer the connections of the SMD parts on the board :-(. With inspecting the traces on the board and probing the contacts, and this took me a while…

The back side does not give much details, but some vias are connected to the pins of the HC-06 module:

JY-MCU BT_BOARD V1.06 Bottom Side Details

The front side with all the SMD parts is more complicated, but more interesting:

104: 100k Ohm Resistor

102: 1k Ohm Resistor

331: 330 Ohm Resistor

B2: This seems to be a diode. Schottky Diode? Zener Diode?

662K: 3.3V, 0.5A fixed regulator

4 Capcitors of unknown capacity?

After some time, I came up with this wiring of the components:

JY-MCU BT_BOARD V1.06 Top Side Details Extended

The results:

KEY has a 100k pull-down to ground and is connected with a 1k resistor to the key pin (26) of the Bluetooth module. I have not tried it yet, but with pulling that pin to 3.3V while powering the module, the module should enter AT mode.

VCC is connected to the 3.3V fixed regulator, producing the 3.3V for the module. The Schottky diode is added as protection, and 4 C’s (unknown capacity) are used for voltage stabilization.

GND is connected to the ground plane 🙂

Rx: Pulled-up to 3.3V with a 100k resistor, with a 330 Ohm resistor to the Rx (2) pin. Looks like that resistor is used for 5V Rx signals from the microcontroller?

State is directly connected to the State pin 25 of the module. I have not checked the function, but I believe it should show if the module is connected or not.

Tx: there is a diode between the Tx connectors?

❓ It is not clear to me why there is this B2 diode on the Tx line? Line protection? But definitely it prevents my board to receive the incoming data from the Bluetooth module 😦

UPDATE: See comments section at the end of this post:

“I was also puzzled why they would add a diode on the TxD pin. It will not provide any protection to the module (unless your electronics were to apply a negative voltage to the Tx pin). However, it would have a use if your electronics were powered off and the Bluetooth module stayed powered on: without the diode then the Bluetooth module would attempt to power up your electronics through the Tx pin. It would fail, of course, but many milliamps would flow and battery life would be reduced. This is a reasonable use case I think: Bluetooth module stays awake while the main electronics is powered off.
My suggestion: turn on the pull-up resistor on the KL25Z RxD pin, that connects to the module Tx. Your scope traces show it is not present. Then the Bluetooth module will pull the signal to logic 0 through the diodes and the pull-up resistor will pull it to logic 1, and all should be well…”

💡 And indeed: adding a pull-up resistor to the Tx line (Tx from the module to the Rx of the microcontroller) solved the problem too 🙂 (like removing that diode on the Rx-to-Tx as described below.

So I tried with bypassing the diode with a wire:

Bypassing Diode on Tx (Rx to Microcontroller) Line

And indeed: now the communication works both ways like a charm!

Removing Tx Diode

So the logical step was to remove that Diode in the Tx line:

Removed Tx Diode from V1.06 PCB

Then to solder a wire bridge instead:

Soldered bridge over Diode Footprint

And finally taped the shrink tube around the module to restore the original state:

Reapplied Shrink Tubing with Scotch Tape

Violà: now communication is working both ways:

Working Bluetooth Communication between Host and Microcontroller

Summary

Cheap parts from China might mean that I need to be prepared for surprises: things before working might change without notice. And because it is hard to get schematics, things will be hard to find a problem. That diode does not make much sense to me, but definitely prevents to get the module working with my FRDM-KL25Z board (at least with 3.3V logic levels).

I hope that this post is useful for anyone else who might receive the V1.06 modules and has problems to get it working with a 3.3V microcontroller :-).

UPDATE 2

With all the comments (thanks!), I was able to solve the problem without hardware modification :-). The solution is to pull-up the Tx signal to the microcontroller (Rx for the microcontroller) either with a hardware pull-up or with a software pullup. In my example, Rx is on PTC3:

Well done on the detective work Erich. One speculation and one suggestion from me:

I was also puzzled why they would add a diode on the TxD pin. It will not provide any protection to the module (unless your electronics were to apply a negative voltage to the Tx pin). However, it would have a use if your electronics were powered off and the Bluetooth module stayed powered on: without the diode then the Bluetooth module would attempt to power up your electronics through the Tx pin. It would fail, of course, but many milliamps would flow and battery life would be reduced. This is a reasonable use case I think: Bluetooth module stays awake while the main electronics is powered off.

My suggestion: turn on the pull-up resistor on the KL25Z RxD pin, that connects to the module Tx. Your scope traces show it is not present. Then the Bluetooth module will pull the signal to logic 0 through the diodes and the pull-up resistor will pull it to logic 1, and all should be well…

Hi Charles,
you nailed it! I have not seen any settings for pulling up the RxD pin on the KL25Z, but I added an external Pull-Up resistor, and indeed: it works now 🙂
Congratulations to you pointing to that solution, many thanks!

Always best to have hardware and software working as a team! (You should tell me to stop wasting my time with the s/w…).

More seriously, it is important to look at all interfaces for this kind of thing. In general, a pull-up resistor on any input is the right starting point, as it puts a pin into a safe, defined, state if it is otherwise not connected. (A floating input will make unexpected 0-1 transitions, and will often draw excessive current as the transistors end up in their linear region, both conducting).

However, the presence of a pull-up will also draw unnecessary current if the input pin is being driven, correctly, to logic 0 by external circuitry. Then current flows to GND through the pull-up, and it is best removed, or replaced by a pull-down (not available on the KL25Z).

Finally, you need to consider what happens if part of the circuitry is powered down. Never send a logic 1 signal to a chip with no power supply, as “parasitic diodes” in the powered-down chip will route current from the powered-up logic signal onto the power rail of the powered-down chip, resulting in excessive current draw. (You will often measure about 1V on the supply rail of the chip you think is powered down). And suspect that is why the diode has appeared on your Bluetooth module.

Yes, agreed, it is always the combination of hardware and software which makes things challenging. And I 100% agree with your comments and tips: I just run into a similar problem last week with an I2C device on the bus which was switched off, but drawing too much current. I had excessive parasitic current in some of my nRF24L01+ modules too (looks like a different hardware revision): instead of a few microamps in low power mode, it sucked in 6 mA!

Hi Erich,
I don’t have a KL25Z, I only have a KL05Z but when I needed to enable a pull-up I only could find it in the Init_GPIO bean.

Two questions:
– Which is the “free air” distance that you could get it to work ?
– If I need to communicate a module with an Android phone at a big distance (100m) and I can accept to transmit only one way (from the module to the phone), do you know if it could be done ? What I don’t know, is if the Bluetooth protocol accept to send only one way, or if the protocol “really” needs some “response” from the other side.

Hi Christian,
I have not done formal measurement, but the modules worked fine in the 10-15 meter range.
That is in the specification of Bluetooth (~10 m). 100 meter is probably only what you can achieve with some amplifier. I’m using the nRF24L01+ in 100 meter range (at least for testing).
And you need a two-way communication as the protocol is bidirectional. So you need such a ‘response’.

You cannot do it the same way for the Arduino, as unfortunately there is no Processor Expert for that microprocessor family. You need to check the details of your microprocessor manual if and how you can enable internal pull-ups. An easier way might be for you to simply add a pull-up resistor on your board.

I read about your work on it and I am pleased that you have posted so much details about it.
I am having issues getting into AT command mode, no matter how I use the KEY. I have JY-MCU with V.1.06. It is recognized as HC-05. So far I can send some text and can receive it on my phone terminal. I tried to wire it to 3.3VDC and cycle the power, but still the AT command I am sending is not recognized. I am using a different CPU – Cypress PSoC4 and UART. The problem is that I can use the module, but I can not change the name or speed of it. Any help would be greatly appreciable!

Hi Erich,
Thanks for the reply!
The red LED is flashing before I connect the phone or the PC to the module. After successful connection the pattern changes to 2 flashing and big pause. I don’t have logic analyzer, I have only 2 CH scope. From what I can see is that I can not make the module to get into AT (command) mode. I have tried with the KEY pin (with 3.3V on it at the power up time and after power up) but I don’t think that it went into the command mode, because the commands I was sending were displayed on my phone terminal and I did not get any response from the module.
I will check the links and will try it again. I will keep you posted!

Hi Stoyan,
you only can send AT commands to the module as long it is blinking. And the AT commands have to be sent from the microcontroller attached, not from the PC. The Key pin is only supported and connected on special firmware, not on most of the modules available for cheap. That 2 flashing and pause sounds like an error code of the module, I have never seen that.

I have tried another approach. It seems that the module gets into some special mode – I have a different LED pattern. So far I have the following: when the module is in transfer mode but not peered, the blinking pattern is short ON, short OFF. When in peering mode the pattern is 2 short ON, long OFF. Now when the Key is up (3.3V at start-up), it is long ON, long OFF. Interesting is that I can no longer connect to the module, through phone or other Bluetooth module. So right now I am trying to get the response from the module back to the CPU and from there to PC terminal (I am using Hyperterminal). I will keep you posted on my progress. Any thoughts on it will be greatly appreciable.

Hello Parth,
that depends, and you can choose any pins you like which are on a UART. Simply select the UART you want (except the one connected to the K20 OpenSDA on the board), and you should be fine. Have you had a look at the schematic of the board already?

If the red LED is blinking, then no connection has been made, so it is clear that it does work for you. Please try it first with your PC. Your phone needs to be able to create a serial-over-usb connection and profile. For example this is not possible with an iPhone.

I have a Coldfire, so I can’t enable pull-ups through firmware. I understand that if I simply solder a pull-up resistor between VCC and TxD (on the back of the JY-MCU/HC-06), then things will work.
What value would you recommend for the resistor? (I’m just a simple software guy).

Oh thank you, I guess you have saved my day (last night :P), as I got so frustrated and though there might be something wrong with the board & wanted to order a new one … I’m gonna try your approach, the SW one first 🙂

Hi Erich
It looks like there is an issue with some 5V systems as well. I am trying to interface a Competition Electronics Chronograph using the pull up resistor on TX. The Chronograph receives commands correctly now from the bluetooth, but it doesn’t work the other way around, so it looks like there is an issue with the RX terminal as well.

I wonder if there is a way to revert a 1.06 to 1.05. The vendor says they are aware of this problem and offered to sell me a prototype level shifter for $5 plus shipping! It’s not much of an upgrade if it doesn’t properly work at either 5V or 3.3V.

Hi I am having the same problem, the thing is my model does not have the diode urs had. And when i enable the software pull up in the RX pin on my microcontroller, nothing different happen. I was wondering if after enabling the pull up resistor i had to wire that pin to ground ? Although that didnt work either. Maybe u could help me somehow Thanks Tomas

Hi Tomas,
Maybe your module is having a different default baud rate? I suggest you hook up a logic analyzer or oscilloscope to the RX and TX pins and try different baud rates.
Then you should see a response the module, and from the analyzer you could calculate the baud rate the module is responding.
I hope this helps.

Hi, I have also a pair of no name HC-06 modules that refuses to work using their serial pads. Pairing as bt devices works fine, but no signal of RX/TX work. I have added a 100 Ohm pull up resistor between GND and RX, and then I am able to make it work. With AT+BAUD6 I set 38400 bps and then they are able to have a proper RX/TX work. Thank for your info. But I want to make you a question. I work in a project to add BT support to a common 56k serial modem, and choose this HC-06 as perfect for this, but I don´t know if I can connect directly RX and TX pins of the module to the TX and RX of the modem serial port, I think HC-06 module states at the backside that RX/TX are 3.3 TTL level. For now I use a rs232 db9 module to connect with the db9 serial port of the modem, and connect the HC-06 to the module. Then it works flawlessly. But direct connection will be cheap and simple. May be it is not a good idea, because modem rx/tx are 5v ttl driven?

Hi Antonio,
the voltage level of the HC-06 Bluetooth modules are really 3.3V. Connecting it to TRUE RS-232 levels will destroy them. So if you connect it to your modem directly, that will be a bad idea: you will need proper RS-232 level shifters like the DS323 or similar devices from different vendors.

It’s not just that the RS232 signal levels are different from those at a 3.3V-powered micro, but the polarities are inverted. Some micros (including the KL25 and so I guess all the Kinetis micros) have bits which can invert the polarity of RxD and TxD, which overcome that problem.

As for the signal levels: in practise you will usually find that an RS232 receiver will in fact work if it sees 0V and 3.3V signals (try it!). A workable solution for converting RS-232 TxD signals to match a 3.3V micro is to connect them through (say) a 100ohm resistor and add a 3.3V zener diode between the micro’s RxD pin and GND. Or you could add two schottky diodes from the RxD pin to the 3.3V and GND rails. The RS232 transmitters are current limited any way, and won’t mind driving power rails through a 100R resistor.

Not elegant, and not recommended for a product you are going to sell, but probably safe and reliable for the lab. Check out the 74LCX14 inverters (etc) if you need the polarity inversion.

Hi Gregor,
Greetings from Switzerland to Denmark! 🙂
what the PORT_PDD statements do is the following a) configure the pin to use internal pull-up resistors and b) enable that pull-up resistor.
If you don’t want to add an external pull-up resistor, then you have to check the data sheet of your microcontroller if you can do the same internally too.
I hope this helps,
Erich

Hi Erich, great post.
I have the zs-040 version for HC-06; unfortunately, I can’t have success with your instructions, because this is a different board design. I tried with bypassing the diode with a wire, but don’t work the TX bluetooth line. I don’t use arduino, I connect my HC-05 to GPS directly (http://www.electronic724.com/media/catalog/product/md_a1c34_tb1bqkq_item_pic.jpg). Can you help me?.
Thank you,
Morris

Hi Morris,
I don’t have a zs-040, so I dont’ know what is the problem. I would connect the zs-040 with a microcontroller and talk to it to see what the signals are. And I would use a logic analyzer to check the signals. Bypassing the diode is only an option if you know what the problem is.
I hope this helps,
Erich

I need to read data from HC06 and printed on the screen (Console_IO), Could you please let me know what can I do?

I added AsyncroSerial, CosnsoleIO, CriticalSection, Utility and Shell. The AS1 was used for receiving data from HC06 and ConsoleIO for printing a fixed text such as Hello world. How I link both of them for printing the revived data?