Connecting to Arduino using Processing and bluetooth (HC-05, HC06)

USB bluetooth dongle

USB bluetooth dongle

The other day I bought myself a USB bluetooth dongle for my HP laptop and a HC-05 bluetooth adapter for the Arduino.

When I connected the dongle to my laptop running Windows 8 it appeared like it would install the default drivers for it. I connected the HC-05 to an Arduino and I could locate it from my laptop. I could even pair the dongle with the adapter. (Default code: 1234.)

HC-05 bluetooth module

HC-05 bluetooth module

But when checking the HC-05 in Windows’ device manager its status would say “Offline”. It took me several hours of googling until I came across a suggestion by another user that bought the same dongle on amazon: I installed the Toshiba Bluetooth Stack! Even though it says it’s only for toshiba laptops it worked on my HP like a charm.

I also had a HC-06 adapter lying around. Optically they look very similar. As far as I know HC-05 can work as master or slave whereas HC-06 is slave only. If you use them as slaves you can use either of them using the same pins. HC-05 came up under COM40 and HC-06 identifies itself as “linvor” under COM41.

I always wanted to start programming in Processing. And when I came across the Dimmer example in Arduino’s example folder and I saw that there was also some Processing code I decided that this would be my first Processing, Arduino and bluetooth project.

I extended the Dimmer Processing code with a red, green and blue gradient strip. In the example was already the gradient from black to white. The idea was to dim a LED and also to control a RGB led from the GUI.

RGB Dimmer GUI

GUI programmed in Processing

I got some inspiration on how to send values from Processing to Arduino using this post by MadeByFrutos and set up bluetooth communication according to this instructable.

For the bluetooth connection I set up a software serial port on Arduino. I connected the RX of this software serial to the TX pin of the HC-05/HC-06. As the bluetooth module works with 3.3V levels I set up a voltage divider using a 10k poti. The TX of the software serial would be connected to HC-05/06 RX pin using that voltage divider so it would not get levels over 3.3V.

Close up

Please notice the voltage divider (poti) that puts down the level for Arduino’s TX to 3.3V.

Please find the code in my GitHub repository.

Project set up

Set up with Arduino Uno, a red Led, a RGB Led and an HC-06 bluetooth module.

Set up

Backside of the project set up.

22 thoughts on “Connecting to Arduino using Processing and bluetooth (HC-05, HC06)

  1. Hi This’s cool :}
    Can you control with 5 bluetooth, and 5 light ..? with one program(processing)

    • Lee, do you mean 5 arduinos with a bluetooth adapter each?

      If so, yes – As every bluetooth adapter shows up with a different COM port you could even address them individually.

      • Roman, Yes that is a question i want to ask. Wow cool
        Now im thinking about how to use processing send text to
        Mini LED (to show text)

        Do you know about this.
        HC-05 and XBEE (which one is better)
        and do you this “The Really Bare Bones Board (RBBB)”
        Can i use RBBB instead Arduino UNO..?
        Coz i want to use small equipment.


        • Lee, sorry, I haven’t worked with XBee but from what I know they are way more expensive than a HC-05.
          Also didn’t know the RBBB. But it looks like they are Arduino compatible. Keep in mind that programming is handled with a USB-to-TTL serial cable.

  2. Allow me to ask you a few questions.

    Which programming language did u use to create own GUI and what steps are required to talk to Arduino through HC-05?

    • I used processing but you can basically use any language you like that has a serial port object.

  3. I’m having the problem with the HC-06 in Windows 8 too.
    How can I configure the Toshiba Bluetooth Stack?

  4. Hi, I would appreciate your help in this. I have been able to send data to arduino through the wireless module, However, I am having trouble sending the data from arduino to PC. Although the module makes and incoming link as well, nothing seems to be sent to the PC. Would you please let me know if you have done something like that. (TX rather than RX) Thanks.

    • haven’t really tried it but it should be similar. i guess you would need to check for availability of data on the processing end and just send data from the arduino using myserial.write()

  5. Hello , i want to do it with android phone instead of PC ? what can i do else from it ? Please help

  6. i have an Arduino UNO and HC-05 module i can send data to them by bluetooth terminal via Android successfully.

    I can use computer program in java to send and receive data from Android cause bluetooth terminal connecting to them.

    But I cannot connect java program to HC-05 after pairing cause they both wait the other to connect with them. So how to do this ??

  7. Good day, May I get the code for this project of yours wanna check it out. It fascinates me hey.

  8. Pingback: How to communicate wirelessly with your controller? | H.M.B

  9. Hi. Arduino Uno has a 3.3V out and 5V also. So why we use a voltage divider? Why we cant just use 3.3V out?

  10. Hi Roman, i want to use hc-05 in my project. But i am not sure for use something. My I want to show my result in pc with bluetooth module. My pc has bluetooth, Should i buy another bluetooth adapter for hc-05 module ?

Leave a Reply

Your email address will not be published. Required fields are marked *