Libelium is offering new technical support channels, to contact with de Technical Support team to solve any issue our doubt please contact with your sales agent or visit our contact site



Post a new topicPost a reply Page 1 of 1   [ 4 posts ]
Author Message
 Post subject: How to connect Bluetooth Shield with Android Phone
PostPosted: Wed Dec 13, 2017 10:37 am 

Joined: Tue May 19, 2015 4:47 pm
Posts: 25
Hello,
I am unable to pair with my Android phone with Bluetooth Module given below:
https://www.dropbox.com/sc/x8cscr9r3pty ... 46Zb3Omf6a

https://www.dropbox.com/sc/tzxw2pdt6wf6 ... Gp1XoGUw2a

I want to send commands from Android phone to Bluetooth Module without any pairing key.
So first I checked with the code:
1.Serial.print("AT+JSEC=1,1,1,04,0000\r\n"); When I tried to pair WT12-A with Android phone. It asked for key. I used 0000. Pairing Failed. I tried with other keys as well and other phones too.
2. Then I used reset method: Serial.print("AT+JRES\r\n"); Still pairing failed
Hence, I dont want to use any pairing key. So whenever the phone asks, it will be paired automatically.

#include <eHealth.h>

// the setup routine runs once when you press reset:
void setup() {
delay(2000);
Serial.begin(115200);
delay(2000);
Serial.print("AT+JRES\r\n");
//Serial.print("AT+JSEC=1,1,1,04,0000\r\n"); // Enable security command
//Serial.print("AT+JSEC=2,0,0,0,0\r\n"); // Enable security command
delay(2000);
Serial.print("AT+JDIS=3\r\n"); // Discorable command
delay(2000);
Serial.print("AT+JRLS=1101,11,Serial Port,01,000000\r\n"); // Register local sevice command
delay(2000);
Serial.print("AT+JAAC=1\r\n");// Auto accept connection requests command
delay(2000);
pinMode(led, OUTPUT);
digitalWrite(led,HIGH);
Serial.flush();
val = Serial.read();
while (val != 'R'){
val = Serial.read();
}
delay(1000);
Serial.print("AT+JSCR\r\n"); // Stream Connection Request command

}

// the loop routine runs over and over again forever:
void loop() {

float temperature = eHealth.getTemperature();
Serial.print("Temperature (ºC): ");
Serial.print(temperature, 2);
delay(1000);
}


B. I tried with the sample code given below to check the pin can be set and I can use the key, but I coudnot. I entered 123456 from phone, while pairing. But it failed.

Serial.print("AT+JSEC=3,1,1,06,123456\r\n"); // Register local sevice security PIN activated
delay(2000);
Serial.print("AT+JDIS=3\r\n"); // Discoverable Inquiry & Page Scan enabled
delay(2000);
Serial.print("AT+JRLS=1101,11,Serial Port,01,000000\r\n"); // Register local service
delay(2000);
Serial.print("AT+JAAC=1\r\n"); // Auto accept
delay(2000);
Serial.print("AT+JPCR=06,123456\r\n"); // PIN code reply
delay(2000);
pinMode(led, OUTPUT);
digitalWrite(led,HIGH);
Serial.flush();
val = Serial.read(); // wait for connection
while (val != 'R'){
val = Serial.read();
}
delay(1000);
Serial.print("AT+JSCR\r\n"); // Stream Connection Request
}

void loop(){
digitalWrite(led, LOW);
Serial.println("Hola caracola (connected with PIN 123456)...");
delay(1500);
digitalWrite(led,HIGH);
delay(500);
}

Hence, I dont want to use pairing pin. Please suggest what to do.
I tested this in post : Post subject: Bluetooth Setup and communication Issues. I had the same.

C. I tested in Gateway mode: I uploaded the empty sketch in arduino. Changed the jumper to USB from XBEE. Connected Bluetooth Shield, USB. FROM HYPERTERMINAL(WINDOWS)/ GTKTERM (Ubuntu) issued following commands:
AT
OK
AT+JDDS=0
SYNTAX ERROR
AT+NAME
SYNTAX ERROR
Dont understand why I am getting error.
Thanks


Top
 Profile  
 
 Post subject: Re: How to connect Bluetooth Shield with Android Phone
PostPosted: Thu Dec 14, 2017 8:13 am 

Joined: Mon Sep 28, 2009 12:06 pm
Posts: 11366
Hi Altrayee,

All the information an the examples available for this product are in the tutorial:

https://www.cooking-hacks.com/documenta ... -tutorial/

Have you followed it? Does it work for you?

Regards


Top
 Profile  
 
 Post subject: Re: How to connect Bluetooth Shield with Android Phone
PostPosted: Thu Dec 14, 2017 10:03 am 

Joined: Tue May 19, 2015 4:47 pm
Posts: 25
Thank you. I have found the solution from your forum.

The new Bluetooth module (WT12-A) has no pin set. So, for the first time we have to set the pin, in order to pair with any phone. Here are the steps:

1.Connect with Arduino and the PC. Communication/Xbee shied in gateway mode (all jumpers in USB) as asked in the tutorial(115200 bps,parity and flow none, data bits 8). Upload the empty sketch in arduino.

2. Hyperterminal/ Gtkterm the following commands:
AT
OK (Reply)
SET BT AUTH * 0000

We are now set to pair with any phone.

3. From Phone> Bluetooth scan > Shows WT12-A> Pair with 0000
The module will be paired with the phone.

4. Once tested, we can now upload any sketch to Arduino (As per tutorial) and see the data from Android phone with proper applications installed. However, we need to change the jumpers from USB to Xbee in Xbee communication shield. Everything is working now.

Thanks.


Top
 Profile  
 
 Post subject: Re: How to connect Bluetooth Shield with Android Phone
PostPosted: Fri Dec 15, 2017 7:02 am 

Joined: Mon Sep 28, 2009 12:06 pm
Posts: 11366
Hi Altrayee,

Nice to read it!

Thanks for this information, it will be useful for other users.

Good luck with your project!

Regards


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 4 posts ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Libelium theme based on 610nm Style by Daniel St. Jules of http://www.gamexe.net


© Libelium Comunicaciones Distribuidas S.L. | Terms of use.