HC-05 Bluetooth not supported on Yun ?!

THE PROBLEM: Somehow I can't find any working code or sketch for the Yun to program (or pair) the HC-05... Also the IDE of the Yun seems to be not supported... (Would be great if we could solve this issue with a Mac, but I can use a PC too, if necessary)

What I want to do: I bought two HC-05 Bluetooth-Modules (presoldered) and want to use them to connect two arduinos (YUN with UNO r3). The UNO shall measure temperature data and send it over to the YUN ( I need the temperature as a variable on the yun).

Here are some websites I already was looking into, but non helped... seems like nobody ever tried to make Bluetooth work on the Yun ...

http://forum.arduino.cc/index.php/topic,177125.0.html http://forum.arduino.cc/index.php?topic=212373.0 http://www.youtube.com/watch?v=35tQBdpNXH0 http://arduino-hannover.de/2013/07/20/bluetooth-kochbuch-fur-arduino/#more-267 ... ... ...

I currently connected the HC-05 with the Yun this way (and my Mac already paired with it once, but now the module is only blinking fastly):

[HC-05] : [YUN] VCC : 3,3 V GND : GND TXD : RX RXD : TX

I currently didn't connect KEY and LED/STATE with the Yun, as I first wanted to look for a sketch and a solution for the IDE-Problem and I'm not sure if they need to be connected all the time (or only during programming)

Really, no one? These modules (hc-05 and 06) are so commonly used with all kinds of arduinos ... There must be a solution for using them with the yun :(

It does not matter what type of platform you are going to use with HC-05 provided it has got rx/tx serial wires. The baudrate and password has to match in order to pair it. HC-05/06 behaves as a "transparent serial".

But which code/sketch (thats compatible with IDE 1.5.6_r2 and the Yun) do I use?!

I already tried e.g. this code:

void setup() {
  // put your setup code here, to run once:
Serial1.begin(9600); // <<< here should be 38400 to program the HC-05, afaik. But there is no 38400-option in the serial
Serial.begin(9600);  // <<< here should be 38400 to program the HC-05, afaik. But there is no 38400-option in the serial
}

void loop() {
  // put your main code here, to run repeatedly: 
  if(Serial1.available())
  {
    byte a=Serial1.read();
    Serial.write(a);
  }
  if(Serial.available())
  {
    byte a=Serial.read();
    Serial1.write(a);
  }
}

But after entering “AT” in the serial (9600 baud + “Both NL & CR”) I only get a weired " 'U " back… (instead of an “OK”)… See picture in the attachment. I also tried Serial1.begin(38400); instead of Serial1.begin(9600); in the void setup() … no luck

EDIT:
Now I connected KEY with 3,3 V on the Yun and VCC with 5V on the Yun. With the code mentioned above I now get a lot more weired characters…but entering “AT” still won’t return “OK”.

EDIT2:
Somehow now I get an “OK” but with some strange characters infront of it (" øU?OK " )
… guess its because of the baudrate?! I use Serial1.begin(38400); instead of Serial1.begin(9600); in the void setup() and still Serial.begin(9600);. Now the LED of the HC-05 blinks slowly

Do not mess with sketches when you want setup the HC-05 via the AT command. Connect the HC-05 to serial (ie via an FT232), open the windoze Terminal, setup Terminal as required (see the HC-05 guide) and do simply the setup. Mind the HC-05 is a 3.3V device.

In case if you need Bluetooth 4.0 support ( HC-05 Bluetooth is BT 2.0 device):

http://forum.arduino.cc/index.php?topic=219682.msg1601424#msg1601424

Do you know if that 4.0-module is backwards-compatible to BL 2.0? I ask because this way I could continue to use my HC-05(s) with UNO(s) and use the BL4.0-USB-module with the YUN.


NEW QUESTION REGARDING HC-05:
I managed to connect my two arduinos (UNO and YUN) with eachother over bluetooth
(UNO with HC-05 is slave, YUN with HC-05 is master).
Now I’m searching for a way to send a FLOAT (or even better: a txt-file) from UNO to YUN.
How can I do this?!



FOR EVERYONE WHO IS ALSO TRYING TO CONNECT HC-05 HERE IS MY CURRENT CODE AND SOME TIPS FOR WIRING:

YUN:

void setup() {
  // put your setup code here, to run once:
Serial1.begin(38400);
Serial.begin(38400);

}

void loop() {
  // put your main code here, to run repeatedly: 
  if(Serial1.available())
  {
    byte a=Serial1.read();
    Serial.write(a);
  }
  if(Serial.available())
  {
    byte a = Serial.read();
    Serial1.write(a);
  }
}

The YUN is connected (during AT-Command-programming in serial) this way:
VCC and KEY to 3.3V (yes, both to 3.3V; use a breadboard; connect this way BEFORE you plug the Yun to the USB of your computer)
GND:GND
DRX: TX
DTX: RX

After you set up the Yun as a MASTER (see HC-05 datasheets for commands), you simply disconnect KEY from 3,3V.

UNO:

#include <SoftwareSerial.h>
 
SoftwareSerial mySerial(10, 11); // RX, TX
 
void setup()
{
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
//  while (!Serial) {
//    ; // wait for serial port to connect. Needed for Leonardo only
//  }
 
  Serial.println("Ready!");
 
  // set the data rate for the SoftwareSerial port
 
  // for HC-05 use 38400 when poerwing with KEY/STATE set to HIGH on power on
  mySerial.begin(38400); // 38400 necessary for programming-mode; Maybe if you set this to 9600 after configuring everything you might not need to disconnect the KEY-Pin from 3.3V
}
 
void loop() // run over and over
{
  if (mySerial.available())
    Serial.write(mySerial.read());
  if (Serial.available())
    mySerial.write(Serial.read());
}

The UNO is connected (during AT-Command-programming in serial) this way:
VCC and KEY to 3.3V (yes, both to 3,3V; use a breadboard; but connect VCC only AFTER you plugged in the USB to the computer to enter AT-Command-Mode)
GND:GND
DRX: D11
DTX: D10

After configuring the UNO in the serial (via AT-Commands, see datasheet HC-05) as a SLAVE etc. etc., you only need to disconnect KEY from 3.3V.

Here is also another helpful website:
http://www.comm2excel.com/projects/bluetooth_AT_Commands.php?id=17

Do you know if that 4.0-module is backwards-compatible to BL 2.0? I ask because this way I could continue to use my HC-05(s) with UNO(s) and use the BL4.0-USB-module with the YUN.

They are backward compatible.

Comparison of Bluetooth Different Versions

Thanks!

Now I'm searching for a way to send a FLOAT (or even better: a txt-file) from the UNO to the YUN.

Does anyone basically know how to send anything from one arduino to another over bluetooth ? I couldn't find a sketch for that

After hours and hours (actually: 2 days...) I managed to solve most of the issues on my own (or lets say: I was left on my own) and was finally successful:

  1. As already mentioned: I connected the YUN and UNO successfully with the HC-05 bluetooth modules
  2. I can now send a float from the Uno DIRECTLY to the Yun without any issues (Yun gets the float as a variable)
  3. I can now send floats (or Strings or ...) from one Arduinos Serial Monitor to the other Arduinos Serial Monitor over Bluetooth

This way I managed to send Temperature-Data from the UNO to the YUN. Then the YUN processes them, sends them to the internet, shows them on a LCD, ...

I know that my problems were very specific, thats why not too many could help me. Nevertheless: Thanks for at least leading me in the right direction!