Debugging your Bluetooth Module (For HC05 and HM10/AT09)

Bluetooth modules are available in numerous variety in the market (HC05 and HM10/AT09) . Thus, many time you end up debug your Bluetooth module or the circuit. There are few reasons why this happen:

  1. Incorrect baud rate of the Bluetooth
  2. Incorrect new line type in Arduino IDE Serial Monitor
  3. evive Circuit: Due to some design issue, some boards have problem while using Bluetooth module though its dedicated slot.

We will tell you how to identify these issues and debug them.

Is my Bluetooth module working?

There is a quick test to check your Bluetooth module. Upload evive Firmware using Arduino IDE or Scratch (whichever you are comfortable with). Plug your Bluetooth module on evive Bluetooth slot as shown in the figure below:

Turn ON evive. You will observe a menu pop-out on the TFT Display:

evive Menu Interface

Serial Monitor: Serial Monitor allows the user to select the serial (evive has four serial channel) and also allows users to set the baud rate at which they want to open the serial port. It, then, reads and displays the data coming from the selected serial at specified baud rate by the user.

  1. Install evive Android App and install it (We are developing iOS App and  will be launch it soon).
  2. In your phone, open setting tab and select Bluetooth. You will see an available device to pair (Important: evive should be ON). Click the appropriate device and pair it. The password for HC05 module is 1234, and for HM10 is 123456.
  3. Close the setting tab and open evive Gamepad App.
  4. On the top right corner you will see Scan button. Click it and all the paired Bluetooth devices will display.Select the appropriate device. After connection you will see the connected message.
  5. In evive Menu, navigate and select Serial Monitor option using navigation key.
  6. Select Serial 3 Baud Rate option as Bluetooth is connected to Serial 3.
  7. Now you will see a long list of Baud Rates. Most Bluetooth which we provide have Baud Rate 115200 and few have 38400. We have to find the right baudrate. We are checking for 115200 here in the example.
  8. Click on different buttons of the Gamepad. You will observer character shown on the App. These are the characters which the mobile is sending to the Bluetooth module. If you see the same character appearing on the serial monitor, then you have found the right baud rate. In our case the baud rate is 115200.
    Let us see what happen when we have different baud rate selected (I am choosing 250000).
    The message is full of noise and we are getting all the characters wrong.
  9. If you are not able to find the baud rate of the Bluetooth module, don’t panic. We have another method to get the Baud Rate.

Incorrect baud rate of the Bluetooth

If the baud rate if the Bluetooth is set wrong you get garbage message on the serial monitor. Thus we will change the baud rate of the Bluetooth module using AT Commands.

  1. Copy the following code, paste it in a new Arduino Sketch and upload it to evive using USB cable.
  2. Open the Serial Monitor on Arduino IDE. On the bottom right corner you will find two drop down menu. The first one is for new line character (Choose both NL & CR) and the second one is the baud rate for serial 1, which we have to set to 115200.
  3. Now type AT and click send. If you get OK message, then the communication is set. If not try changing the Serial 3 baud rate to 115200, 19200 or 9600 until you get OK message on Serial Monitor.
  4. Type AT+UART. You should receive the following message: +UART:115200,0,0. The first number is baud rate you Bluetooth is working on.

Thus if you are using a different baud rate to communicate, garbage data will come. Hence, either change the baud rate specified in the program to the above number or change the module baud rate.

To change the bluetooth module baud rate, use this command: AT+UART=115200,0,0

You will get OK message. To check if the baud rate has changed or not, repeat Step 3.

Incorrect Line end settings in Arduino IDE Serial Monitor

Line end settings specifies how the string is terminated that you send to your evive/Arduino board after clicking the Send Button.

  1. “no line endings”: no character is appended to the string being sent.
  2. “Carriage return”: a Carriage Return character (‘CR’=0x0d or ‘\r’) is appended.
  3. “Newline”: a newline (‘LF’=0x0a or ‘\n’) is appended.
  4. “Both CR & LF”: both a CR and a LF character are appended.

The right setting depends on how your sketch handles the incoming characters.

Line end characters are a convenient and common way of indicating your board the end of a transmission.

Choose the appropriate the line ending setting.

evive Circuit

Due to some design issue, some boards have problem while using Bluetooth module though its dedicated slot.

evive Bluetooth alternative circuit

This circuit will work of every Bluetooth. If not, the Bluetooth module might be faulty.

If you still have problem, post it on the forum.

Close Menu
×

Cart