Difficulty connecting bluetooth device

I don’t know if I have a problem with my computer, my software or my devices. I am trying to connect an HC-05 bluetooth device in order to communicate wirelessly with an RC car. I am operating Windows 10 and have installed a bluetooth dongle and its driver. I have observed a number of different results when I try to connect the HC-05 using Windows setup. Sometimes when I get to the Add a Device screen there is nothing listed. Sometimes it says Unknown Device and sometimes it says HC-05. Most of the time, however, there is nothing listed. When there is Unknown Device or HC-05 listed and I press Connect, I get a message along the lines of “Unable to connect” or “The device is not responding”.
Everything is plugged in and the device is inches away from the computer. I use the default PIN ‘1234’ when prompted. Notwithstanding the above, I have tried to upload the Arduino code; the code appears to update but reaches a point where the green indicator bar reaches the end and just stays there until I click on the serial monitor at which point I get the message “Error opening serial port COM5. (Port busy)”.

My setup looks more or less like this (resistor is 560 ohm; using 4 AA batteries):

(Oops. Maybe there should be a thread on why I can't copy an image to my post. :confused: )

This is the screen when I try to add the device using Windows Setup.

(Ditto. :confused: )

Add a device.GIF

HC-05 setup.GIF

RoscoBell:
Maybe there should be a thread on why I can't copy an image to my post.

See:
http://forum.arduino.cc/index.php?topic=364156

RoscoBell's pictures:
a759f7814ff5dfc57dcdc97f21ddf7bc0ba9cc4e.gif
7e62ea1937b566dc9ffc24c465df8d2620319e28.gif

RoscoBell:
My setup looks more or less like this

And, more or less, junk. God only knows how kosher it is to put 4xAA on the Arduino's 5v pin but, if you get rid of the resistor and connect bluetooth ground properly to ground like the sign on it says, it might actually work. As things are, it IS kosher to have 6v on bluetooth and, since Arduino is just a bystander, you can test for your Bluetooth<>Android connection with it disconnected.

Thanks for that. I was able to get my bluetooth paired to the computer but when I tried to upload to the board the sketch appears to update but eventually the green indicator bar reaches the end and just stays there. When I click on the serial monitor an error message appears "Error opening serial port (COMx) Port busy." There are three ports listed in Tools/Port/: COM5, COM6, and COM7. They all return an error message.

Arduino forum question2.pdf (50.8 KB)

when I tried to upload to the board the sketch appears to update but eventually the green indicator bar reaches the end and just stays there

When you download the program, you should disconnect the HC 05 from the hardware serial pins. Did you do that?

When you download the program, you should disconnect the HC 05 from the hardware serial pins. Did you do that?
[/quote]
Yes. The board is not connected to the hardware.

cattledog:

RoscoBell:
Thanks for that. I was able to get my bluetooth paired to the computer but when I tried to upload to the board the sketch appears to update but eventually the green indicator bar reaches the end and just stays there.

Please do this:

  • File > Preferences > Show verbose output during: > compilation (uncheck) > upload (check) > OK
  • Sketch > Upload
  • When the upload hangs, click on the black console window at the bottom of the Arduino IDE window.
  • On your keyboard, press Ctrl + A. This should select all text in the console window.
  • On your keyboard, press Ctrl + C. This copy the selected text to the clipboard.
  • Paste the error messages in a reply here USING CODE TAGS (</> button on the toolbar).

It is probably some procedural matter that will only happen once. The most common problem is having bluetooth on hardware serial while uploading as in reply#5, but there may be something else - at the PC end.

You might find the following background notes useful.

http://homepages.ihug.com.au/~npyner/Arduino/GUIDE_2BT.pdf
http://homepages.ihug.com.au/~npyner/Arduino/BT_2_WAY.ino

Sketch uses 5146 bytes (15%) of program storage space. Maximum is 32256 bytes.
Global variables use 348 bytes (16%) of dynamic memory, leaving 1700 bytes for local variables. Maximum is 2048 bytes.
C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -carduino -PCOM5 -b115200 -D -Uflash:w:C:\Users\Ross\AppData\Local\Temp\arduino_build_579169/RC_complete_1.ino.hex:i 

avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"

         Using Port                    : COM5
         Using Programmer              : arduino
         Overriding Baud Rate          : 115200

And it just hangs at that point forever?

Let me try that again.

Archiving built core (caching) in: C:\Users\Ross\AppData\Local\Temp\arduino_cache_127300\core\core_arduino_avr_uno_0c812875ac70eb4a9b385d8fb077f54c.a
Sketch uses 5146 bytes (15%) of program storage space. Maximum is 32256 bytes.
Global variables use 348 bytes (16%) of dynamic memory, leaving 1700 bytes for local variables. Maximum is 2048 bytes.
C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -carduino -PCOM5 -b115200 -D -Uflash:w:C:\Users\Ross\AppData\Local\Temp\arduino_build_870838/RC_complete_1.ino.hex:i 

avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"

         Using Port                    : COM5
         Using Programmer              : arduino
         Overriding Baud Rate          : 115200
An error occurred while uploading the sketch
Invalid library found in C:\Program Files (x86)\Arduino\libraries\Smart-Robot-Car-Arduino-master: C:\Program Files (x86)\Arduino\libraries\Smart-Robot-Car-Arduino-master
Invalid library found in C:\Users\Ross\Documents\Arduino\libraries\Circuit_0101: C:\Users\Ross\Documents\Arduino\libraries\Circuit_0101
Invalid library found in C:\Program Files (x86)\Arduino\libraries\Smart-Robot-Car-Arduino-master: C:\Program Files (x86)\Arduino\libraries\Smart-Robot-Car-Arduino-master
avrdude: ser_open(): can't open device "\\.\COM5": Access is denied.



avrdude done.  Thank you.

Invalid library found in C:\Users\Ross\Documents\Arduino\libraries\Circuit_0101: C:\Users\Ross\Documents\Arduino\libraries\Circuit_0101

If the first upload process hangs it will hold COM5 open so this error:

avrdude: ser_open(): can't open device "\\.\COM5": Access is denied.

may be a red herring.

If you restart your computer and then try uploading do you get the same output as in reply #8?

Try this:

  • With the Arduino board unplugged from the USB open the Tools > Port menu and note the listed ports. If the Port menu is gray and disabled then that means there are no ports available.
  • Close the Tools > Port menu.
  • Plug in the USB cable on the Arduino board
  • Wait a little while for the Arduino board to connect
  • Open Tools > Port, the new port on the list is your Arduino board. In some cases it will have the name of the board next to the port name but this doesn't happen with all boards.
  • Select your Arduino's port from the menu.

Note that the Tools > Port menu only updates when that menu is closed and then opened again. The Port menu won't automatically update while the menu is kept open.[/code]

When I plug the arduino into the USB port it lists COM4, COM5, COM6 and COM7 with COM4 being the one that is connecting. When I unplug the USB, it lists COM5, COM6 and COM7 whether the device is connected to the board or not. Uploading produces an error messages for each port.

Sketch uses 5146 bytes (15%) of program storage space. Maximum is 32256 bytes.
Global variables use 348 bytes (16%) of dynamic memory, leaving 1700 bytes for local variables. Maximum is 2048 bytes.
C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -carduino -PCOM6 -b115200 -D -Uflash:w:C:\Users\Ross\AppData\Local\Temp\arduino_build_784367/RC_complete_1.ino.hex:i 

avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"

         Using Port                    : COM6
         Using Programmer              : arduino
         Overriding Baud Rate          : 115200
avrdude: ser_open(): can't open device "\\.\COM6": The semaphore timeout period has expired.



avrdude done.  Thank you.

Problem uploading to board.  See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.
Invalid library found in C:\Program Files (x86)\Arduino\libraries\Smart-Robot-Car-Arduino-master: C:\Program Files (x86)\Arduino\libraries\Smart-Robot-Car-Arduino-master
Invalid library found in C:\Users\Ross\Documents\Arduino\libraries\Circuit_0101: C:\Users\Ross\Documents\Arduino\libraries\Circuit_0101
Invalid library found in C:\Program Files (x86)\Arduino\libraries\Smart-Robot-Car-Arduino-master: C:\Program Files (x86)\Arduino\libraries\Smart-Robot-Car-Arduino-master
Invalid library found in C:\Users\Ross\Documents\Arduino\libraries\Circuit_0101: C:\Users\Ross\Documents\Arduino\libraries\Circuit_0101
Error opening serial port 'COM6'. (Port busy)

RoscoBell:
When I plug the arduino into the USB port it lists COM4, COM5, COM6 and COM7 with COM4 being the one that is connecting. When I unplug the USB, it lists COM5, COM6 and COM7 whether the device is connected to the board or not.

Then it's clear your Arduino is on COM4.

So why the heck are you trying to upload to COM6?:

RoscoBell:

         Using Port                    : COM6

I am not sure what you are suggesting I do. What I want to do is to monitor my RC car wirelessly. I don't want to be tethered to the computer. But if I am not plugged in via USB i.e. COM4, the only ports listed as available are COM5, COM6, and COM7 which all return error messages. We still haven't solved my problem :disappointed_relieved:

RoscoBell:
I am not sure what you are suggesting I do. What I want to do is to monitor my RC car wirelessly. I don't want to be tethered to the computer. But if I am not plugged in via USB i.e. COM4, the only ports listed as available are COM5, COM6, and COM7 which all return error messages. We still haven't solved my problem :disappointed_relieved:

Fine.
That's not how you go about communicating between the Bluetooth dongle on your PC and your Arduino.

If you are using Windows 10, download and install Bluetooth Serial Terminal.
Pair your Bluetooth dongle with your HC-05.

Then you should be able to send and receive between your PC and the HC-05.

.

RoscoBell:
What I want to do is to monitor my RC car wirelessly.

If that's what this topic is about then why did you bring up the error you have when uploading to your board? That's the problem I was trying to help you with.

I apologise if I have mislead you about my problem. As I said in my original post, I don't know if I have a problem with my computer, my software or my device. All I know is that nothing I have tried has solved it. I have been able to get my bluetooth device paired with my computer but when I try to upload the sketch I get an error message. It happens regardless of which port I choose. I am assuming (perhaps mistakenly) that because my device is now paired with the computer that the problem lies elsewhere. Here is the text of the error message generated by Arduino:

Archiving built core (caching) in: C:\Users\Ross\AppData\Local\Temp\arduino_cache_733992\core\core_arduino_avr_uno_0c812875ac70eb4a9b385d8fb077f54c.a
Sketch uses 2932 bytes (9%) of program storage space. Maximum is 32256 bytes.
Global variables use 260 bytes (12%) of dynamic memory, leaving 1788 bytes for local variables. Maximum is 2048 bytes.
C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -carduino -PCOM5 -b115200 -D -Uflash:w:C:\Users\Ross\AppData\Local\Temp\arduino_build_315079/RC_lightseeking_sensors.ino.hex:i 

avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"

         Using Port                    : COM5
         Using Programmer              : arduino
         Overriding Baud Rate          : 115200
Error opening serial port 'COM5'. (Port busy)
Invalid library found in C:\Program Files (x86)\Arduino\libraries\Smart-Robot-Car-Arduino-master: C:\Program Files (x86)\Arduino\libraries\Smart-Robot-Car-Arduino-master
Invalid library found in C:\Users\Ross\Documents\Arduino\libraries\Circuit_0101: C:\Users\Ross\Documents\Arduino\libraries\Circuit_0101

Is there anything there that provides a clue as to why I can't upload the sketch?

Using Port                    : COM5

Then it's clear your Arduino is on COM4.

With the HC05 disconnected, what happens if you select COM4 using Tools>Port and try to load the program to the Arduino?

I have been able to get my bluetooth device paired with my computer but when I try to upload the sketch I get an error message

I hesitate to buy into this thread, it seems to be just circular nonsense, and now you seem to want to upload your sketch via bluetooth - another diversion somewhat unrelated to RC cars. Since you are having so much grief, you might try using bluetooth with a phone. It seems to be a lot easier - no grey areas about ports etc. and leave the IDE and uploading to the PC - by cable.
IF you mean you have difficulty uploading in the normal manner AND bluetooth is on hardware serial, disconnect it and try again.