Using Arduino BT (Bluetooth) in Ubuntu 9.04 and 9.10

N.B. I inserted this page after a wide unsuccessful search in forums, not only arduino.cc forum, to solve the problem. With some tricks and some hours of tests I finally was able to connect and upload sketches to arduino BT with a pc running Ubuntu 9.04 BT capable. After other tests I finally connected Arduino BT with another Ubuntu 9.10 Desktop and an eepc running Ubuntu 9.10 Netbook remix.
Enrico Miglino (enrico.miglino@ovi.com)

Click here to go back to Linux Getting Started section

Removing brltty library

Reading on requirements for Linux installations (from Getting Started section of this site): If you have brltty installed (the default on recent versions of Ubuntu), you'll need to remove it. Ok, It's right but not sufficient. Investigating I saw that in Ubuntu 9.04 and 9.10 there are several components installed by the operating system that can create serious problems. So, you must remove all the components that you find as installed using the search word brltty in package editor (synaptic/aptitude). While removing these packages, you will probably receive an alert that you are also removing the orca package: don't worry and remove it. This is the package for text-to-speech used by the operating system.

When you have completed the brltty removal process, you should be able to connect an Arduino USB board successfully. Follow the rest of these instructions for Arduino BT.

Bluetooth pairing and configuration

When you have an active Bluetooth connection in Ubuntu Linux, you should see a Bluetooth icon in the system tray. If you don't see it there, you can open the Bluetooth applet from the menu System/Preferences/Bluetooth (Applet Bluetooth 1.8 from www.bluez.org). If you're using Kubuntu, you will want to look for kbluetooth. This program handles device discovery and pairing, plus a small set of additional functions. This is exactly what you need to pair your Arduino BT with the computer.

A trick for Arduino BT pairing

Arduino BT is sold with the device name ARDUINOBT and the pin 12345. The problem is that if you try to pair your Arduino board with the discovery function Set new device from the Bluetooth tray icon you can't, because the dialog window accepts only a 4 character pin while Arduino BT has five!

Proceed as follows:

  • Right click the BT tray icon and select Explore files on the device You'll see all the discoverable devices, including Arduino BT, not yet paired.
  • Select Arduino BT to proceed. After a few seconds, the dialog box Authentication request will appear, in which you can put the authentication key (device pin). Enter 12345 and confirm.
  • Nothing appears and you can't see the dialog box for file explorer, as expected, because the Arduino BT doesn't provide a bluetooth storage system. But now, your Arduino BT is correctly paired and can communicate with your desktop.

Blueman applet 1.10 problem (Ubuntu 9.10 only)

In Ubuntu 9.10 desktop there is an alternative to the Applet Bluetooth 1.8, that can be installed by the user. It is Blueman applet 1.10 a Bluetooth manager based on GTK (http://blueman-project.org). The behaviour of this applet appears not so different from the other but seems more useful with a lot of new functions. There is no problem for pairing many devices and you can also start a serial-over-bluetooth connection between your computer and Arduino BT board.

If you want to work with Arduino IDE and upload sketches to your Arduino BT board you must remove this applet. The program, in every condition I tested it, after the paring seems to take control of your serial communication and there is no way to upload anything to Arduino BT board.

How to bind the device

When you have paired an Arduino BT with your computer, you must enable the serial communication binding the device using rfcomm.
These are the commands you must use (sudo may be needed, depending by your permission settings) supposing that your Arduino BT has the device address 00:07:80:91:32:7D

To bind the device: rfcomm bind 0 00:07:80:91:32:7D 1

To release the device:: rfcomm release 00:07:80:91:32:7D

If you have more than one serial-over-bluetooth device, set the 0 following bind to a unique integer for each device.

The command must be executed once prior to communicating with your Arduino BT. It can be easily inserted in a shell command, to use for initialization. The device binding is active until you power off the computer or release the device.

Device configuration on Arduino BT

Assuming that you have only one serial-over-bluetooth device connected to your computer, the binding command will create a new /dev/rfcomm0 in your /dev directory.
The last thing you must do is tell the Arduino IDE which serial device you want use to communicate with the board. To do so, you must edit Arduino configuration file with the following commands:

$>cd ~/.arduino
$>gedit preferences.txt

(Instead of gedit you can use your preferred text editor i.e. leafpad, vi etc.)

Now, in preferences.txt file you must find the line starting with serial.port= and put (in our example)

serial.port=/dev/rfcomm0

It doesn't matter if you don't see this serial port in your Arduino IDE, when you upload your file this works.


Click here to go back to Linux Getting Started section

Share