Instructables

Success Using the JY-MCU (linvor) Bluetooth Module

Picture of 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...
 
Remove these adsRemove these ads by Signing Up

Step 1: The Pins

Picture of 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...
jessejenkin made it!2 months ago

Thank you so much! This program was incredibly helpful in programming the baudrate, name and pin for the BT module. I can now connect to my Reprap Mendel Monocolor via Bluetooth radio.

BT dongle.jpg
agr00m11 months ago
Would this device work for sending commands from a phone app to the Arduino?
sspence1 year ago
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.
relic1974 (author)  sspence1 year ago
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!
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
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?
relic1974 (author) 1 year ago
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...
why have you not used voltage divider on TXD ??
relic1974 (author)  mrdragon3331 year ago
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.
diy_bloke1 year ago
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

lol...its not as difficult as you made it.
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....
relic1974 (author)  nullbyte1 year ago
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!
nullbyte1 year ago
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.





holidayv1 year ago
Thanks for this. I bought one a while back, but hadn't messed with it because it came with absolutely no documentation.
relic1974 (author)  holidayv1 year ago
I ran into the same problem and no solutions to be found, until I stumbled upon extrapixel's library. I just wanted to save other people weeks upon weeks of frustration with the module. Holler if you have any problems.
relic1974 (author) 1 year ago
I agree that there are more simple ways in processing to go about this. But like one person commented, no documentation or library comes with this cheap but effective module.

I just recently started coding again after being away from C for 20 years. I also wanted to make it as clear as possible for newcomers. So I have just gone with what I found to work well. Now if I had a bee bluetooth shield and all of the support behind it, yes I agree that it would be a lot easier. But I won't spend that much money on a shield when a $7 module will produce the same results.

Saying that, I am open to all suggestion to simplify working with these JYMCU modules.