Sunday, December 7, 2014

Connecting Arduino using Serial over Buetooth to a Linux PC



  1. Have a linux PC (LPC) ready along with an Arduino(ARD) running the SPP or SPP Multi example code.
  2. Turn ON the Bluetooth radio(BR) on your LPC.
  3. Open a terminal on the LPC and type sdptool browse local. This will search for existing services available with your BR.
  4. If Service Name: Serial Port is not available, type sdptool add SP. Repeat above command to verify if service has now been added.

  1. Power ON the ARD and connect to it’s USB-to-Serial port using your favorite console program. I used Putty with baud rate 115200. You should see a dialog saying “SPP Bluetooth Library Started”. Without connecting, the arduino firmware is hung up in the setup loop. Use sudo putty if needed.

  1. Next, perform a scan to verify if Arduino is running the SPP example using hcitool scan. Note the Bluetooth(BDADDR) address of the device.


  1. Next scan for the services provided by Arduino using sdptool search SP. Arduino with the SPP example will be providing a service called TKJSP (Not sure why it's called that). Note the channel number on which this service is being provided <CH_NUM>.

  1. Next, we connect and provide the PIN for the bluetooth device using the command bluetooth-agent 0000 <BDADDR>.
  1. Next we create a port which we will use to talk via the serial port using the command sudo rfcomm bind 0 <BDADDR> <CH_NUM>. If you have already existing rfcomm bindings substitute 0 with a different consecutive number to the last existing rfcomm device. You can check if rfcommN exists by using the command ls /dev/rfc*.
  2. Open a new putty in root mode and provide /dev/rfcomm0 as the Serial Line @ 9600 baud and watch the first message pop up. Use command sudo putty