Create the most absurd chat of the world with Arduino

Are you bored and looking for some entertainment? Would you like to fastly create a chat to avoid leaving your chair or sofa to talk with your flatmate? Would you like to know more about AT commands and practice with them? Whatever your question or interest, in this tutorial you can learn to create a chat using Arduino and Bluetooth.

Required materials:

  • Two Bluetooth modules(e.g. HC-05 and/or HC-06). One of them must be HC-05 in order to be able to stablish the communication.
  • Arduino or  USB to RS-232 converter. Any of them are valid, being necessary a total of 2.
  • Arduino software, putty or other software that allows using Windows COM port or /dev/tty/USBX, /dev/tty/ACMX or similar in case of Linux environment.
  • Prototyping cables to connect the Bluetooth modules with the Arduino board or converter.
  • USB – USB mini/micro cable to connect the Arduino or converter with your computer.
  • Protoboard

Steps to follow:

If you are using an Arduino, make sure that you upload and empty program. That is, a program containing both setup and loop methods to avoid compilation errors. This way, you make sure that nothing interferes in what you pretend to do.


Once the step is done, proceed to connect the different parts:

  • Connect VCC (5V) with Bluetooth’s VCC
  • Connect GND with GND.
  • In the Bluetooth module which will create the connection, connect Key pin with VCC (that will allow to execute the AT commands).
  • For TX and RX pins, connectivity will depend on the module use and the Arduino or converter, usually  TX to RX and RX to TX. In case of doubt, there are several ways to check:
  • Depending on the Bluetooth module, you may find arrows indicating if it is input or output.
  • With or without indication, you can connect your Arduino or converter to Arduino software, open Serial Monitor and send a ramdon character to see if TX LED flashes. If that is the case, the connectivity was done well.

Done this step, you will start executing the AT commands that will allow connecting to the other Bluetooth module and communicate with it. In case of using Arduino software:

  • Go to Tools->Board and select the board (in case of using a converter, this step is not necessary).


  • Go to Tools->Port to indicate the port where the device is connected.


  • Open Serial Monitor and select a baudrate of 38400 and Both NL&CR as line ending.

img4 img5

If these steps were done without problems, you can proceed to create the connection using the AT commands. To do so:

  • Write AT and press send or Enter key. If everything was ok, you will receive an OK as an answer. If you receive an error, repeat until you get an OK (if nothing appears in the screen, check that RX and TX pins are well connected).


  • Configure the module as master with AT+ROLE=1. As in the previous step, you should receive ‘OK’.


  • Initialize the SPP profile. That will allow the search and connection with another Bluetooth device. To do so, execute AT+INIT.


  • Indicate that the device has an access key with AT+IAC=9e8b33.


  • Indicate that the Bluetooth device you are going to connect with is class 0 with AT+CLASS=0.


  • Search for device with AT+INQM=1,9,48 (1->RSSI intention indication, 9->Maximum number of devices to add to the list, 48->Multiplied by 1.28 to calculate the maximum search time).


  • List the found devices with AT+INQ:



  • Pair with the target device with AT+PAIR=bluetooth_address,max_response_time. For example, if you desire to connect with the one with MAC address 11:9:50114 (some of the zeros are not shown and the rest you can see in the line is not part of the physical address), the command is AT+PAIR=11,9,50114,20 (you have to substitute : by , ). If the pair was done, you will receive ‘OK’.


  • Link with the target device with AT+LINK=bluetooth_address (remember to substitute : by , ). If the link is done, you will receive an OK and the blink of the LED will change.


Ready! Now you can communicate through Bluetooth!

To finish, open Arduino Software in the other communication side (Note: in case of testing in the same computer both sides of the communication, you must run other software like Energia or Putty, as though Windows opens other Arduino instances, it doesn’t allow to choose another port in that instance). In that side, open the serial monitor or equivalent with a baudrate of 9600 bps.


If you want to know more about the AT commands, you can have a look at the guide available at Instructables

Leave a Reply

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