Pair Bluetooth USB Dongle with HC-05

I already commented on a thread about this topic in the YUN-section (http://forum.arduino.cc/index.php?topic=219682.0 ), but somehow no one over there is interested in making a bluetooth 4.0 usb-module work properly with the Yun. Thats why I'd like to ask you guys.

I've bought this module (IOGEAR GBU521W6): http://www.amazon.de/gp/product/B007ZT2AXE/ref=oh_details_o01_s00_i00?ie=UTF8&psc=1

..because: 1. its compatible with the Yun, as you can read on this site: http://fibasile.github.io/arduino-yun-ibeacon.html 2. I want more than one bluetooth device connected to the yun (!!) +I want to free sketch space (by using the linino)+ free pins on my YUN (currently occupied by my HC-05 on the Yun; Connection to a UNO which also has a HC-05) + save space and money (imagine 3-4 hc-05 hooked up to the yun)+ ... so that dongle would be perfect

I installed it this way: http://wiki.openwrt.org/doc/howto/usb.bluetooth

And it really works up to a certain degree: hcitools and hciconfig inquire/scan properly, find other devices etc., my android phone pairs with it (not the other way round...the phone has to start the pairing, else it won't work)......

But I don't know how to pair the HC-05 to it..., because the connection command hcitools cc XX:XX:XX:XX:XX doesn't work... it always returns nothing with the HC-05... and it always runs into the timeout with my phone...

I already set a HC-05 to "slave" and to 9600,1,0 and followed the steps to connect a dongle as it is described here (for raspberry): http://myraspberryandme.wordpress.com/2013/11/20/bluetooth-serial-communication-with-hc-05/

I thought it might be because of the passkey so I created the necessary pincode-file with echo "xx:xx:xx:xx:xx 1234" >> /var/lib/bluetooth/yy:yy:yy:yy:yy:yy/pincodes...but still no luck

Good news!
I managed to make the USB-dongle compatible, paired it successfully and I managed to open up a port ( /dev/rfcomm1 ) between the Dongle and the pairing partner (HC-05)! And I managed to send “something” from the usb-bluetooth-dongle (@ YUN) to the HC-05 (@ UNO) …

Currently I’m trying to send a “4” (digit) from the YUN to the UNO with these commands…

echo 4 > /dev/rfcomm1
echo '4' > /dev/rfcomm1
echo "4" > /dev/rfcomm1
echo 52 > /dev/rfcomm1   ## 52 is the ASCII-representation of the digit 4
echo  "52" > /dev/rfcomm1
echo '52' > /dev/rfcomm1
echo '00110100' > /dev/rfcomm1
echo "00110100" > /dev/rfcomm1
printf '00110100' > /dev/rfcomm1
or 
echo -e '4' > /dev/rfcomm1
...etc...
or
echo -n '4' > /dev/rfcomm1
...etc...
or 
echo -en '4' > /dev/rfcomm1
...etc...

…but non of them works correctly… sadly all the UNO receives are 8 zeros. Here is my sketch for the UNO (currently there is NO sketch on the YUN, because its not necessary…all we need is the linino (for bluetooth) if we make this work :slight_smile: :

#include <LiquidCrystal.h>
#include <SoftwareSerial.h>// import the serial library
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
SoftwareSerial mySerial(9, 10); // DTX Pin of HC-05 to Pin 9 (=SoftSerial RX) of UNO and DRX to Pin 10 (=SoftSerial TX)

//byte c; // << tried that too...
char c;

void setup() {
  mySerial.begin(115200);
  lcd.begin(16, 2);
}

void loop() {

  lcd.clear();

  delay(500);
  if (mySerial.available() > 0) {
    c = mySerial.read();

       // DEBUGGING: TO SEE ON LCD WHAT WAS RECEIVED
        lcd.setCursor(0, 1);
          lcd.print(c);
          delay(900);

  }
}

My sketch works fine if two HC-05 communicate with eachother… but I don’t know how to find out what the bluetooth-dongle is actually sending when I send the digit “4” with it…

EDIT:
Sending with the Dongle to the HC-05 is working fine now!
Now I just need to figure out how to receive with the dongle when the HC-05 sends something