Pages: [1] 2 3 4   Go Down
Author Topic: SOLVED: Seeedstudio BT Shield  (Read 17536 times)
0 Members and 1 Guest are viewing this topic.
Texas
Offline Offline
Newbie
*
Karma: 0
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi everyone! I am new to the this BT communication :/ Ok, my end goal is to connect my android phone via the Arduino Commander app to my arduino board that is controlling different motors. I have purchased the seeedstudio BT Shield, gone to their website for instructions, read through the Wiki (and did everything it says to do), searched online  for videos or simple instruction guides (no luck) and can't get it to connect through the SSCOM3.2 app provided on the Wiki(which worries me because I am not even going to be connecting through that software, I will be connecting through my phone). I changed the code (see Wiki http://www.seeedstudio.com/wiki/index.php?title=Bluetooth_Shield) as instructed for the latest version of Arduino and the sketch uploads to the board. After that, the SSCOM3.2 should let me know that the BT sheild is inquireable (I am trying to set as slave) but it does nothing. (One thing to note, on the wiki, the ComNum on the middle right side of SSCOM3.2 is COM156... mine is empty, I don't think I set up something correctly but can't find instrcution on the Wiki)

I am looking for instructions, or a starting point to read up more on connecting via BT. It would be great to talk to someone who has used the seeedstudio BT shield and had it work correclty. Any help is better than I have now :/ Thanks.

The code for anyone that wants to know:
Code:
/*
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*/
 
// old line: #include <NewSoftSerial.h>   //Software Serial Port
#include <SoftwareSerial.h>               //new line
#define RxD 6
#define TxD 7
 
#define DEBUG_ENABLED  1
 
// old line: NewSoftSerial blueToothSerial(RxD,TxD);
SoftwareSerial blueToothSerial(RxD,TxD);  //new line
 
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();
}
« Last Edit: August 28, 2012, 07:15:54 pm by twychopen » Logged

Georgia, US
Offline Offline
Jr. Member
**
Karma: 2
Posts: 84
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello, I'm also having a problem connecting (much less seeing the Arduino/Seeeduino Bluetooth Shield) with my android phone.
You wouldn't happen to be using Froyo/Android 2.2 on your phone would you?. I'm starting to see a few threads that don't mention 2.2 directly but most of the android devices that do work appear to be using Gingerbread/2.3. If that's the problem, then maybe we can get someone to start looking in that direction to fix things.
Bluetooth keyboards aren't seen by android 2.2 either. (and of course I have an LG Vortex which will probably never get a 2.3 update)

Winston
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 33
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So I wasn't the only one after all! smiley-sweat Well there's an extreme lack of documentation over Seeeduino BT shield. Other than the wiki, no one else apparently has heard of anything as such.
So I went through hell to get it working, but I succeeded! Imma solve this once and for all!  smiley-grin
Check 2 things:
1. The code: This code works for Arduino 1+, makes the Bluetooth shield inquirable as a slave (it can receive data from other devices):
Code:
/* 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();
}

After uploading the code, you should see 2 results:
A) The Bluetooth shield's LEDs flashing Green & Red.
B) The Serial monitor displays: "The slave bluetooth is inquirable!"

2. Jumpers should be setup correctly, like this picture.
Jumpers highlighted here.

Let me know about the results!
Logged

Georgia, US
Offline Offline
Jr. Member
**
Karma: 2
Posts: 84
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I actually already had the BT module working with my laptop. It's with my phone that I can't get working.
I'm working on a motorized peddle cart (for me, my feet were broken in a car accident) and I wanted to have the controller detect when my phone was near by to activate the power. If I'm not there; then there's no power.
The only thing different on my BT module is the pin setup. I'm using D7 for the serial LCD (Parallax - and yes, I had problems with that also).
D5 and D6 for the BT and I'm still working on the GPS module that I'm putting in.

Winston
Logged

Texas
Offline Offline
Newbie
*
Karma: 0
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok, my issue was the COM1 port. The Arduino board in the device manager was COM3 and the Arduino 1.0.1 program was also COM3 (obviously) but the SCOM program is looking for COM1. I just noticed that it was COM1 because of everyone's pictures of the program saying "Device is Inquireable!". Anyway, I changed everything to COM1 and now my "Device is Inquireable!".

Two issues happen now, my phone - Dell Streak Android 2.3 - doesn't find the BT Shield. I used the standard BT discovery on the phone, Bluetooth Class Zero, and Arduino Commander and none found the device :/............. please help haha

The second issue is that COM1 is used now and my serial monitor won't work because apparently it runs off COM1? When I try to open the Serial Monitor on Arduino 1.0.1, on the bottom the main message is "Serial port 'COM1' already in use. Try quiting any programs that may be using it." I guess that is what SSCOM3.2 does is monitor the Serial Communication.

The BT board is blinking and I did get the SCOM app to say:

WORK:MASTER

+BTSTATE:0

+BTSTATE:1
« Last Edit: August 26, 2012, 11:59:49 pm by twychopen » Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 551
Posts: 46227
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Why are you using an infinite loop inside loop()? The loop() function is already called in an infinite loop.
Logged

Texas
Offline Offline
Newbie
*
Karma: 0
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Why are you using an infinite loop inside loop()? The loop() function is already called in an infinite loop.

What I used is just the example code that comes with the Seeedstudio BT Shield.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am having this exact same issue, cannot tether to an Android galaxy s2 using identical code. I am very interested in seeing the solution
Logged

Texas
Offline Offline
Newbie
*
Karma: 0
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Tried with my Dad's Epic 4g and still no luck....
Logged

Texas
Offline Offline
Newbie
*
Karma: 0
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here is the image of my board...
Logged

Texas
Offline Offline
Newbie
*
Karma: 0
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok, I feel like a moron... I was checking to see which lights were on and noticed the message coming up:
Code:
The slave bluetooth is inquirable!

WORK:MASTER

+BTSTATE:0

+BTSTATE:1

I started thinking about why it would be telling me the state is on and off.... well come to find out I didn't have the BT shield seated completely on the Arduino board..... EPIC FAIL. :/ So anyway it is all working now! Thanks for everyone's help! Especially V0R73X for all the PM help!

Also a note, make sure that both red and green lights are blinking. I only had green so I was thinking that the board was working correctly. It wasn't until I checked for a red light (I didn't know where it was because I hadn't seen the lights light up so I didn't know the color of each) and saw the msgs that I figured out what was going on.
« Last Edit: August 28, 2012, 07:17:22 pm by twychopen » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

can you post a picture of the correct installation and the sample code that you used?
Logged

Texas
Offline Offline
Newbie
*
Karma: 0
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I haven't changed the code, its the same code as at the top of this job. I can't get the picture to show up correctly, unsure of how to post them on this forum. My seeedstudio BT shield fits snugly when the pins are halfway down. The issue was that I left the pins exposed halfway because the light started blinking at that point and it was snug. When I saw the message on the serial monitor I pushed the BT shield all the way so that the pins aren't showing at all.
Logged

Georgia, US
Offline Offline
Jr. Member
**
Karma: 2
Posts: 84
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm starting to think it's not so much of an Arduino code problem but maybe the BT shield Bluetooth profile is not completely jiving with the android Bluetooth profile. While it may be (a) BT SPP profile, it might not be all the way implemented. (A little wordy but I hope yall know what I mean) smiley-sleep
I have an old Nokia cell phone with Bluetooth and my old Palm TX with Bluetooth (which I'm almost sure doesn't have the correct profiles), plus my wife's old LG phone which has (Headset, Handsfree, Phonebook Acc and Object Push) profiles. Hopefully one of these will see the arduino and vice/versa.
My LG Vortex has (HSP 1.1, HFP 1.5, OPP, FTP, PBA, DUN, A2DP 1.2, AVRC version 2.1+EDR) {I'll have to look these up}
Plus my laptop has (I guess everything, if it'll download it)

I'm gonna keep whacking away at it until I get something going.

Winston
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry for borrowing this topic, does the Seeed bt work with UNO, am desperately looking for a BT shield for development...
Logged

Pages: [1] 2 3 4   Go Up
Jump to: