Sunday 20 September 2015

Using a Bluetooth keyboard with the Raspberry Pi

Bluetooth is really useful for wirelessly connecting peripherals to your Raspberry Pi. I wanted to use a bluetooth keyboard with my Raspberry Pi, but to do this, first of all I needed a Bluetooth adapter like the one shown below, which is available from Cut Price Cables


To configure your Raspberry Pi to use Bluetooth, first of all you need to make sure your system is up to date by typing the following at the command line prompt and pressing Enter:

pi@raspberrypi ~ $ sudo apt-get update_

Your Raspberry Pi will now download and install the latest repository database files and will report it's progress by displaying various lines of text on your screen. When completed type "sudo apt-get upgrade" at the command line prompt and press Enter:

pi@raspberrypi ~ $ sudo apt-get upgrade_

This will instruct your Raspberry Pi to download and install the latest updates for all the software installed on your system. This may be a large download and may take a while. Once again as it is progressing you will see a lot of text scrolling up your display screen.

Now it's time to install the Bluetooth drivers. Type the following at the command line prompt and and press Enter:

pi@raspberrypi ~ $ sudo apt-get install bluetooth_

This will install Bluetooth support, and will take a few minutes. Time for a coffee...

After this has completed, type "sudo apt-get install blueman" and press Enter:

pi@raspberrypi ~ $ sudo apt-get install blueman_

This will install a graphical management utility for Bluetooth.

Finally, you need to add yourself (pi) to the bluetooth user group by typing "sudo usermod -G bluetooth -a pi" and pressing Enter:

pi@raspberrypi ~ $ sudo usermod -G bluetooth -a pi_

Now power down your Raspberry Pi by issuing the "sudo halt" command and pressing Enter:

pi@raspberrypi ~ $ sudo halt_

Insert your Bluetooth adapter in to a spare USB socket on your Raspberry Pi (or hub) and power your Raspberry Pi back up. Log in and start the GUI by typing "startx" at the command line prompt and pressing Enter:

pi@raspberrypi ~ $ startx_

You should find that the Bluetooth manager loads automatically, as shown by the Bluetooth symbol on the menu bar.


Click on the Bluetooth Symbol to launch the graphical management utility for Bluetooth. You should see a window listing a number of Bluetooth devices.



If the device you wish to connect to (in my case a keyboard) is not shown, press the "pairing" button on your Bluetooth device and then click on "Search" and your Bluetooth keyboard should appear at the top of the list of devices:


Select your Bluetooth keyboard and click on "Setup". A window entitled "Pairing" should appear.


Leave the pairing method as "Use Random Passkey" and click "Forward". You will be prompted to enter a passkey on the Bluetooth keyboard. Enter the passkey and press Enter.

You should now see a "Connect" window with the option "Connect to input service" preselected. Click "Forward" to continue:




You should now receive conformation that the device has been paired and connected. Click "Close" to exit setup.



Finally mark the Bluetooth keyboard as "trusted" by clicking on the gold star.



That's it!

Now every time to power up your Raspberry Pi it will look for the Bluetooth keyboard you have just configured. When you come to login there may be a short delay before the Bluetooth keyboard connects, but if you wait a couple of seconds and try again it should work.