How to Connect HC-05 to Windows 10/11 & Mac Apple Computer? How to Add Wireless Connections to Arduino Easy and Simple

by square1a in Circuits > Wireless

8147 Views, 9 Favorites, 0 Comments

How to Connect HC-05 to Windows 10/11 & Mac Apple Computer? How to Add Wireless Connections to Arduino Easy and Simple

cover2.PNG

HC-05 is a very simple and easy way to add wireless connection to your Arduino project. If you are having issues, check out Step 3 first. You do not even need to import a library to Arduino, since HC-05 uses the build-in Serial object and serial monitor for passing data wirelessly. This project uses HC-05 to connect an Arduino board to laptop, not Arduino board to another Arduino board.

Table of contents:

  1. video demo
  2. How Does HC-05 Work?
  3. Fixing Common Problems

Supplies

supplies.PNG
  1. HC-05
  2. 7 to 12 Volts battery supply*
  3. Arduino UNO + upload USB cable
  4. Jumper wires
  5. battery holder/9V battery cap
  6. Windows 10/11 or Mac/Apple computer

*There are other ways to power the Arduino besides using Vin pin. But do not use a computer USB port to power it, since the computer will send data (not just power to Arduino) interfering with HC-05 data transmission.

Watch the Video

How to Connect HC-05 to Windows 10/11 & Mac Apple Computer

Watch the video above. The code used in the video is attached below as "HC-05.ino". The circuit diagrams are available in Step 2.

If you have any troubles, go to Step 3: Fixing Common Problems. If it works, please leave a comment at the end of this page, so I can get an idea of how reliable HC-05 is. Part of the reason for me doing this project, is to find a reliable wireless communication module for Arduino projects, since the widely-used NRF2401L is plagued with defects and cheap clones. Your comment and feedback would be valuable.

I used HC-05 in another project: https://www.instructables.com/How-to-Make-a-Robot-Car-Drive-Straight-and-Turn-Ex/

Downloads

Wire It Up

bluetooth connect circuit.PNG
uploading circuit.PNG

The circuit diagrams are shown above. Click on them to enlarge them. You need to have two different circuits for this project, because HC-05 uses UART serial communication, which is supported by USART TX and RX pins on the Arduino. UART only allows a pair of serial devices to communicate, so Arduino with HC-05 or Arduino with computer USB port, but not all three of them together. In the project, the computer uploads code to Arduino board via a USB cable; Arduino board sends information via its Serial.print()* to HC-05 then to the serial monitor on the computer.

For UART to work, both the transmitter and receiver need to have same configurations: baud rate, start, stop and parity bit. HC-05's default setting is typically the same as Arduino's default setting, so most times you do not need to worry about configuration, if you use 9600 as the baud rate on the Arduino. I have also attached HC-05's datasheet below, which is optional and content heavy.

*You can also use Serial.write() and Serial.read(). For more information: https://www.arduino.cc/reference/en/language/functions/communication/serial/

Fixing Common Problems

baud rate.PNG
  1. Ensure that serial monitor's baud rate is the same as the baud rate specified at Serial.begin(). I suggest using 9600 for baud rate (see photo above)
  2. The battery' voltage to Arduino's Vin pin need be strictly 7 to 12 volts, otherwise the board is unstable. Check with a multi-meter or voltmeter, while battery is connected to Arduino. If battery is flat, replace it.
  3. Ensure the Bluetooth is turned on, on the computer
  4. When Arduino is connected to the USB port of the computer, RX and TX pins on the HC-05 need to be disconnected. When RX and TX pins on HC-05 are connected, USB needs to be disconnected. This prevents HC-05 from interference with the USB.
  5. Check wiring with the diagrams in Step 2.
  6. To check the UART configuration (mentioned in Step 2):
  7. Windows: device manage > Ports (COM & LPT) > double click on HC-05's COM port number > Port Settings tab. The default setting accepted by Arduino is 8 data bits, no parity, 1 stop bit and no control flow.
  8. Mac/Apple: I do not know, unfortunately.
  9. From experience, Windows has a better Bluetooth connection with HC-05 than Mac

Feel free to ask questions in the comments section below.