Pages: [1]   Go Down
Author Topic: Arduino Uno + Bluetooth module ,,, not working  (Read 2057 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i need help with my project

i have arduino uno connected to this Bluetooth module

http://www.lctech-inc.com/Hardware/Detail.aspx?id=684fb223-1a23-4b83-8dbd-4d58c2b3c0cb

this is the code i tried

Code:
char incomingByte;  // incoming data
int  LED = 13;      // LED pin
 
void setup() {
  Serial.begin(9600); // initialization
  pinMode(LED, OUTPUT);
  Serial.println("Press 1 to LED ON or 0 to LED OFF...");
}
 
void loop() {
  if (Serial.available() > 0) {  // if the data came
    incomingByte = Serial.read(); // read byte
    if(incomingByte == '0') {
       digitalWrite(LED, LOW);  // if 1, switch LED Off
       Serial.println("LED OFF. Press 1 to LED ON!");  // print message
    }
    if(incomingByte == '1') {
       digitalWrite(LED, HIGH); // if 0, switch LED on
       Serial.println("LED ON. Press 0 to LED OFF!");
    }
  }
}



iam using windows 8 ,,, i have the following problem :
the projects works fine while connecting the arduino via usb cable & the serial monitor works fine but when trying to connect via laptop bluetooth i got 2 serial ports " com 8 " for incoming ,,, "com 9" for outgoing & nothing happen ,,, i couldn't send or receive anything via the terminal

Logged

Dee Why NSW
Offline Offline
Edison Member
*
Karma: 30
Posts: 1671
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Have paired the arduino with the laptop?
Do you see flashing lights on the bluetooth module, and if so, what is the frequency?
What terminal pprogramme are you using on the laptop?

Logged

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

Have paired the arduino with the laptop?
Do you see flashing lights on the bluetooth module, and if so, what is the frequency?
What terminal pprogramme are you using on the laptop?




yes i have paired the arduino with my laptop & it shows 2 serial ports for the bluetooth

the lights on the bluetooth are flashing ,,, if you mean by frequency the baud rate it is " 9600 "

the terminal program is tera term  http://ttssh2.sourceforge.jp/
Logged

Dee Why NSW
Offline Offline
Edison Member
*
Karma: 30
Posts: 1671
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


the lights on the bluetooth are flashing ,,, if you mean by frequency the baud rate it is " 9600 "

the terminal program is tera term  

No I meant the led on the module. A slow flash 1hz meant it was working. A much faster flash just meant the power was on and it was idling. I use RealTerm and 9600 bd was fine.
« Last Edit: March 20, 2013, 10:28:48 pm by Nick_Pyner » Logged

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


the lights on the bluetooth are flashing ,,, if you mean by frequency the baud rate it is " 9600 "

the terminal program is tera term 

No I meant the led on the module. A slow flash 1hz meant it was working. A much faster flash just meant the power was on and it was idling. I use RealTerm and 9600 bd was fine.


the led on the bluetooth are flashing slow after pairing with laptop but still nothing on terminal
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 66
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

can your phone pair with the bt module? if so, can you control the arduino by inputting command from smartphone bt terminal?  I personally have been working on this module for 2 days, finally figured out how it works.
Logged

San Marino
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I have a similar problem with the same BT module.
When I try to pair it with my notebook (windows smiley-cool, the pair seems to be ok (because the led flash slow), but after few seconds, windows show an "offline" status (see attachment #1).
When I try to pair it with my smartphone (android 4.0.4, sony xperia u), the pair seems to be ok too, but when I try to connect with a terminal (blueterm), it show the error "unable to connect device". Same problem with amarino 2.0

any idea?

thank you


* bt01.png (67.33 KB, 1920x1080 - viewed 43 times.)
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 66
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

it is quite strange that with the same wiring and sketch, my bluetooth module works fine with my duemilanove, but not with the UNO. Then after days of digging, I found out that I have to use software serial library to get UNO and bluetooth to communicate, you can try if this work for you.

http://arduino.cc/en/Reference/SoftwareSerial

Code:
#include <SoftwareSerial.h>

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

void setup() 
{
  // Open serial communications and wait for port to open:
  Serial.begin(57600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }


  Serial.println("Goodnight moon!");

  // set the data rate for the SoftwareSerial port
  mySerial.begin(4800);
  mySerial.println("Hello, world?");
}

void loop() // run over and over
{
  if (mySerial.available())
    Serial.write(mySerial.read());
  if (Serial.available())
    mySerial.write(Serial.read());
}
Logged

San Marino
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you, but I already use that sketch...
Communication between Arduino and BT module is fine, the problem is that for some reason I can't understand, the BT module can't connect successfully after pairing with another device (pc or smartphone).
Logged

Dee Why NSW
Offline Offline
Edison Member
*
Karma: 30
Posts: 1671
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

These things can be a bit flakey.

My Arduinos talk perfectly to my laptop via bluetooth. It is the only communication I have with them at the moment.

My dumbphone can pair with Arduino but cannot do anything.

My Android tablet with BlueTerm can pair with Arduino but cannot do anything. That is very disappointing. I have not persued this as my laptop is fine and hardly less convenient than a tablet, and the tablet is really junk.

My desktop can see my phone and my tablet but cannot see the Arduinos.

In short, all the problems lie with the peripherals, not Arduino.

I fail to see the need to use software serial library to get UNO and bluetooth to communicate. I don't think anybody else does. I only use bluetooth for data aquisition, but no extra software of any sort is required to do this.
Logged

San Marino
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


I fail to see the need to use software serial library to get UNO and bluetooth to communicate. I don't think anybody else does. I only use bluetooth for data aquisition, but no extra software of any sort is required to do this.


I use SoftwareSerial  so I can get 2 serial port: from arduino to pc with usb and the other one form arduino to BT module.
In that way, when I set BT module in command mode, I can send AT commands from pc to bt using arduino as proxy because I don't a FTDI cable.
Logged

San Marino
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Now I can connect successfully from Windows 8! I achieved that installing Toshiba Bluetooth Stack from http://aps2.toshiba-tro.de/bluetooth/?page=download-toshiba (I read something about that somewhere on Internet).

But the problem is still present with my Android phone.
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 66
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


I fail to see the need to use software serial library to get UNO and bluetooth to communicate. I don't think anybody else does. I only use bluetooth for data aquisition, but no extra software of any sort is required to do this.


My UNO responses to BT only if i use the software serial library. I don't know why, but my duemilanove is okay without it. it's kind of strange.
Logged

San Marino
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Eventually I solved my second problem: it's my idiot-phone (Sony Xperia U)! Please don't buy it, it's the worst android phone I've evere seen!!
The HC-05 connect successfully with Samsung S2 and S Advance, so I need to change my phone to accomplish my project...
Logged

Pages: [1]   Go Up
Jump to: