Pages: [1] 2 3   Go Down
Author Topic: Arduino Uno + Bluetooth Connectivity Issue  (Read 19183 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 1
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I would really appreciate some assistance in troubleshooting this pesky issue I'm having....

Some background:
I have the latest rev of Uno and a JY-MCU Bluetooth module and am having an issue getting simple communication going.  I have a Windows 7 setup.  My PC indicated Com10 as the COM port for my USB Bluetooth dongle (I've tried 2 separate dongles).
I have an LED connected to port 8 on the Arduino and ground.  The BT is connected to TX, RX, 5v, and Gnd on the Arduino.
The PC is paired to the Bluetooth module.

The Goal:
The basic goal is to send a 'H' or 'L' to the Arduino via BT to toggle the LED (similar to the standard sample code floating around which I used as a starting point)

The Problem:
I can upload the code to the Arduino - no issue there.  But, nothing visible happens when I run the Processing code.  The LED on the Arduino does not change states.  It works when connected to the PC via USB but not when running over Bluetooth.

Here's my arduino code:
Code:
char value;
int ledpin = 8;
void setup() {
  pinMode(ledpin, OUTPUT);         // set ledpin to Output mode
  Serial.begin(9600);              // make sure processing code baud rate matches
  digitalWrite(ledpin, LOW);       // start with the LED off
}
void loop() {
  if( Serial.available() )         // check for serial data
  {
    value = Serial.read();         // load data into 'value' variable
  }
  if( value == 'H' )               // if 'H' was received
  {
    digitalWrite(ledpin, LOW);     // turn ON the LED
  } else {
    digitalWrite(ledpin, HIGH);    // otherwise turn it OFF
  }
  delay(100);                      // wait 100ms for next reading
}

Here is my Processing code:
Code:
//Processing code
import processing.serial.*;

void setup() {
  println(Serial.list());
  Serial port = new Serial(this, Serial.list()[2], 9600);
  port.write('L');
  delay(5000);
  port.write('H');
  delay(5000);
  port.write('L');
  delay(5000);
  port.write('H');
}

Once site I visited indicated that my Bluetooth module was a Master only.  I'm not sure if this is a factor, but wanted to mention it in case it is.

Any help would be greatly appreciated.
Logged

Offline Offline
Sr. Member
****
Karma: 1
Posts: 486
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

make sure your bluetooth is paired correctly in windows(seems like it is).

your BT doesnt default to 9600 baud:
The on-board serial communication between the bluetooth module and the Arduino sketch (running on the ATmega168) needs to be at 115200 baud (i.e. call Serial.begin(115200) in your setup() function). Communication between the bluetooth module and the computer can be at any baud rate. from http://arduino.cc/en/Guide/ArduinoBT

everything else seems OK
Logged

http://dduino.blogspot.com all my Arduino/electronic projects!!!

{NEW} Getting Started, Learning, Reference + FAQ PDF!!:
[url]http://ar

ਪੰਜਾਬ
Offline Offline
Edison Member
*
Karma: 12
Posts: 1601
Another year! Alone! :(
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
if( value == 'H' )               // if 'H' was received
  {
    digitalWrite(ledpin, LOW);     // turn ON the LED
  } else {

You are doing the pin LOW where you want to turn the LED on that's why!
Logged

"Real Men can Accomplish  Anything"
-  Website  
- skype : nishants5  

ਫ਼ਤੇਹ ਕਰੂਂ !

Offline Offline
Sr. Member
****
Karma: 1
Posts: 486
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

yes he did have it backwards, but in the else he has it set to HIGH, so it would still turn on, just not when he expected it to. But yes, part of the issue smiley

PS NI$HANT, i like your status thing under your pic smiley-razz
« Last Edit: March 23, 2012, 01:17:32 pm by sirbow2 » Logged

http://dduino.blogspot.com all my Arduino/electronic projects!!!

{NEW} Getting Started, Learning, Reference + FAQ PDF!!:
[url]http://ar

ਪੰਜਾਬ
Offline Offline
Edison Member
*
Karma: 12
Posts: 1601
Another year! Alone! :(
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Ya it will then also turn on.
Logged

"Real Men can Accomplish  Anything"
-  Website  
- skype : nishants5  

ਫ਼ਤੇਹ ਕਰੂਂ !

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

NI$HANT,
You are right, I do have them backwards but on purpose.  My mistake, I should have mentioned that.  I simply wanted to start with the LED on and then toggle it off for testing, but I failed to update the comment.  At any rate, it should toggle either way. 

Sirbow2,
Thanks for the baud rate tip...I will look into that now. 

You guys rock!

Thanks,
Mike
Logged

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

I updated the baud rate in the sketch to 115200 but it still doesn't work. 

Regarding the other suggestion, I'm not exactly sure how to confirm my Windows 7 is "Paired" with the Bluetooth module. 

In Control Panel > Devices and Printers, I do see the Arduino, but when I right click it and go to Properties > Hardware, I see Standard Serial over Bluetooth Link (Com9) listed in the Device Functions box.  The issue here is, in my Processing code, Serial.List() does not return Com9. 

I performed a Windows "Troubleshoot" operation on the Bluetooth device but it returned no issues found.

In Device Manager, Under Ports (Com & LPT), I have Com1, Standard Serial over Bluetooth Link (Com9), and Standard Serial over Bluetooth Link (Com10).

So, it looks like I have two serial ports assigned to Bluetooth but only one of these 2 is returned with the Serial.List() function (com1 is also returned).

On a side note, the Bluetooth module has a red LED which doesn't stop flashing. 

Should I expect the flashing to stop at some point if things are working properly?

Is it possible this isn't going to work because my bluetooth module is "Master-Only" ?

Sorry for all the questions.

Thanks,
Mike
Logged

Offline Offline
Sr. Member
****
Karma: 1
Posts: 486
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i cant know exactly because im not at your computer, and ive never done Bluetooth with win7. but it sound as if the computer Bluetooth and Arduino Bluetooth are not syncing correctly.
Logged

http://dduino.blogspot.com all my Arduino/electronic projects!!!

{NEW} Getting Started, Learning, Reference + FAQ PDF!!:
[url]http://ar

ਪੰਜਾਬ
Offline Offline
Edison Member
*
Karma: 12
Posts: 1601
Another year! Alone! :(
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
In Device Manager, Under Ports (Com & LPT), I have Com1, Standard Serial over Bluetooth Link (Com9), and Standard Serial over Bluetooth Link (Com10).

Does your computer has an Inbuilt bluetooth module?

Quote
So, it looks like I have two serial ports assigned to Bluetooth but only one of these 2 is returned with the Serial.List() function (com1 is also returned).

What is the other com# out of the 2 serial ports ? one is com1 and the other is........?
I suspect here that there may be a deadlock and two services working over one single port.

Logged

"Real Men can Accomplish  Anything"
-  Website  
- skype : nishants5  

ਫ਼ਤੇਹ ਕਰੂਂ !

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

My PC doesn't have in integrated Bluetooth. 

After disabling my on board serial port, I only have Com1 and Com10 returned by Serial.List()

Device manager shows 2 Bluetooth devices.  One on Com9 and one on Com10.

Since my last post, I have installed the arduino software on Windows XP and the same issue is present there.  The only difference is, several COM ports are listed, but not both Bluetooth COM ports.

Additionally, I purchased a bluetooth shield and it is suffering from the same error.  So, this seems to be a system side issue but not specific to 1 PC or a specific bluetooth module.  I have an Ubuntu system as well, but haven't tried it yet because I'm not sure how easy I'll be able to find compatible bluetooth drivers for either one of my dongles.
Logged

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

I'm not sure if it is permitted to post links on this forum, but in case it is permitted, i have documented my struggles in a fairly detailed manner here: http://michaelwittmer.com/wordpress/?p=621
Logged

ਪੰਜਾਬ
Offline Offline
Edison Member
*
Karma: 12
Posts: 1601
Another year! Alone! :(
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Device manager shows 2 Bluetooth devices.  One on Com9 and one on Com10.

2 Com ports returning the same Bluetooth Device?

It should not be like this there must be only one com# port for one Bluetooth dongle connected, as such uninstall and reinstall the Bluetooth dongle software on PC.
Under which heading those both 2 com# ports are listed?
Logged

"Real Men can Accomplish  Anything"
-  Website  
- skype : nishants5  

ਫ਼ਤੇਹ ਕਰੂਂ !

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

>>Under which heading those both 2 com# ports are listed?
In device manager under COM Ports, I have:
   Communications Port (COM1)
   Standard Serial Over Bluetooth (COM10)
   Standard Serial Over Bluetooth (COM9)

>>2 Com ports returning the same Bluetooth Device?
Yes.  I have confirmed when I remove the IOGear dongle, both the BT ports disappear from Device Manager.

>>It should not be like this there must be only one com# port for one Bluetooth dongle connected, as such uninstall and reinstall the Bluetooth dongle software on PC.
I have done this.  I agree it is strange.  I thought this may be a due to my having installed the Actiontech drivers 1st and then the IOGear drivers later (on Win7), but I was very surprised to have the same behavior on a fresh Windows XP system with only the IOGear Bluetooth dongle installed.

Just a little background.  I have been in IT for over 20 years and have an EE, so I'm not a noobie when it comes to the PC, but I am very new to Arduino and of course this BT connectivity.  I hope this doesn't come across like boasting - I only mention this to clarify I do know what I'm doing (to some degree) smiley

I really appreciate you sticking with me here.  Thank you.

-m
Logged

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 21
Posts: 3113
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Might be worth getting rid of one set of drivers. Or wiping both, and just reinstalling the appropriate one. Windows second biggest problem is hardware drivers.
Logged

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

I can see that, but when I installed Windows XP fresh (on a blank hard drive) and only the IOGear BT Dongle, that is essentially what I did.
Logged

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