How to get the JY-MCU bt board to work

I had the same problems where only the AT command received a response. I have the breakout version 1.03 with firmware version 1.5. Found and changed a simple Arduino sketch to allow AT commands to be sent to the Bluetooth adapter. Simply adding a delay(10) allowed the other commands such as AT+VERSION to get a correct response from the Bluetooth adapter. I used Arduino's serial Monitor to send all the commands. This is based on the code in the link provided earlier in this thread. Hope this is useful to some!

Link to the code: http://eclipse.clinertech.com/arduino/bluetooth/blth.html

augustinoy:
I have the same problem with AT commands, only have AT working, non other. Is the problem in the software serial sketch maby? I don't have a usb to ttl board, only a usb to rs232 so I really need make it work over the arduino, any Ideas?

Poppin, your code works with me. Something in the example code makes it unable to get a response from any other AT command. Nice job, it works here.

Links with the AT commands.

http://eclipse.clinertech.com/arduino/bluetooth/Bluetooth_AT_Commands.txt

Two key pieces of information I wish I knew when I started.

  1. AT commands DO NOT work when the device is paired.
  2. SoftwareSerial doesn't work past 9600 BAUD.

WARNING: Setting the BAUD Rate too high will essentially lock you out of the chip if you don't have hardware that can send/recieve at that baud rate...

This code above worked for me very well >.> until I changed the BAUD rate using AT+BAUD8
Now it's stopped responding to AT commands. ( I did recompile my sketch to use the new baud rate 115200)
There is a "STATE" Pin that I found on Krill Labs - Using the BT Board v1.02 JY-MCU
that says that will toggle it between AT command mode and regular work but I think maybe a 10k resistor is too much since I'm only running on 5V

I've also discovered that delay rates of tx/rx stuff changes pending on baud rate so maybe I'm failing there somehow. I was reading the SofwareSerial.cpp file and some other sources said timing is pretty important for this but unsure exactly how to calc it.

At one point I did have my snes controller -> Arduino Mega -> BlueTooth module -> custom compiled SNES9x >.> but I wanted faster response times.

Things would lock up alot and I got a reset procedure down.
Remove the pairing (ubuntu 12.04 LTS)
Reboot box
hcitool scan
rfcomm bind 0 00:12:02:28:71:34 1
screen /dev/rfcomm0 9600 #This will prompt you for the pairing password and I also noticed the LED went solid rather than blinky.
screen /dev/rfcomm0 9600
rfcomm release 00:12:02:28:71:34

UPDATE:

Got it working again, I switched to hardware tx3/rx3 then I cycled through every baud rate until I saw the right output, aparently I set it to 57600

run the following just once after boot, and note AT commands cannot be run after this is paired
hcitool scan
rfcomm bind 0 00:12:02:28:71:34 1

#Upload this test code
void setup() {
Serial3.begin(57600);
}

void loop() {
Serial3.write("test\r\n");
delay(1000);
}

command line test
screen /dev/rfcomm0 57600 #cycle through all baud rates until you see the plain text "test" string

I re uploaded the sketch every time but when I hit 57600 I just decided to re run screen without the upload and it worked >.> so maybe it doesn't matter or maybe that fixed it.

Once I saw the plain text I CTRL-A-k out of screen

rfcomm release 00:12:02:28:71:34 #If you don't release the pairing AT commands don't work!

Then upload the following code

String command = "";
void setup() {
Serial.begin(115200);
Serial3.begin(57600);
Serial.println("Type AT commands!");
}

void loop(){
if (Serial3.available()) {
while(Serial3.available()) { command += (char)Serial3.read();delay(10); }
Serial.println(command);
command = ""; // No repeats
}
if (Serial.available()){ delay(20); Serial3.write(Serial.read()); }
}

screen /dev/ttyACM0 115200 #Begin typing AT commands.

I just wrote up an Arduino sketch that configures this module if that is helpful to anyone.

http://arduino.cc/forum/index.php/topic,122070.0.html

I got my JY-MCU, but can't get it to work.

Wired with 5V @ 8A going in to Arduino VBus, BT, and 100 pixel LEDs. Pixel data on D4, TX/RX swapped from BT to Arduino (tried both ways).

  1. When powered, red light on it blinks continuously even with TX/RD unplugged, always, never seen any change.

  2. When paired I get 2 serial ports: "Com11 - SSP" and "Com12 - SSP (Dev B)". Windows lets me enable or disable 12 in BT settings. 11 is always only in device manager.

  3. When I try to open either port (at 9600), term program locks up for a few seconds, then says it is open but it doesn't work.

Seller said board default was 9600. I was hoping I could just plug this in and do everything (re-program Arduino, send bytes to change LED colors) the exact same as when I connect my TTL board to the same 4-pins and use a cable. The whole thing is installed on my roof, so I'd rather not have to send any AT commands while unpaired or any of that stuff, but I guess I could just pull the BT and connect it to my TTL if I have to.

Any suggestions? Which of the 2 serial ports is right? Is the red light supposed to blink no matter what?

rpmccormick:
I got my JY-MCU, but can't get it to work.

Wired with 5V @ 8A going in to Arduino VBus, BT, and 100 pixel LEDs. Pixel data on D4, TX/RX swapped from BT to Arduino (tried both ways).

  1. When powered, red light on it blinks continuously even with TX/RD unplugged, always, never seen any change.

  2. When paired I get 2 serial ports: "Com11 - SSP" and "Com12 - SSP (Dev B)". Windows lets me enable or disable 12 in BT settings. 11 is always only in device manager.

  3. When I try to open either port (at 9600), term program locks up for a few seconds, then says it is open but it doesn't work.

Seller said board default was 9600. I was hoping I could just plug this in and do everything (re-program Arduino, send bytes to change LED colors) the exact same as when I connect my TTL board to the same 4-pins and use a cable. The whole thing is installed on my roof, so I'd rather not have to send any AT commands while unpaired or any of that stuff, but I guess I could just pull the BT and connect it to my TTL if I have to.

Any suggestions? Which of the 2 serial ports is right? Is the red light supposed to blink no matter what?

Blinking red light is what I see as well, even with nothing attached to TX and RX. I think the light may change when it goes into command mode, but I don't recall offhand.

I haven't tried to reprogram an Arduino over the bluetooth serial link, but I don't see any reason why it wouldn't work.

I think your best bet is to get the Bluetooth module working on its own before trying to incorporate it into your project. The sketch I wrote should be able to configure the module to whatever you specify, regardless of what the default configuration is. From there, you can test it out with a simple "Hello World" kind of sketch and a Bluetooth terminal on the PC. The module will keep that configuration forever, so once you set it up once and get it working, you can just drop the module into the project on the roof and it should just work.

  1. Try using a very simple sketch that just outputs a message every second with just the Arduino first. Program it with a USB cable, then remove it from the computer and attach the JY-MCU so that the up arrow (on either RX or TX) goes to TX (pin 1) on the Arduino. If you connected it correctly then you should be able to see your data.
  2. When you pair and open the serial port (you have two-either one should work), the LED should shop blinking and be solid on. This means the serial port is open and you should be seeing data. You cannot send AT commands in this mode. If you want to send AT commands to change baud rate and name, follow steps in post #3. You cannot upload sketches in this mode unless you press the reset button at the right time. Uploading sketches requires a reset wire which the JY-MCU does not provide. I made an ATtiny circuit to watch the LED and reset the microcontroller so that sketches can be uploaded, but uploading code is five times slower and sometimes it fails. It is flawless if it actually finishes an upload though.

Thanks for the replies, I guess I'll pull it off and get it AT-programmed (even though any baud/pin/name is totally fine with me if I could just get it to work).

The solid-light on serial data is good to know... and you are saying both of the 2 serial ports do the same thing? Strange.

Ok...

  1. Connected board to TTL and AT commands were fine.
  2. Proved out 2-way communication by using BT, TTL, and two terminal programs.
  3. Proved 1-way communication when re-installed on Roof (Arduino code sends "RPM\n" on startup, and I see that in terminal program)
  4. SENDING BYTES DOES NOT SEEM TO WORK when installed on Roof???

It should not be my Arduino code, but I thought I would try to reprogram it anyway.
I changed the boards.txt file to 9600 baud (didn't want to risk upping it, AT verified 9600)
When I try to program my Arduino Mini Pro, it just says "uploading..." and locks up the port until I reboot. When using the TTL, it never does this; it times out after 5-seconds if you don't press reset in time. I had my friend on the roof pressing reset, but even if our timing was off, it should time-out, not lockup. What is going on?

If you have already verified two-way communication without a USB cable while not on the roof, then it should work on the roof unless a wire comes loose or the asymmetry between Bluetooth transmit power causes one of the two signals to degrade.

I do not know why your computer is locking up while trying to program over bluetooth. If I had to guess, it is getting stuck at the connection establishment, something a USB cable does not have to worry about. I would just end the Arduino process or disable the bluetooth adapter in device manager instead of rebooting. Again, I do not recommend programming over bluetooth. The JY-MCU already provides an easy to use serial connection but was not meant to program.

Also when I said "up arrow (on either RX or TX)", I said "either" because I could not remember which one it was. The pins don't do the same thing.

You seem to know what you are doing so I trust you can troubleshoot.

Got it working... just used a USB extension cable to get my BT dongle a little closer to the roof. :stuck_out_tongue:

I still want to know how to program though as I do want to update code and I do not want to disassemble the roof project. Did I do it correct by changing the BAUD in boards.txt to 9600? Would I be better to leave that alone and instead change the BT baud to 57600? If I did that would 57600 mean less distance than 9600 (ie: would I need a longer USB extension cable to get it to work)? How come the Arduino IDE only sees the second (dev b) serial port and not the main one (which is the only one that seems to work when trying to send serial to my code)?

I would recommend changing the baud rate on the bluetooth device, otherwise other boards of whatever entry you changed will not work without more modification to boards.txt. I am not sure about less distance at 57600--you have to determine this empirically.

I have not got it to connect again since that once. RealTerm gives "apro exception." on one of the ports, and the other port just lags and doesn't work in either direction. Now I removed the device and re-added it, and I have no serial ports. I hate BT! Have you others really got this to work reliably? Maybe I need a different BT dongle?

rpmccormick:
I have not got it to connect again since that once. RealTerm gives "apro exception." on one of the ports, and the other port just lags and doesn't work in either direction. Now I removed the device and re-added it, and I have no serial ports. I hate BT! Have you others really got this to work reliably? Maybe I need a different BT dongle?

I've never had much luck with Windows and Bluetooth in general. I've had zero issues at all with using this module with Android devices, though. I've been doing a burn-in test for the last 2 days with one, actually. I've just left it running and connected to it from my tablet and phone sporadically to see that it will still accept a new connection. So far so good, it's been quite reliable. I've also just left it connected for a few hours at a time and it seems to keep the connection without any problems.

I think the module is best left as a serial communication terminal, though, rather than as the primary connection to the arduino for programming. For that reason, I attached mine to a SoftwareSerial port (or on the Mega, I just used one of the non-primary serial ports).

I'm using a Pro Mini. Right now all I'm doing is changing the color of xmas LEDs. I would love to figure out how to make an Android app for that, and there are open-source BT-terms for Android, but I just don't have the time right now. Eventually I want to allow "file-playback" to make the LEDs do all source of color movement, lightning effects, etc...and while I could do that from my phone as well, I'd rather have my house server doing it even when I am not at home.

I got it to work (once) again, but every time I need to connect to it to change the color it's like pulling teeth. Once connected it works great until you exit my color-change app, unplug the BT dongle, reboot the PC, or reset the Pro-Mini. After that I have to use RealTerm, plugging/unplugging the BT dongle, unpairing/repairing, etc...until it finally starts working again. Sometimes I only see one serial port, other times I see 2 or none. The Arduino IDE never sees the port that works, only the one that doesn't, but I have not got it to program over that. How does it even decide just not to show a COMPort that is free and working?

I have not been able to test with Android term past receipt because both of those I tried only send ASCII, but I need to send 0xFE 0x00 0x00 in HEX as my key byte for the next "frame" of RGB values.

I also received the JY-MCU bt board from dx.com (SKU: 104299) and had some trouble getting it working. Mine shows up with the Bluetooth name "linvor", and responds to "AT+VERSION" with "linvorV1.5" A lot of this has already been said, but here's what I learned:

  1. It doesn't require a level converter.
  2. You don't need to invert the signal.
  3. The default bluetooth pairing code is 1234
  4. The default baud rate is 9600 (and I believe N-8-1, but you don't really need to know that if you're using the arduino IDE serial monitor)
  5. It will only respond to AT commands that are in uppercase. (eg AT, AT+VERSION, AT+BAUD4, AT+NAMElinvor, AT+PIN1234)
  6. It doesn't like returns and linefeeds immediately after commands. In the Arduino IDE serial monitor, you should set the little popup to 'No line ending'.
  7. It will not respond to AT commands when it is connected over bluetooth.
  8. When I tried setting the baud rate with "AT+BAUD4" it responded with "OK9600" but then seemed to go dead. After much fiddling, for about ten minutes, it magically started working again. 9600 will work fine for me for now.
  9. I successfully changed the name using the name command. My computer (Mac) took a while before it updated the name, but my phone (symbian) saw the change immediately.
  10. I successfully used the SoftwareSerial sketch at http://arduino.cc/en/Reference/SoftwareSerial but changed all speeds to 9600, including the IDE Serial Monitor.
  11. I also tried using that sketch with the software serial connection to the bt board at 9600, but with the hardware port (and serial monitor) at 57600. The AT command would respond "OK", but the "AT+VERSION" didn't respond at all. If I then added the delay(10); (described at http://eclipse.clinertech.com/arduino/bluetooth/blth.html) on a line before "mySerial.write(Serial.read());" it would work again. It's probably easier to just set everything to the same baud rate.
  12. I don't think that this board can be used as a Master. It won't respond to "AT + ROLE = 1"

So now I'm a happy camper.

i have tried to connect the RX and [tx] pins of the jy mcu to the TX and [rx] pin of the Arduino UNO3 respectively, but my simple AT command (enter through the Serial monitor of Arduino IDE) have no response. I only managed to get the "goodnite mr moon" to work. any ideas? i seriously doubt my connection is wrong but it still baffled me.

i learn that this is a slave one, but does it meant by soldering the pin 34 and pull high will make it a master (with the changes in role)?

** just curious for the sketch, does it work with Uno3? understood need to initialize the softwareSerial but that applies to other versions of arduino rather than uno3. uno3 has pin 0 and pin 1 as rx and tx pins

How many phones would you say this device can pair with at a time?

Poppin:
I had the same problems where only the AT command received a response. I have the breakout version 1.03 with firmware version 1.5. Found and changed a simple Arduino sketch to allow AT commands to be sent to the Bluetooth adapter. Simply adding a delay(10) allowed the other commands such as AT+VERSION to get a correct response from the Bluetooth adapter. I used Arduino's serial Monitor to send all the commands. This is based on the code in the link provided earlier in this thread. Hope this is useful to some!

Link to the code: http://eclipse.clinertech.com/arduino/bluetooth/blth.html

augustinoy:
I have the same problem with AT commands, only have AT working, non other. Is the problem in the software serial sketch maby? I don't have a usb to ttl board, only a usb to rs232 so I really need make it work over the arduino, any Ideas?

This code worked for me!! Thank you very much! I had to change BAUD rate to 9600 for BT and 57600 for arduino comm. Then in serial monitor baud 57600 no line ending. I am now controlling my lights via bluetooth! Thanks so much!

My BT module is playing alittle funny. It's a JY-MCU ver 1.05. I have it all seemingly working connected to my Android app. I have the Android app send the numbers "1", "2" & "3" with a new line between each. About one in every ten returns correctly, but mostly they return as 0 or a number between 200 and 255, or half correct.
I've tried all the different baud rates from within arduino but to no avail. I currently have the NewSoftSerial connection on pins 2 and 3 set at 9600 which is connected to the BT module. Both the hardware serial and the arduino serial monitor are also set to 9600.
My phone connects to the module fine and seems to send data out fine.
Has anyone else had this issue with the reliability?
Many thanks