Hi all
I just got a JY-MCU Bluetooth module and I am using Arduino Uno and Mac bluetooth setup assistant . My mac can find the bluetooth with the name HC-06.
but I am having problems pairing it.
Any idea what could go wrong?
Jim
Hi all
I just got a JY-MCU Bluetooth module and I am using Arduino Uno and Mac bluetooth setup assistant . My mac can find the bluetooth with the name HC-06.
but I am having problems pairing it.
Any idea what could go wrong?
Jim
update:
after trying to pair many many times, somehow it is finally connected .... (strange)
I have a piece of very simple code loaded to uno (see below).
I then select serial port: dev/tty.HC-06-DevB [my bluetooh name is HC-06]
When I try to launch the serial monitor, I got an error saying that the serial port already in use. I am pretty sure it is not in use..... any idea what may have gone wrong?
void setup() {
// initialize serial:
Serial.begin(9600);
// initialize the led pin
pinMode(13, OUTPUT);
}
void loop() {
while (Serial.available()) {
char inChar = (char)Serial.read();
switch(inChar) {
case '1':
digitalWrite(13, HIGH);
break;
case '0':
digitalWrite(13, LOW);
break;
}
Serial.println(inChar);
}
}
after further testing, it appears that although the pairing is successful, the bluetooth module is unable to connect (the red light is still blinking instead of turning solid)!
any idea why?? thanks!
I understand your problem is summed up with one word - Macintosh.
On the matter of port being in use, I think you are using the bluetooth at the same time as the serial monitor, thereby being in conflict, and apparently this applies even if you are not actually succeeding in communicating via blue tooth. It is possible to connect via USB serial to a PC simultaneously with a laptop via bluetooth, but not via both to the same.
thanks for the reply, Nick_Pyner
I tried to connect my arduino to a PC laptop via USB, and used Mac to connect with it via bluetooth. It still did not work! ![]()
You didn't say how you have the bluetooth module wired to the arduino. If you have it wired to D0 and D1 (bluetooth Rx to arduino Tx, and bluetooth Tx to arduino Rx) then you cannot use the serial monitor while connected to the module.
If you have the module wired to other pins on the arduino, your code needs to use the software serial library. In that case, you can use the serial monitor.
-transfinite
jimbbq:
I tried to connect my arduino to a PC laptop via USB, and used Mac to connect with it via bluetooth. It still did not work!
Aha! In that event read the first line of my previous again. Then ( assuming that you can do this OK!) connect the Mac via USB cable and then try bluetooth connect to the real computer. This might not realise your ultimate goal but might work, thereby proving there is nothing fundamentally wrong with your arduino stuff or the programming, and you just suffer from a bad choice of hardware at the other end.
Note that I believe the fact that the HC-06 is findable only indicates that it is healthy and ready to go. It does not even need to be connected to Arduino. So you might recheck the the signal connections rx to tx and tx to rx.
Note also that pairing is not the same as use. The bluetooth interface on the PC establishes the pairing, and the terminal programme expedites the use, steady light.
I'm running a bunch of Macs here and bluetooth is pretty simple stuff.
I use SoftwareSerial pins 2&3 in the sketch for the Bluetooth module. I'm using HC-05's because they can be either master or slave.
With SoftwareSerial the standard serial.print() works via the USB cable in the Arduino IDE and you can use CoolTerm for the Mac to connect to the Bluetooth module. Thus it's pretty easy to watch for incoming data on the bluetooth stream and just echo that out the USB connection for the IDE monitor.
The hardest thing to find is the serial port rate default of the bluetooth module but that's about it for difficulty.
Oh for pairing, the Mac uses the default password of "0000". A lot of bluetooth modules use something different like "1234". If you don't get the password right, they'll never pair up.
Mel
Dear all
thanks a lot for your replies. Let me explain more fully what I did...
the connection between my bluetooth and Uno is as follow:
Vcc -> 5V on Uno
Gnd -> Gnd on Uno
TXD -> RX on Uno
RXD -> TX on Uno
Then I had USB connected to Mac to power it. (In fact I even tried powering the uno with 9V battery , but the result was similar)
The code was pre-loaded to Uno before I tried to pair it.
First of all, the bluetooth module was blinking red, and the mac could instantly find the module.
it took many attempts just to pair it. Usually 2 failed attempts, before Mac allowed me to change the passcode (which I did change to 1234), and after passcode change, 2-3 more attempts to finally pair up. (sometimes it did not pair up at all)
Once it was paired, I tried to launch my serial monitor, and I got the error "dev/tty.HC-06-DevB "
I did try to restart the computer, turn bluetooth on and off, unplug and plug uno, etc.
Actually yesterday evening, I managed to open the serial monitor two times and send data to uno via dev/tty.HC-06-DevB port. But that was it. It stopped working and I still haven't had any success since then.
It is very strange, perhaps the hardware is broken?
I really appreciate your help!
Jim
I don't think the hardware is broken at all. Let's see the sketch you are using on the UNO.
jimbbq:
Vcc -> 5V on Uno
Gnd -> Gnd on Uno
TXD -> RX on Uno
RXD -> TX on UnoThen I had USB connected to Mac to power it. (In fact I even tried powering the uno with 9V battery , but the result was similar)
The code was pre-loaded to Uno before I tried to pair it.
First of all, the bluetooth module was blinking red, and the mac could instantly find the module.
Once it was paired, I tried to launch my serial monitor, and I got the error "dev/tty.HC-06-DevB "
It is very strange, perhaps the hardware is broken?
I don't understand the error code you quote, I guess it is something to do with macintosh, but I don't think there here is anything to suggest the hardware is broken and there is nothing wrong with the four connections either. You might try proving this by just using the PC laptop with RealTerm and the code below on Uno. Needless to say, the terminal has to be set to 9600, and disconnect the USB cable.
void setup()
{
Serial.begin(9600);
Serial.println("OK then, you first, say something.....");
Serial.println("Go on, type and hit Send, or just hit the Enter key");
}
void loop()
{
while(Serial.available()==0)
{}
delay(500);
Serial.println("I heard you say: ");
while(Serial.available()>0)
{
Serial.write(Serial.read());// note it is Serial.WRITE
}
Serial.println("");
}
dear all
it so happened that another person in the lab has the same bluetooth module and it worked with my code and set up....
so my bluetooth is BROKEN!
Thanks for your time to help!
Jim
Hi ...
I'm having the same issues described in this post.
Using virtually same setup (MacBook Pro, Arduino Mega 2560 R3 and Hc-06).
I can detect HC-06 but on establishing connection I can't send AT commands nor get any response, and the red led keeps blinking.
I've used Arduino IDE, CoolTerm and Screen and an FTDI serial adapter (with drivers installed) to no avail.
Did you confirm the bluetooth module was defective? Did you manage to make it work with the same setup and another HC-06 module?
Best,
H.
henser:
Hi ...I'm having the same issues described in this post.
Using virtually same setup (MacBook Pro, Arduino Mega 2560 R3 and Hc-06).
I can detect HC-06 but on establishing connection I can't send AT commands nor get any response, and the red led keeps blinking.
I've used Arduino IDE, CoolTerm and Screen and an FTDI serial adapter (with drivers installed) to no avail.
Did you confirm the bluetooth module was defective? Did you manage to make it work with the same setup and another HC-06 module?
I believe the OP was using an HC-05, not an HC-06. The HC-06 uses a slightly different AT protocol (no CR/LF required). Still 9600, 8, N, 1 from the serial port for the commands though so you can't have it connected via Bluetooth at that time.
BTW I've had a whack of serial port issues with FTDI serial interfaces. I use the USB to Serial CP2102 based units now (sometimes labeled as CP2102 breakout boards). When I program the HC-05 these are the connections I use.

I also have an HC-06, Mac, and Yun, and I'm having similar issues.
Plug in the Arduino to my computer to power it and the HC-06 starts blinking quickly. It does emit RF seeing as the computer recognizes it as "HC-06" when setting up a new Bluetooth device. 1234 allows the devices to pair, but my computer shows its status as "not connected" and the blinking continues.
UPDATE, I got it randomly connected and CoolTerm shows that it is connected. When I type, tx, then rx, lights up. The light on the module is solid, but when I select the module as my serial port and attempt to look at the serial monitor I get this error message back
"Error opening serial port '/dev/tty.HC-06-DevB'."
RTS, DTR, and DCD lights are on in CoolTerm. Did anyone ever figure this out?
CPME:
UPDATE, I got it randomly connected and CoolTerm shows that it is connected. When I type, tx, then rx, lights up. The light on the module is solid, but when I select the module as my serial port and attempt to look at the serial monitor I get this error message back"Error opening serial port '/dev/tty.HC-06-DevB'."
RTS, DTR, and DCD lights are on in CoolTerm. Did anyone ever figure this out?
I only connect to my HC05's via my own custom written apps, or Coolterm. I use the IDE strictly for USB, even though the HC"s show up in the ports listing. The serial port in the IDE doesn't have all the additional items for serial port control that Coolterm does. I've never tried it but I don't think you can have both Coolterm and the IDE connected to an HC at the same time.
I confronted a similar problem that is the Bluetooth HC-05 not pairing with my Macbook. After many of struggling, I magically paired it with my Mac. The method is that I turn the "Allow apps downloaded from" to Anywhere under Security & Privacy, and then tried to restart the computer. After this, the Bluetooth is paired up. The connection is that the HC-05 connected to UART to USB board (without any Arduino board) then to a PC for power up. On the other side, the Macbook communicates with the Bluetooth HC-05 wirelessly. I have not tried sending any data, but I will.
I have now the HC-06 bluetooth
Mac el capitan and led quick blinking,can pairing,but while a moment ,it's gone???
who can help me???
With a JY-MCU board, or any similar, quick blinking does not indicate pairing, it indicates ready to pair, or ready to connect. If the LED goes out, it may be indicating that the conenction has been established, but I am not aware of this with the JY-MCU board.