Please follow the steps below:
a) Upload the IOserver onto Arduino Uno from the Upload Server screen after selecting 'Bluetooth' as the connection type in the selection screen.
NOTE: Do not connect HC-05 to the Arduino board yet.
b) Configure HC-05 if not done already. Follow the steps on the hardware setup screen.
NOTE: This step can be done independently of step a).
c) Skip step b), if already configured. Connect HC-05 to Arduino Uno. See the LED on HC-05 should blink rapidly.
NOTE: Do not unplug Arduino Uno while connecting the Bluetooth device.
d) Enter the Bluetooth address of the device. Test the connection. See the debugging tips below if you are facing any issue. It is normal to see the LED on HC-05 blink slowly in between and it should start blinking rapidly thereafter. Slow blinking confirms that communication between HC-05 and the computer is established. Thereafter, the Arduino object is constructed internally with the Bluetooth address provided. Rapid blinking confirms that Bluetooth communication is released.
e) To check if PC/MATLAB can communicate with the Bluetooth module, create an Arduino object.
a = arduino ('btspp://98D371F5EBF9','Uno')
a = arduino('HC-05','Uno')
should work when:
a) correct IOserver is uploaded onto Arduino Uno.
b) HC-05 is configured properly.
Some debugging tips to configure the HC 05 module and Test connection are mentioned below:
- Check if the HC-05 is configured properly. Connect the HC-05 module to the PC's COM port. On the "Configure Bluetooth Device" hardware setup screen, select the correct COM PORT and click 'configure'. Please refer to the hardware connections provided on the previous setup screen "Connect Bluetooth Device to Host Computer". This step configures the Baud rate of the HC-05 to 115200 at which the Arduino board can communicate with HC-05 over serial.
To configure HC-05, first it needs to be put under configuration mode. For that, connect the device's 5V supply pin to Arduino Uno's 5V pin while pressing the 'reset' button on the HC-05. The LED on the module should blink slowly. Now, click on 'configure'. If it blinks rapidly, it means the module is under operation mode and the configuration will fail.
- If a correct IOServer is uploaded and HC-05 is configured properly and still ‘Test Connection’ won’t go through, try reconnecting HC-05 ( unplug 5V wire and reconnect it). After that, try creating a Bluetooth object on the MATLAB command window using the following commands:
>> b = Bluetooth('HC-05', 1);
- If Bluetooth object creation fails, check if HC-05 is paired with the computer. Please try below:
i) Turning off/on the computer's Bluetooth.
ii) Repower the HC-05 module. Try Bluetooth object construction again.