Go Down

Topic: How to get the JY-MCU bt board to work (Read 86 times) previous topic - next topic

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


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?

FreeBee

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.

xpatch

#32
Sep 03, 2012, 08:35 pm Last Edit: Sep 03, 2012, 10:53 pm by xpatch Reason: 1
Links with the AT commands.
http://byron76.blogspot.ca/2011/09/one-board-several-firmwares.html
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 http://www.dankrill.com/lab/index.php?content=procedures&set=b&item=11
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.



Se7enLC

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

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?

Go Up