Report
4 years, 8 months ago.

How to interface HC-05(Bluetooth) with FDRM-46z ?

I am planning to interface the microcontroller and then control the Bluetooth module using an android application. My main and only aim is to send a byte from my mobile to the Bluetooth which then tells the microcontroller to make a GPIO high. How to interface and write the code.

Comment on this question

1 Answer

4 years, 8 months ago.

Hello,

First for the physical interface: These HC-05 modules are easy to connect to 3.3V microcontrollers. Just select a Tx/Rx UART pair of pins, and connect the Tx and Rx pins of the module on them (Tx of one side to Rx of the other side), and also connect GND pin to the KL46 GND, and the Vcc pin to the KL46 3.3V pin.

You will communicate with the module using the regular UART, at 9600bps speed. This is the default baud rate for the HC-05. It can be changed, if needed we can discuss that.

Now you may test it using an android application. I use a free VT100 terminal emulator, called BlueTerm. You run the app, select the connect option, and look for the "linvor" bluetooth device. This is the HC-05 module. After connecting, you may send and receive ASCII characters.

Feel free to contact me for my detaisl. I hope this is a good start.

Cheers,

Antonio

Dear Antonio,

Thanks for your answer.

I will tell you what I did.

1. I made physical communication between the HC-05 module and the microcontroller. 2. I connected the USB between the microcontroller and the computer. 3. I used BlueTerm and I was able to connect to my bluetooth. 4. I sent some ASCII characters

Now my issue starts.

1. How do you I know that the microcontroller has received the data? 2. How can I send that data to my computer and view it in the Terminal software?

I was able to do an interface with the computer and microcontroller. But when a bluetooth comes, I am confused with the code and the way to approach.

Thanks in advance

posted by Derek Kuttikkat 05 Sep 2014

Hello,

I understand that now you want to send characters from your BlueTerm program (into your smartphone) to the microcontroller, and then you need to check if these characters were received. The most basic approach would be to relay these characters to the USB COM port, so you can get them into a PC terminal program.

If that is the case, all you have to do is to create a second "Serial" object (the first one is to access the Bluetooth module). For initializing this Serial object, you have to specify the Tx and Rx pins using the words USBTX and USBRX. Now this serialobject is bridged to the KL46 USB COM port, and if you open any terminal program in your computer, you will be able to find the COM port (usually using a number higher than 2).

Now you may write a a loop program that verifies if there is any character received from the HC05 serial, and then send it to the USB serial. In the same loop, you may also check data in the opposite way, i.e., verify any characters received by the USB serial and then send them to the HC05.

I hope I got it clear. Again, feel free to contact me should any doubts show up.

Cheers,

Antonio

posted by Antonio Quevedo 05 Sep 2014

To post an answer, please log in.