Arduino Uno + Bluetooth Connectivity Issue

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:

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:

//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.

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

 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!

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 :slight_smile:

PS NI$HANT, i like your status thing under your pic :stuck_out_tongue:

Ya it will then also turn on.

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

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

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.

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?

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.

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.

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

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?

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) :slight_smile:

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

-m

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.

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.

mwittmer:
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" ?

If led blink all time that mean you dont have paired it. when paired led stop blinking .
in device manager you can see all modules connected, not current one

go bluetooth devices and do search to see if you can find module

is it's name linvor or hc05?
are you sure it is master?

I recorded a screenshare video this morning to show in a bit more detail some of the configuration I mention above.
Please let me know your thoughts.
http://michaelwittmer.com/wordpress/?cat=82

Also, I did uninstall all the drivers per dxw00d's suggestion. Issue still exists.

uk350,
How do I initiate the pairing?
My device shows listed in control panel and when I detected the bt device, I entered a pairing code which was gracefully accepted, but how to I initiate a "pair" once the device is installed?

I cant see any slave bt devices in device manager, i see only bt dongle and btcomports. maybe that is your btdongle driver/software thing.
i made dirty video for you how i make connection/pairing.
- YouTube (hope that doesnt break any rules here)
Once slave device is paired, i only need right click BT_AMEGA and click "connect serialport com10"
or if it's configured as "autoconnect", connection is made by software when needed.

if your module is configered as master i dont know if it can be paired.
if its master it must have HC05 firmware and it can be changed to slave by AT commands.

Thanks for the video. Very cool of you to take the time. I think it might help. What OS are you running? Some of your screens look quite different from mine but I'll see if I can recreate the steps somehow in Win7. If not, I have an XP machine I can try as well.

windows 7

if you cant see bluetooth icon in taskbar, try to find bt software somewhere from hard-disk(look image).