Error 507, unable to connect

Without all the information, no - I don't have a crystal ball.

I see your App is "Voice Controlled Automation" which is ambitious. What does the laptop have to do with that?

You are using an Arduino, so we need more information about that:

  1. Arduino Model (e.g. UNO)
  2. Arduino Bluetooth module version
  3. We need to see the Arduino Sketch (Script), which you can post here by changing the extension from .ino to .txt.
  4. We need to know the Bluetooth version of all devices your App is to connect to. Modern devices are most likely to be BLE and not Classic Bluetooth, which your code is using now (but your code is not adequate for communications with an Arduino, or for speech driven commands).

I have no idea what that is! :thinking:

1 Like

Bluetooth Module - HC - 05
Arduino UNO

kk.txt (693 Bytes)

where are you stuck salmaan?

I'm still thinking

1 Like

ohh, sorry to trouble you but it is very important for mee.

Maybe this can help you :

1 Like

not getting anything salman brother, isnt there anything which you can change in my blocks so that i can use the app?? I am going into some sort of depression now :sob: :sob:

Ah, I see - the equivalent of Fritzing. HC-05 Module is Bluetooth v2.0 + EDR. So, you are only wireless to the Arduino, the household devices are wired to the Arduino.

Utakarsha, have you ever heard the phrase "less haste, more speed"? It definitely applies to you :grin:

I'm attaching a Basic Setup project for sending text. It should work straight-out-of-the-box, many other people have used it as the base of their project.

For now, see if it solves your connection fault.

Next, we can test sending commands.

Finally, I will show you how to drive commands with speech.

BT_Basic_Setup_Send.aia (7.8 KB)

.... the Sketch needs some work :owl:

The Sketch, once we get over the other hurdles, should be like this:

AppToArduino_Cmds.txt (1.5 KB)

Note that speech commands must be "short and sweet".

//Receive commands from App

//vars
string sgCommand;
unsigned int igUpdateTime;

void setup()
{
              Serial.begin(9600); // open serial port, set the baud rate to 9600 bps
         igUpdateTime = millis(); // loop timer
}

void loop()
{
         //Execute loop every 10 seconds
	     if((millis() - igUpdateTime) > 10000)
         {
               igUpdateTime = millis();

               if(Serial.available() > 0)
               {
                     sgCommand = Serial.read();

                     switch (sgCommand)
                     {

                       case "light on":
                                digitalWrite(5, HIGH);
                                break;

                       case "light off":
                                digitalWrite(5, LOW);
                                break;

                       case "fan on":
                                digitalWrite(6, HIGH);
                                break;

                       case "fan off":
                                digitalWrite(6, LOW);
                                break;

                       case "all on":
                                digitalWrite(5, HIGH);
                                digitalWrite(6, HIGH);
                                break;

                       case "all off":
                                digitalWrite(5, LOW);
                                digitalWrite(6, LOW);
                                break;
                     }
               }
         }
}

Utakarsha

I'm taking a lunch break. When you have got the connection working, let me know here and I will upload an Enhanced Project that can handle Speech Commands (it is an update of the Basic Project)

Proteus Simulation for Bluetooth Module

Has no one in this thread yet mentioned that the error 507 happens when you try to send Bluetooth data but the BlueTooth device is not yet connected?

I don't see any code in the Original Poster's app that prevents this from happening.

The ChrisWard sample app does this by disabling the button that sends text until the BlueTooth component is connected.

Hi ABG - the Basic Project I uploaded addresses that issue.

Waiting for your feedback Utakarsha.

Hi,
are you sure of the HW connections ?
I don't see any power and ground lines to the HC06 in your schematic so I think that they aren't simply drawn, but you connected them.
More: the RX of the HC06 shall work @3.3 Volts, then a voltage divider is better for HC06 health.
Something like this:
image
It's a stupid hint, I believe, but before fighting with software be sure that the hardware is correct :slight_smile:
Cheers.

This is not my circuit, it is a Youtube tutorial by an author named Ibrahim kamr.
Look at the tutorial, it works for him.
I only put it to give an idea to any reader, the way to simulate Arduino, Bluetooth and a smartphone.
Here's another one, it's not mine either :slight_smile:

Oooops I replied to the wrong post.... :upside_down_face:
I wanted to reply to Utakarsha's drawing :grin: :grin: :grin:
My apologies Juan Antonio !!!

PS anyway a voltage divider could be safer for the BT shield..HC-05_Bluetooth.pdf (3.1 MB)

PPSS Utakarsha, in the annex file you can find a data sheet of the HC05, where you can read that originally the HC05 is factory set at 38400 (like mine bougth at AZDelivery in June 2020) . BUT, according to Patrick's post here below, some others have a 9600 baudrate default setting. If you don't have set a specific baudrate on your own, you can use the following chunk of code to scan the baudrate and discover which is set on your HC05 shield.
Hoping it can help.


/*Wire the HC-05 Rx pin to UNO pin 11 (possibly with a voltage divider) and HC05 Tx pin to UNO pin 10. Take care to connect UNO pin2 to EN pin of HC05
BEFORE YOU CONNECT THE ARDUINO TO THE USB remove the VCC (power)  wire from the HC-05 so it's not getting any power from the Arduino. All other wires are still connected.
Now connect the Arduino Uno to the USB cable  from your PC.
Re-connect the Arduino Uno 5V wire to the HC-05's VCC (5V power) pin. 
Verify theat the HC-05 LED will blink on and off at about 2 second intervals. If so,  the HC-05 is in AT command mode ready to accept commands to change configuration and settings. Start the serial monitor on the PC.
The code here below scans various baudrates to find which one is set. Once found you should see an "OK", if not: please check the wiring.
*/
#include <avr/io.h>
#include <SoftwareSerial.h>


SoftwareSerial mySerial(10, 11); // RX, TX

String command = ""; // Stores response of the HC-06 Bluetooth device
long baud;

void setup() 
{
  pinMode(2, OUTPUT);  // this pin will pull the HC-05 pin 34 (EN pin) HIGH to switch module to AT mode
  digitalWrite(2, HIGH);
  // Open serial communications:
  Serial.begin(115200);                       // Toward serial monitor
  baud = 9600;
  provatx();
  baud = 19200;
  provatx();
  baud = 38400;
  provatx();
  baud = 57600;
  provatx();
  baud = 115200;
  provatx();
}


void provatx()
{
     Serial.print("Checking communication at "); 
     Serial.println(baud);
     mySerial.begin(baud);                                    //toward HC05
     delay(10);
     mySerial.write("AT\r\n");
     delay(500);
     if(mySerial.available())
     {
      while(mySerial.available()) 
      { 
        command += (char)mySerial.read();
      }
     }
     Serial.print("Received: ");
     Serial.println(command);
     delay(2000);
}



void loop()
{
// nothing to do   
}

All the hc-05 and hc-06 I bought had a standard speed of 9600, not 38400. Recently, there was a post by one person who set the script speed to 38400 and the application did not work. After changing to 9600, it was ok.

1 Like

I think @Utakarsha wants to connect a mobile with the Proteus circuit simulator program via Bluetooth. In the simulator he has put an Arduino and a Bluetooth module.

It is necessary that the laptop has Bluetooth or a PC with a Bluetooth dongle, in my case I have used a PC-Desktop with a Bluetooth dongle.

I have made this connection:

In the Arduino of the simulator I have loaded this sketch:

// Juan A. Villalpando
// http://kio4.com/appinventor/9A0_Resumen_Bluetooth.htm

#define Pin12 12
#define Pin13 13
char caracter;

void setup() {
Serial.begin(9600);
pinMode(Pin12, OUTPUT);
pinMode(Pin13, OUTPUT);
}

void loop() {
if(Serial.available()) {
caracter = Serial.read();

if(caracter == 'a'){ digitalWrite(Pin12, HIGH);}
if(caracter == 'b'){ digitalWrite(Pin12, LOW);} 
if(caracter == 'c'){ digitalWrite(Pin13, HIGH);}
if(caracter == 'd'){ digitalWrite(Pin13, LOW);}

}

}

In App Inventor I have used this code:

  • Device Manager.