A step by step guide to setup a Bluetooth keyboard and mouse on the Raspberry PI

By ctheroux34 Comments

A lot of people is having problem setting up a Bluetooth keyboard and mouse on the Raspberry PI. Things get more complicated when your wired keyboard or mouse does not work or prevent your Bluetooth dongle from working. There is hope. This step by step procedure will let you install them or at a minimum let you know what does not work. It uses only the command line interface. It is targeted for the Wheezy Debian distribution.

    • First of all, if you already tried to set them up and they do not work, start with a fresh install of the OS. This will rule out anything you have done before that would prevent this procedure from working.
    • Plug the Bluetooth dongle directly on the Raspberry PI board.
    • Boot the Raspberry PI and connect to it using SSH from another computer if possible.  Otherwise, use a wired or wireless keyboard. Logon as pi, password raspberry.
    • Switch to root
sudo bash
    • Install all the updates.  It will take a while.
apt-get update
apt-get upgrade
    • Enable dbus
update-rc.d -f dbus defaults
    • Reboot
reboot
    • Reconnect as described above. Logon as pi, password raspberry. Switch to root.
    • Install the required packages.  It will take a while.
apt-get install bluetooth bluez-utils blueman
    • Reboot and reconnect as described above. Logon as pi, password raspberry. Switch to root
    • Make sure that your Bluetooth dongle is recognized. If not, unplug it and re-plug it.
lsusb
    • Make your Bluetooth device discoverable. Refer to the device manual.
    • Make sure that your device is seen by the Raspberry PI. Take note of its MAC address (ex. 75:EF:82:69:D2:83)
hcitool scan
    • Pair the device. When requested, type a pin like 0000 and hit ENTER. If you are pairing a keyboard, type the PIN you have entered and hit ENTER on the keyboard you are pairing. If you are pairing a mouse, you also need to type a PIN of 0000 when requested and hit ENTER. This PIN might depends on the mouse manufacturer.
bluez-simple-agent hci0 75:EF:82:69:D2:83
    • Make the device trusted.
bluez-test-device trusted 75:EF:82:69:D2:83 yes
    • Connect the device. After a few seconds, your device will be usable.
bluez-test-input connect 75:EF:82:69:D2:83
  • Repeat the steps from “Make your Bluetooth device discoverable” if you need to install another device.
  • When you will reboot, the devices will reconnected automatically after a few seconds.

This procedure worked for the following devices:

  • Cambridge Radio Bluetooth dongle
  • Microsoft Bluetooth Mobile Keyboard 6000
  • Apple Bluetooth Keyboard (iPad keyboard)
  • HipStreet mini bluetooth keyboard
  • RocketFish Bluetooth Mouse
  • Razer Orochi Mouse
  • iPazzPort Bluetooth (Model KP-810-10BTT)
  • Ultra eXo mini keyboard/touchpad
Debian, Linux, Raspberry PI, Wheezy

34 Comments to “A step by step guide to setup a Bluetooth keyboard and mouse on the Raspberry PI”

  1. [...] my Bluetooth keyboard setup to work on my Raspberry Pi and XBMC, there is an amazing tutorial here that gives all of the steps needed to get Bluetooth working on your RPi. When I ran through the [...]

  2. Tobias says:

    till hcitool scan all ok but then:

    raceback (most recent call last):
    File “/usr/bin/bluez-simple-agent”, line 89, in
    manager = dbus.Interface(bus.get_object(“org.bluez”, “/”),
    File “/usr/lib/python2.7/dist-packages/dbus/bus.py”, line 241, in get_object
    follow_name_owner_changes=follow_name_owner_changes)
    File “/usr/lib/python2.7/dist-packages/dbus/proxies.py”, line 248, in __init__
    self._named_service = conn.activate_name_owner(bus_name)
    File “/usr/lib/python2.7/dist-packages/dbus/bus.py”, line 180, in activate_name_owner
    self.start_service_by_name(bus_name)
    File “/usr/lib/python2.7/dist-packages/dbus/bus.py”, line 278, in start_service_by_name
    ‘su’, (bus_name, flags)))
    File “/usr/lib/python2.7/dist-packages/dbus/connection.py”, line 651, in call_blocking
    message, timeout)
    dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name org.bluez was not provided by any .service files

  3. dargue says:

    Finally!

    First off, thanks for a great guide. Secondly, in case anyone else out there is struggling with a Cambridge Silicon chipset – 0a12:0001 – I found it was possible to skip the hcitool scan not found problem. I used another device (android phone) to discover the BT address of the Cerulian keyboard I was trying to pair. With the address you can go straight to the bluez- commands.

  4. Martinscloud says:

    Worked for me, eventually.

    I too had to execute the dbus command mentioned by Artbit. Also, it wasn’t obvious that the the pairing command was waiting for me to enter the pass code – there’s no prompt.

  5. rene says:

    Hi,

    I installed and setup the BT-Keyboard (Apple Aluminium keyboard A1314) as described.
    The device is connected and Trusted. But if i hit a key, the keyboard-led is shining for a short time but no keystroke is transmitted.
    What can I do?

    Thanx for your help.

    1. ctheroux says:

      It looks that your keyboard is not paired.

  6. ctheroux says:

    I have tested this guide on 2013-02-09-wheezy-raspbian for a keyboard (Microsoft) and a mouse (Rocketfish). it works perfectly.

    There is many causes if you are having problems. What I recommend, start with a fresh Wheezy installation. Follow exactly the guide.

    Power consumption is an issue with the RPI. Even if you have 2 USB ports, plug in it only the Bluetooth dongle, nothing else. If you need to plug anything else, use a powered USB hub. If you power your RPI with a computer USB 2.0 port, you will likely have problems. USB 2.0 port will not supply enough power for the RPI and the Bluetooth dongle. Use an external wallmart adapter that can supply at least 1A.

  7. Vasilis Markou says:

    And something else. Hitting then the command “hcitool scan”, it says that the command is not right (in other words!)
    Thanks again.

  8. Vasilis Markou says:

    Hello and thanks for the nice guide.
    I am trying to pair with a bluetooth dongle(ASUS) an apple keyboard. I have done everything to the “lsusb” command as described. The report to the above command says that a bluetooth device is recognized (apparently that is the dongle), and at the same time i have set the keyboard to discoverable mode. But nothing like MAC address is appeared on this step. Any idea what i am doing wrong?
    Thanks in advance.

  9. tanimoto says:

    Troubleshoot Mac mini Bluetooth Keyboard Pairing

  10. Lang says:

    when installing the packages, I recommend using the switch –no-install-recommends. Specifically,

    sudo apt-get install bluetooth bluez-utils blueman –no-install-recommends

    By default, bluez-utils will also install various other packages for printing and audio which you don’t need.

    1. Lang says:

      I meant to say apt will install more with the blues-utils package

  11. steven says:

    How do you access bluetooth manager on raspbmc i have ipaazport bt

    thanks in advance

  12. Ross Austen says:

    Great guide. However I am having troubles at the last gasp.

    I can pick up both my bluetooth adapter:
    lsusb
    Bus 001 Device 005: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)

    I can see the device I want to pair with:
    hcitool scan
    00:1F:20:3D:4A:81 Logitech K760

    However nothing ever happens to allow me to initiate the pairing.

    I am connecting to the pi via SSH over Mac Terminal

    Any ideas what I am doing wrong?

    Thanks

    1. Mauro says:

      Same thing here I pair ok, insert the code on both and the the apple kb wont work.
      When I connect it does make my apple kb blink but thats all.

      Anyone?

  13. Max says:

    Hi!
    I have been following this tutorial and everything seems to work until I try to connect to the device (I am trying to connect with my Samsung Galaxy S2).
    When running “bluez-test-input connect 75:EF:82:69:D2:83″ (with the correct MAC address, of course), I get:

    Traceback (most recent call last):
    File “/usr/bin/bluez-test-input”, line 40, in
    input.Connect()
    File “/usr/lib/python2.7/dist-packages/dbus/proxies.py”, line 70, in __call__
    return self._proxy_method(*args, **keywords)
    File “/usr/lib/python2.7/dist-packages/dbus/proxies.py”, line 145, in __call__
    **keywords)
    File “/usr/lib/python2.7/dist-packages/dbus/connection.py”, line 651, in call_blocking
    message, timeout)
    dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownMethod: Method “Connect” with signature “” on interface “org.bluez.Input” doesn’t exist

    Any idea what could be error? I have been trying to google a bit, and it seems to be a problem with dbus, but I can’t figure out what to do. Any help would be much appreciated!

    1. Nick says:

      I have the exact same error!

      Equally mystified myself. Any help folks?

  14. adiabatic says:

    In addition to what ArtBIT posted I had to do:

    sudo update-rc.d -f udev defaults

  15. watou says:

    Aside from the (minor) key mapping issue, I am unable to even see (knockoff) Wii remotes when they are in discovery mode during hcitool scan. Does anyone know why they Riiteck keyboard/trackpad worked per this guide, but debian/wheezy (with the standard bluez 4.99-2) won’t even see the Wii remotes?

  16. watou says:

    Thank you so much for sharing this guide. Worked great here with a Riitek RT-MWK02+ and a D-Link DBT-122. But… Some of the keys aren’t mapped properly — for example, the | character comes out as a ~ and the \ comes out as a #. Where is the configuration to properly map all the keys on a given Bluetooth keyboard to their correct functions?

    Again, thanks for sharing this!

    watou

    1. MrScience101 says:

      @watou Sounds like you might need to run raspi-config and select the keyboard layout option. I had to choose a dell, and then us keyboard for it to map correctly.

  17. ArtBIT says:

    I had to enable dbus service in order to complete the installation of the blutooth packages, by running:
    sudo update-rc.d -f dbus defaults

  18. gron says:

    Great guide, thanks a lot! Just got my Logitech Mediaboard Pro working.

  19. wckd Dev says:

    Great instructions! Worked perfectly with the Motorola Xoom Bluetooth Keyboard and Rocksoul Bluetooth Mouse on Pi model b running 12-16-2012 wheezy. Thanks!

  20. andythegrouch says:

    Hi,
    when issuing the’hcitool scan’ I get ‘Device is not available: No such device’. The device is trying to associate and the dongle is working. Any ideas

  21. Alex says:

    I am trying to do this to pair an Exo Ultra keyboard but it fails at the installation of bluez saying that “Service dbus has to be enabled to start service bluetooth”. What am I doing wrong?

  22. Phil Hawkshaw says:

    Hi,

    These were the best instructions I’ve found all week! Thanks!

    Managed to get the Apple Keyboard paired however is there a way to make the keyboard available on bootup to type the login details?

    Without SSH to the Pi then switching back to the keyboard :-)

    I can’t login!

    1. ctheroux says:

      Your keyboard should be available at boutup. It is for me. Unfortunately, I have no ideas.

    2. Henry Skoglund says:

      Thanks for an excellent walkthru, worked with my El Cheapo ($9.99) Bluetooth keyboard and adapter.

      Re: how to make your Bluetooth keyboard available when rebooting: look for the Bluetooth icon in the systray, open it and confirm/authorize that your keyboard can connect automatically on reboot. I did and now my keyboard works every time I reboot the Pi.

      Rgrds Henry

  23. waxtadpole says:

    Thanks for your very precise and helpful instructions from a RPi newbie. I was doing fine trying to connect my iPazzport until I tried to pair the device. For some reason (most likely something I missed) I was not able to enter a passcode. However at this point I switched from the terminal to Bluetooth Manager and was able to pair and activate the input service using the setup wizard. I would recommend that my fellow noobs having trouble try the same.

  24. Brian says:

    Thanks! This worked great with the Ultra eXo mini keyboard/touchpad on my Raspberry Pi model B.

  25. This is fantastic. Thanks a lot. It works with the iPazzPort Bluetooth (Model KP-810-10BTT) and the first revision Pi – like a charm!

    Thanks again!

Leave your Comment

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


one + = 7

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Blue Taste Theme created by Jabox