With the use of Bluetooth products in daily life, some product developers will often use Arduino to develop with the HC-05 Bluetooth module. How to program the HC-05 Module with Arduino?
Now take Feasycom's HC-05 (FSC-BT826) module as an example:
The FSC-BT826 (HC-05 module) is powered by 3.6-6V and the logic voltage level of the data pins is 3.3V. But the I/O output of the Arduino board is 5V. In order not to burn the Bluetooth module, the Bluetooth module RXD and Arduino I/O output needed to Series connect with resistance, as Figure 1 shows. On the other hand, the Bluetooth module TXD and Arduino I/O Input can be connected directly because the 3.3V signal from the FSC-BT826 (HC-05 module) is enough to be accepted as a high logic at the Arduino Board.
We can provide the source code of an example that is based on the self-contained example named “SoftwareSerialExample” in Arduino UNO IDE. The program initialization of the example is set forth below.
There is a software analog serial port class in file <SoftwareSerial.h>, we need to contain
this head file and declare a SoftwareSerial object.
In the setup() method, we made some initialization:
- 1. Set the LED_PIN to output mode.
- 2. Set the LED_PIN to low level.
- 3. Set baudrate of serial port and start the communication between your computer and Arduino board.
- 4. Iterate over baudrates to get the UART baudrate of the HC05 and start the communication between Arduino board and HC05.
For the module more programming information, welcome to visit the module link: HC-05 Bluetooth Module replacement Bluetooth Module Dual-Mode HC-05 Pin-to-Pin