Installing Bluetooth on PwnPi

Installing Bluetooth on PwnPi

Installing Bluetooth on PwnPi

1 Comment on Installing Bluetooth on PwnPi

First I need to install all the Bluetooth management tools. Luckily I had a project in my last education where Bluetooth on a Raspberry was needed. The system at that time was Rasbian, but since PwnPi uses the same repository as Rasbian (Debian) the commands works just as well.

Installing Bluetooth on PwnPi :

apt-get update
apt-get install -y bluetooth bluez-utils blueman python-gobject python-dbus

Installing bluez utils

This will install all the necessary drivers and tools to use Bluetooth on a Raspberry. The “-y” command is there just to make it easier, it will automatically say “yes” to any prompts there might be. If you want to see everything, leave it out and the program will install with your input.

Next up we need to use a tool from the bluez package. This is called hcitool and contains a lot of helpful programs that we need to use in order to pair our android device to the Raspberry pi.

First up we need to see if the device is present and working properly. This is done by using the command

hcitool dev

hcitool scan

This shows the MAC address of my Bluetooth device connect to my Pi. Now we need to do a scan to see if the two devices can see each other.  There we go, now we have a working set of Bluetooth devices, all there is left to do in this post is to pair them up. This process can either be done with the GUI or via the terminal interface. I choose to show the command line method.

Moving on to the pairing part. We need to know my phones MAC address. For this we issue the command hcitool again.

hcitool scan

This will generate a something simiar to this


Apparently I also caught my neighbors TV remote, but no matter. The MAC of my phone is  “CC:F9:E8:E2:20:36” . This will be needed to pair and trust the device.

Now I should be able to pair my device with the Raspberry, but I wasn’t that lucky. I ran into a problem with the error code

Creating device failed: org.bluez.Error.AuthenticationRejected: Authentication Rejected

create devicefailed

Luckily I found the blog Correlatedcontent detailing with this problem, and the solution was simple enough.

nano /usr/bin/bluez-simple-agent

Here you should look for a word called KeyboardDisplay, its almost at the bottom of the file.  This should be changed to DisplayYesNo as I’ve shown in the picture below:

Raspbeery bluetooth YesNo

Now lets save the file and get ready to pair the devices one more time.

Pairing finished

Now my Raspberry is paired with my Samsung, now to the fun part!

Martin Jørgensen

Martin Jørgensen

Got my degree from EAL in 2012 as an IT-Technologist with specialty in network. I enjoy living in a century where I can earn a living doing my hobby. Material I publish here are often part of my small projects.
Martin Jørgensen

Latest posts by Martin Jørgensen (see all)

Related Posts

  • Irving

    pretty useful stuff bro.
    I apreciate it.

Back to Top