Introduction: Success Using the JY-MCU (linvor) Bluetooth Module
I'm writing this instructable because I have had nightmares getting this cheap, but well built bluetooth module to work. It was worth the challenge to save myself $50 for a simple SPP serial port (RS232 Emulator) service! I will go over the do's and don'ts I discovered while spending weeks with this board, both hardware and software.
I am assuming you are connecting this module to an Arduino or similar MCU development board.
Next up - The Pins...
Step 1: The Pins
The module has 6 pins labeled on the back, but most modules only have 4 of those populated with pogo pins. KEY & STATE seem to be not required, as KEY is used for flashing the device and STATE simply indicates if the device is awake or not. So that leaves only GND, VCC, TXD, RXD. Not shown is Pin 11 which is the RESET pin, resetting the module when pulled LOW.
Some boards have VCC labeled for working voltages up to ~6 volts. These modules DO NOT like anything except 3.3 volts on the VCC line. Also, some forums claim that the device works fine with 5 volt TTL levels. This is also not true and you should use a level converter to 3.3V on the RXD line. I used two resistors as a simple voltage divider to make the TTL level conversion. One 2.2k ohm resistor to ground, connected to a 1k ohm resistor, to the TXD line on the MCU. Connect the RXD pin in between the two resistors for an output of approx 3.4 volts. This about covers the hardware side of the module. As it turns out, the VCC voltage was one of the last things I tried to have full success with the module.
Next up - The Software...
Step 2: The Software
I have only found one library that works in Processing, and that is extrapixel's bluetoothDesktop library, which I will link to below. Others may work, but I had no luck with them. The library has an extensive reference page and is fairly straight forward.
I recommend setting up a softwareSerial virtual port on your Arduino for communicating with this module. Connecting it directly to the RX/TX lines gave me headaches and locked up ports! On the mega2560 I used pin 10 & 9 for RX & TX respectfully. The RX pin varies between different Arduino models, so check the Arduino forums to see which pins your Arduino work with softwareSerial.
The default parameters on the linvor module are: 9600 baud 8 N 1 None. AT commands can be sent to the board only when the module is NOT connected, or when the red LED is flashing. Only a handful of basic AT commands work, unless you have a HC-05 firmware. Linvor version 1.5, also known as HC-06, is a slave only device. Here are the known AT commands for version 1.5...
AT - Response OK
AT+NAMExxxx - Where xxxx is the friendly name of the module
AT+BAUDx - Where x sets the baud rate
(values & baud rates below)
AT+VERSION - Returns the firmware version
AT+PINxxxx - Sets a new pairing code
1——1200 2——2400 3——4800 4——9600
5——19200 6——38400 7——57600 8——115200
This example code will allow AT commands to be sent via the serial monitor. The bluetoothDesktop library is not required to connect with the BT module...
*********************************************************
*********************************************************
Created back in the mists of time
Modified 25 May 2012
by Tom Igoe
based on Mikal Hart's example.
Modified 10 July 2012
by Peter Timinski
based on Tom Igoe's changes to Mikal Hart's example.
This example code is in the public domain.
Nothing is guaranteed to work so PROCEDE at your OWN RISK!
Forum: http://arduino.cc/forum/index.php?topic=101452.0
*********************************************************
*********************************************************
*/
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 9); // RX, TX
String command = ""; // Stores response of bluetooth device
// which simply allows \n between each
// response.
void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(9600);
Serial.println("Type AT commands!");
// SoftwareSerial "com port" data rate. JY-MCU v1.03 defaults to 9600.
mySerial.begin(9600);
}
void loop()
{
// Read device output if available.
if (mySerial.available()) {
while(mySerial.available()) { // While there is more to be read, keep reading.
command += (char)mySerial.read();
}
Serial.println(command);
command = ""; // No repeats
}
// Read user input if available.
if (Serial.available()){
delay(10); // The DELAY!
mySerial.write(Serial.read());
}
}// END loop()
Find this library with reference at http://www.extrapixel.ch/processing/bluetoothDesktop/
Step 3: The Correct Library & Connections:
To get into some SPP service serial communication you will need the bluetoothDesktop library for Processing. The files and reference pages can be found here...
http://www.extrapixel.ch/processing/bluetoothDesktop/
Wiring the module for Software Serial:
Yes, use the 3.3 volt output for VCC. This is one of the last details I found to be quarky with this particular module, even though some boards say 5V. The green lines show the TTL level converter via the 2 resistors. This provides a logic level of about 3.45 volts.
Step 4: Services
For this application, we will want to use the SPP serial port service. When you connect/pair with the radio, your computer should make 2 virtual COM ports .. 1 for incoming and the other for outgoing traffic. It is a must that the outgoing port is present. It should also have the SPP serial service listed next to it in your bluetooth settings/ports. Mine says 'Dev B' and I would assume this is true for all of these modules. The next bit of code uses the library and software serial to actually connect with the radio for serial communication.
This makes a simple client/server using SPP service 'Dev B' as is listed next to the outgoing COM port. (found in bluetooth settings / ports). It simply searches for the service and attempts to connect with the radio. Upon connection the module's LED should stop blinking. Then AT commands may be entered using the Arduino serial monitor. Within the serial monitor, set the baud rate to 9600 and also choose 'no line ending' from the dropdown menu.
Processing Code
/*
Demonstration of a Processing client searching for and connecting to a service.
extrapixel, 2007
http://www.extrapixel.ch/processing/bluetoothDesktop/.
*/
import bluetoothDesktop.*;
PFont font;
Bluetooth bt;
String msg = "inactive";
Client server;
final String SERVICE_NAME = "Dev B";
void setup() {
size(600,300);
font = createFont("Courier", 15);
textFont(font);
try {
bt = new Bluetooth(this, Bluetooth.UUID_RFCOMM); // RFCOMM
// Start finding the service
bt.find();
msg = "searching...";
}
catch (RuntimeException e) {
msg = "error. is your bluetooth on?";
println(e);
}
}
void draw() {
background(0);
fill(255);
text(msg, 10, height/2);
}
// this gets called when the search process is over
void serviceDiscoveryCompleteEvent(Service[] s) {
Service[] services = (Service[])s;
msg = "Search completed.";
// now search for the service we want
for (int i=0; i<services.length; i++) {
println(services[i].name);
if (services[i].name.equals(SERVICE_NAME)) {
msg = "Service " + SERVICE_NAME + " found";
try {
// we found our service, so try to connect to it
// if we try to connect to it more than once, this will throw an error.
server = services[i].connect();
msg = "Connected to service " + SERVICE_NAME + " on server " + server.device.name;
return;
}
catch (Exception e) {
msg = "Found service " + SERVICE_NAME + " on Server " + server.device.name + ", but connection failed";
println(e);
return;
}
}
}
msg = "Service " + SERVICE_NAME + " not found.";
}
Step 5: Application & Troubleshooting
This should be enough to get started sending data over bluetooth to processing and back again. Once you have a connection, you can send/receive via the Arduino softwareSerial ports using the commands in the bluetooth library!
If you can find and pair with the linvor module but cannot connect...
Using my own frustration as an example, a missing COM port and/or the absence of the SPP service is the most likely cause of a failed attempt to connect and communicate. This is a known problem with this particular module. The cure is simple, but took some time to figure out.
No SPP serial port service?
Go to your bluetooth devices and REMOVE the linvor radio module
Disconnect power Vcc from the linvor radio for 10 seconds
Reconnect Vcc to the radio
Search for the module again on your PC and pair with it
You should now have the SPP serial service available. To verify go to “Show bluetooth devices”. Right click on linvor and click properties. In properties click on the 'Services' tab and the SPP service should be listed.
Here is an example in a project I have worked on in Processing for quite a while. It's a demo of it's current revision and makes use of all of the steps shown in this tutorial...

Participated in the
Arduino Contest
22 Comments
Tip 3 years ago
If you are using Arduino Mega, use Hardware Serial instead. See this tutorial: https://www.arduino.cc/en/Tutorial/MultiSerialMega
10 years ago
lol...its not as difficult as you made it.
Reply 7 years ago
i couldnt make it work without seeing this !
Reply 10 years ago on Introduction
it's a complex state-machine, if you use it to its full potential. it will tax you. believe it.
the 1 second time out rule.
the small char buffers?
the lack of handshake protocol,... blind sending....
i solved that by coding very smart response parsing software.
there are better modules. and are much better documented.
the RN-41 , and there development kit is supurb. (-EK) Roving Networks, is the best.
only more expensive. but you do get what you pay for....
Reply 10 years ago on Introduction
I have read about the 1 second timeout. Thanks for your posts...and can you explain where exactly the timeout comes into play? Also, nice to know that you found a 3.3 regulator on-board. I totally missed that. Also just a heads up - the HC06 slave modules do not require the KEY pin to send AT commands, but the master HC05 modules DO require it. I will definately check out the other modules mentioned.
Handshaking: You are right, and this is one of the first things I had to overcome. I too had to write some simple handshaking code, but it sounds like you have gone a lot further with it.
Reset: Right again. This is why I pointed out the Pin 11 reset pin. I use it to have the arduino reset the module, but did not know about the voltage limits. However (if memory serves correctly) I only need to pull reset LOW to reset the module, so I assume the 3.7 volt is supplied onboard.
If you have your own example code for establishing a connection with SPP services, I'd love to see it!
7 years ago
Hey relic, thanks mate !!
8 years ago on Introduction
You talk about the Linvor JY-MCU, but show a different module in your pics. This is just going to confuse people. Linvor as a manufacturer has a specific design for their JY-MCU module - when you use that in the title and then use some other module, you are as guilty as all those Chinese resellers that just throw an alphabet soup of terms at a product and hope some will stick.
Some points to note: The JY-MCU is a 'shield' only - it breaks out some pins and does voltage shifting for the attached Bluetooth module - an HC-05, HC-06, HC-10, HC-11, or what have you. Mixing up your terminology is not making things clearer. You can buy an HC-05 module, it is for surface-mount installation and implements SPP master/slave functionality. It is a 3.3V module with all pins available. The JY-MCU module is sold in the tens of thousands to little workshops all over the south of China, they solder whatever pins they want - I have 4 and 6 pin units, some are beautifully soldered, some are completely hacked. You get what you pay for, typically.
Your emphatic statements about voltage are just wrong, sorry. Linvor JY-MCU modules shift voltage from upwards of 6V to the 3.3 required for the HC modules. This is why your pictures and text are a mismatch - your heading is about the JY-MCU module, but your text is describing something different.
HC-05, HC-06, etc. refer to the Bluetooth module only - as far as the shield goes, many manufacturers other than Linvor make them - my personal favorite is the CZ-HC-05 from GOMCU - it not only shifts voltage to 3.3V for VCC, but all the logic pins, too. The HC-05 firmware seems to be at least as comprehensive as the Linvor module. The module in your pictures is a Dwengo which is an HC-06, not an HC-05 module, but again your text seems to indicate it is an HC-05.
Your instructable shows how you made something connect with the module you bought. You should rename it to more closely represent what it was you did - what you didn't do was to have 'success using the JY-MCU linvor Bluetooth Module'
Reply 7 years ago
I bought this module:
http://www.dx.com/p/jy-mcu-arduino-bluetooth-wirel...
It is really plug -n-play with Arduino, you connect it to hardware serial 9600 bauds and it works :-)
8 years ago on Step 5
Hello,
I just finished installing and setup on this device(HC-06). I pounded my head against the wall trying to get it to work. I had everything in this article and others setup correctly. It still wouldn't work. What I finally figured out is that, at least on my machine(windows 7 pc), once everything is configured correctly, but you can't establish the first connection to printer through Pronterface/other, restart your Pc. After a restart everything will work(if set up correctly). Even if you disconnect the dongle then reconnect reboot again.
Hope it saves the next person some time!
-Mat
9 years ago on Introduction
Would this device work for sending commands from a phone app to the Arduino?
9 years ago on Introduction
I have linvor v1.8 I have two arduino's and set the same baud rate and pairing code on each module. I can transmit a string from one arduino to the other with a wire, but not over bluetooth, using same code and port.
Reply 9 years ago on Introduction
I spent months getting these linvor modules to obey. it was worth every minute because contrary to popular belief, although difficult to work with these modules are not only very cheap, but very dependable. mine run without fail for weeks on end. Everything I learned and implemented is documented here...
http://www.planetxresearch.org/#!__arduino/vstc10=intermediate
hints - use SoftwareSerial for interfacing, NOT hardware RX/TX on the arduino. Also use the bluetoothDesktop library I'm using by extrapixel. all code/links/libraries/diagrams are on my site. hope it helps!
Reply 9 years ago on Introduction
Found the problem. I have two identical HC-06's, both slave. Replacing with HC-05's, which are field selectable. http://arduinotronics.blogspot.com/2013/10/arduino-bluetooth-to-bluetooth.html
Reply 9 years ago on Introduction
I'm able to send AT commands, and par from my laptop, but I'm trying to get two Arduino's to communicate. Do you have a moment for a g+ hangout or skype?
9 years ago on Introduction
there is also an arduino sketch called BTMagic, which auto detects and auto configs ANY bluetooth module. just search for it and download for free...
10 years ago on Step 3
why have you not used voltage divider on TXD ??
Reply 10 years ago on Step 3
I should have labeled the RX and TX lines at the bluetooth module end. The TTL coming into the RX line of the module needs to be 3.3 volt level. The TX line of the module already outputs 3.3v to the arduino.
10 years ago on Introduction
I am happy this works for you but I have done it a bit simpler:
I run it on 5 Volt
used an Arduino Nano
Uploaded a simpel testprogram that writes numbers to the serial port at 9600 Baud.
removed the USB connection to the Arduinonano
In Ubuntu I used the Bluetoothmanager to find and pair the device. I then was asked if I wanted to connect to the serial port. said yes.
got the message the serial port was now available as /dev/rfcomm0
connected the Tx to Rx on the Arduino and the Rx to Tx on the Arduino
Selected rfcomm0 as port in the IDE (it may be necessary to close and re open the IDE for the port to appear)
Selected the serial monitor and voila, numbers outputted perfectly on my screen.
Could not be simpeler
10 years ago on Introduction
hello. i have mine working 100% now , and with a car ECU using OBD2. (mpg gauge)
first off let me state the misconceptions,
see that 5vdc pin, that, if you look, goes a 3.3v spot regulator chip w/ 3 legs!, is VCC 5v to the base board
in fact becomes, 3.3v to the CHIP CSR BC417... look again. see it? follow the traces.....
the key pin , is the enable. command mode. how can you enable CMD , with out using that pin?
true the docs (i have everyone) are very bad. at best a simple list of commands and with responses.
And very poor documentation on how to envoke command mode (AT mode CMD).
aka; Attention mode. Most base boards have 6 pins. the missing pin on must is reset.
I found out that i need that, for best reliability. I added it.
i also have the data sheet (real) from CSR. (hard to find) and is very useful.
All inputs to the device are (reset and key to name 2) are not ever to be raised above 3.7v
The Microchip site has a great howto on matching logic families. 5v to 3v. (ask for link)
I had to use dividers for 3 pins, (key,reset and RX).
http://www.fixkick.com/ELM327/taurus-sim/hacked.html#MPG
source code soon, has built in documentation.
the correct "Thevenin" devider is 8k in the line and 15k to ground as seen here.
http://www.fixkick.com/ELM327/taurus-sim/Arduino/compiler/arduino-1.0.5/my-code/MPG/schematic/my%20red%20cards/Revised-HC-05.jpg
i will post source code in 1 week. (with external display working)
I also used logging commands extensivly to allow easy debug via the USB port. Serial.print(xx);
my regulator is a622k chip (i have a microcsope)
here is the data sheet on IT.
http://www.newark.com/torex/xc6206p332mr/ldo-fixed-3-3v-250ma-6v-sot-23/dp/18K7646
post questions, im a retired, certified tech. (3ways) . can gladly advise, for free.
10 years ago
Thanks for this. I bought one a while back, but hadn't messed with it because it came with absolutely no documentation.