Go Down

Topic: Yun and bluetooth hc-05 (Read 2054 times) previous topic - next topic

MuhabAbuZeid

Hello, i'm trying to receive data from arduino lilypad to arduino yun using bluetooth, lilypad has hc-06 (slave) and arduino yun has hc-05 (master), i've read that yun is not compatible this type of bluetooth modules, is that true? and if it is not is there any way to solve this problem? please note that i tried to put hc-05 on arduino uno and it has received data perfectly, so the problem is with yun only. thanks in advance.

pert

Please post a link to where you read that.

I'm no expert on the Yun but the only possible problem I can think of for using an HC-05 with a Yun is that pins 0 and 1 on the Yun are used for communication between the ATmega32U4 and the Atheros module on the Yun. This just means you would need to use the SoftwareSerial library to create a serial port on some pins other than 0 and 1 and connect the HC-05 to those pins. Note that only certain pins on the Yun may be used for the software serial RX pin. These are the same as for the Leonardo, which is documented on the SoftwareSerial library's reference page:
https://www.arduino.cc/en/Reference/SoftwareSerial

MuhabAbuZeid

#2
Jun 17, 2019, 11:33 pm Last Edit: Jun 17, 2019, 11:36 pm by MuhabAbuZeid
I've used pins 0 and 1 as they are the ones specified for rx and tx, and also tried 1&2, of course along with softwareserial library and still nothing is working.

pert

You can't use pin 1 or 2 for the software serial RX pin on the Yun. It wouldn't make sense to use pin 1 anyway because this is used for communication with the Atheros module. The only pins you can use for RX are 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI). You can use any pin you like (other than 0 and 1) for the TX pin. Give software serial another try with the correct pins and see if it works.

MuhabAbuZeid

sorry i meant to say 2,3, but anyways i tried different combinations including analog pins, using Serial1 instead of Serial, still nothing happening

pert

sorry i meant to say 2,3, but anyways i tried different combinations including analog pins, using Serial1 instead of Serial, still nothing happening
Pin 2 can't be used as the SoftwareSerial RX pin either.

including analog pins
None of the analog pins can be used as the SoftwareSerial RX pin. Did you ever bother to try it using one of the allowed pins specified in my last reply and in the SoftwareSerial library documentation?

using Serial1 instead of Serial
Serial1 is pins 0 and 1. Those pins are used for communication between the ATmega32U4 and the Atheros module. I recommend against using those pins for any other purpose.


Go Up