receiving bites from android app (UNO + SEEED BT shield)

Hey guys,

I try to send information from my samsung galaxy S to my arduino via bluetooth.
I have an Arduino UNO with a SEEED Bluetooth shield mounted on it.

I use an app called blueterm to send data to my arduino.

Using the arduino console I try to receive the on the galaxy typed text but all Im receiving is gibberish (x’s and zero’s with a diagonal line trough it)

I also tried all the different baudrates that the BT shield supports, for 57600 I get different signs (a’s with accents on it), and for 115200 I get only empty spaces. (line width gets bigger, but no signs appear on the console)

What is going wrong? I also tried a different app, with the same result.

My code:

#include <SoftwareSerial.h>  //Software Serial Port
#define RxD 6
#define TxD 7
 byte byte2;
#define DEBUG_ENABLED  1
const int LED = 8;
 
SoftwareSerial blueToothSerial(RxD,TxD); 

void setup() 
{ 
  Serial.begin(9600);
  pinMode(RxD, INPUT);
  pinMode(TxD, OUTPUT);
  pinMode(LED, OUTPUT);
  setupBlueToothConnection();
 
} 
 
void loop() 
{ 
    
  byte byte2;
  while(1){
    if(blueToothSerial.available()){//check if there's any data sent from the remote bluetooth shield
      byte2 = blueToothSerial.read();
      Serial.print(byte2);
    }
    if(Serial.available()){//check if there's any data sent from the local serial terminal, you can add the other applications here
      byte2 = Serial.read();
      blueToothSerial.print(byte2);
      
      
      if (byte2== 1)
      {
       digitalWrite(LED, HIGH); 

      }
      
            if (byte2=='2')
      {
       digitalWrite(LED, HIGH); 
      }
 //            switch (byte2) {
  //   case '1':
  //     digitalWrite(LED, HIGH);
  //     break;
  //   case '2':
   //    digitalWrite(LED, LOW);
   //    break;

 //  }
 
    }
  }
} 
 
void setupBlueToothConnection()
{
  blueToothSerial.begin(38400); //Set BluetoothBee BaudRate to default baud rate 38400
  blueToothSerial.print("\r\n+STWMOD=0\r\n"); //set the bluetooth work in slave mode
  blueToothSerial.print("\r\n+STNA=SeeedBTSlave\r\n"); //set the bluetooth name as "SeeedBTSlave"
  blueToothSerial.print("\r\n+STOAUT=1\r\n"); // Permit Paired device to connect me
  blueToothSerial.print("\r\n+STAUTO=0\r\n"); // Auto-connection should be forbidden here
  delay(2000); // This delay is required.
  blueToothSerial.print("\r\n+INQ=1\r\n"); //make the slave bluetooth inquirable 
  Serial.println("The slave bluetooth is inquirable!");
  delay(2000); // This delay is required.
  blueToothSerial.flush();
}
  while(1){

Running an infinite loop inside an infinite loop is a sure sign that you haven't a clue. Get rid of that, and we'll talk.

Thank you for your reponse.

That code part is from the original SEEED code that can be seen below and that works perfectly fine for other people. Why would it be a problem?

Best regards,

Koevoet

/*
BluetoothShield Demo Code Slave.pde. This sketch could be used with
Master.pde to establish connection between two Arduino. It can also
be used for one slave bluetooth connected by the device(PC/Smart Phone)
with bluetooth function.
2011 Copyright (c) Seeed Technology Inc.  All right reserved.
 
Author: Steve Chang
 
This demo code is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
 
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.
 
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
For more details about the product please check http://www.seeedstudio.com/depot/
 
*/
 
 
/* Upload this sketch into Seeeduino and press reset*/
 
#include <SoftwareSerial.h>  //Software Serial Port
#define RxD 6
#define TxD 7
 
#define DEBUG_ENABLED  1
 
SoftwareSerial blueToothSerial(RxD,TxD); 
 
void setup() 
{ 
  Serial.begin(9600);
  pinMode(RxD, INPUT);
  pinMode(TxD, OUTPUT);
  setupBlueToothConnection();
 
} 
 
void loop() 
{ 
  char recvChar;
  while(1){
    if(blueToothSerial.available()){//check if there's any data sent from the remote bluetooth shield
      recvChar = blueToothSerial.read();
      Serial.print(recvChar);
    }
    if(Serial.available()){//check if there's any data sent from the local serial terminal, you can add the other applications here
      recvChar  = Serial.read();
      blueToothSerial.print(recvChar);
    }
  }
} 
 
void setupBlueToothConnection()
{
  blueToothSerial.begin(38400); //Set BluetoothBee BaudRate to default baud rate 38400
  blueToothSerial.print("\r\n+STWMOD=0\r\n"); //set the bluetooth work in slave mode
  blueToothSerial.print("\r\n+STNA=SeeedBTSlave\r\n"); //set the bluetooth name as "SeeedBTSlave"
  blueToothSerial.print("\r\n+STOAUT=1\r\n"); // Permit Paired device to connect me
  blueToothSerial.print("\r\n+STAUTO=0\r\n"); // Auto-connection should be forbidden here
  delay(2000); // This delay is required.
  blueToothSerial.print("\r\n+INQ=1\r\n"); //make the slave bluetooth inquirable 
  Serial.println("The slave bluetooth is inquirable!");
  delay(2000); // This delay is required.
  blueToothSerial.flush();
}

That code part is from the original SEEED code that can be seen below and that works perfectly fine for other people. Why would it be a problem?

It's useless. It prevents loop from every repeating. Garbage code is garbage, no matter who wrote it.

ok.

I changed the code the one below. With the standard baud rate of 38400 after sending characters with the Blueterm app. I get only

àà à à àààà àà à ààà à à etc. in the console

When I try the arduino commander app, the arduino board that is displayed stays black with only the Power light burning.
This means that the baud rate is incorrect according to their website.

I tried every baud rate, but nothing changes…
I changed the baudrate on the shield with the AT commands:

 blueToothSerial.print("\r\n+INQ=1\r\n"); 
 blueToothSerial.print("\r\n+STBD=9600\r\n");
 // Serial.println("The slave bluetooth is inquirable!");
  delay(2000); 
  blueToothSerial.flush();

full code:

#include <SoftwareSerial.h>  //Software Serial Port
#define RxD 6
#define TxD 7
 byte byte2;
#define DEBUG_ENABLED  1
const int LED = 8;
 
SoftwareSerial blueToothSerial(RxD,TxD); 
 
void setup() 
{ 
  Serial.begin(9600);
  pinMode(RxD, INPUT);
  pinMode(TxD, OUTPUT);
  pinMode(LED, OUTPUT);
  setupBlueToothConnection();
  
} 
 
void loop() 
{ 
  char byte2;

    if(blueToothSerial.available()){//check if there's any data sent from the remote bluetooth shield
      byte2 = blueToothSerial.read();
      Serial.print(byte2);
    }
    if(Serial.available()){//check if there's any data sent from the local serial terminal, you can add the other applications here
      byte2 = Serial.read();
      blueToothSerial.print(byte2);
      
      
      if (byte2=='1')
      {
       digitalWrite(LED, HIGH); 
      }
      
            if (byte2=='2')
      {
       digitalWrite(LED, HIGH); 
      }
   
    }
  
} 
 
void setupBlueToothConnection()
{
 // blueToothSerial.begin(9600); //Set BluetoothBee BaudRate to default baud rate 38400
 
  blueToothSerial.print("\r\n+STWMOD=0\r\n"); //set the bluetooth work in slave mode
  blueToothSerial.print("\r\n+STNA=SeeedBTSlave\r\n"); //set the bluetooth name as "SeeedBTSlave"
  blueToothSerial.print("\r\n+STOAUT=1\r\n"); // Permit Paired device to connect me
  blueToothSerial.print("\r\n+STAUTO=0\r\n"); // Auto-connection should be forbidden here
  delay(2000); // This delay is required.
  blueToothSerial.print("\r\n+INQ=1\r\n"); //make the slave bluetooth inquirable 
   blueToothSerial.print("\r\n+STBD=9600\r\n");
   
 // Serial.println("The slave bluetooth is inquirable!");
  delay(2000); // This delay is required.
  blueToothSerial.flush();
}