Setup: Bluetooth

Setting up Bluetooth for the first time can be a bit of a bear, especially if you want to use a Bluetooth keyboard and mouse.  Since both are critical to getting anything done on the Raspberry Pi it’s important to set them up so they work seamlessly on boot.  Otherwise you may find yourself up a creek with out a mouse and keyboard.

Although the documentation for the Raspberry Pi and Rasbian says that Bluetooth is functional out of the box, I found that I had to install a few things and tinker around with it to get it working.  Going through the GUI seemed intuitively like that would be the easiest way but, again, the command line is really where it’s at.

(Just a side note but setting up Bluetooth on Ubuntu MATE was much easier than Rasbian.)

First step is to install a few Bluetooth packages.

sudo apt install pi-bluetooth bluez bluez-firmware blueman

Set your Bluetooth device to pairing mode and then use bluetoothctl to scan for, trust, pair and connect to your device.


Your prompt will change showing that we are now using bluetoothclt.


First scan for the device with the scan on command.

scan on

It will say “Discovery started” and when it finds your device it will show you the device MAC address and name.

[NEW] Device 00:2B:CD:34:55:72 Keyboard

Trust the device with by typing the trust command and then the first two numbers or letters of the MAC address, you can use autocomplete by pressing tab.  Make sure that is the same MAC address as the one just found in the scan and press enter.

trust 00:2B:CD:34:55:72

Then pair and connect to your device, and finally quit out of bluetoothctl.

pair 00:2B:CD:34:55:72

connect 00:2B:CD:34:55:72


There are more commands to use in bluetoothctl and it’s helpful to check them out using the help command.  This way you can unpair devices or troubleshoot if you encounter issues.


[bluetooth]# help



Setup: The Resolution

One thing that is a bit annoying when you start up your Raspberry Pi for the first time is that you’ll notice a black border around the screen.  Even though the output is HD it still dosen’t look like it.

This is easy to fix.

The setting that makes this happen is called overscan and by default it is turned on in Rasbian.  Edit the config.txt file in the /boot directory.

sudo nano /boot/config.txt

In the third paragraph you will see the instructions.

# uncomment this if your display has a black border of unused pixels visible

# and your display can output without overscan

# disable_overscan=1

Delete the # in front of disable_overscan=1 to uncomment it.  This will enable the disable overscan feature and set it to a value of 1, or turn it on.  It should look like this.

# uncomment this if your display has a black border of unused pixels visible

# and your display can output without overscan


Exit and save the file by pressing Ctrl x, then y, then Enter.

If you get an error when saving, it will be because you don’t have permission to edit the file.  So use sudo before the nano command when editing the file.

Reboot your Raspberry Pi for the changes to take effect and you will see the resolution fits the screen perfectly.

sudo reboot now


Setup: The Password

Right out of the box the Raspberry Pi needs a bit of finesse to get things working.  One of the most important things to do first is change your password.  Otherwise anyone can log in to it.

Let’s update our password for the default pi and root users.

passwd pi

Follow the prompt to enter and confirm your password.

passwd root

Follow the prompt again for the root password.


Let’s test our passwords to make sure they work.  You can change between these two users using the su command.  Starting from the pi user change to the root user.


Follow the prompt to enter your password.  Now you will see that pi@ will change to root@ and the $ before your cursor will change to #.

You are now root and can enter any command and make any changes to any files with out having to enter your password.  Be careful with that.

Change back to the pi user.

su pi

Enter your password and root@ will change to pi@ and the # will change to $.  Now you are not able make changes to important files or execute certain command with out putting sudo before the command.

Setup: The Network

Connecting to your wifi for the first time is easy as Pi on most computers and mobile devices.  On the Raspberry Pi my first reaction to the GUI was a confused one.  Since most everything can be done on the command line, and it’s much more cooler – let’s set it up that way.

To do this we will edit the wpa_supplicant.conf  file in the /etc directory that stores network configuration information.  We will use nano to edit the file and add the router name and password.

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Add your wifi information in the following format to the bottom of the file.

ssid=”router name”

Save and close the file by pressing Ctrl x, then y to confirm to save the modifications, then press Enter to save it to the same file name and overwrite the file.

Let’s restart the wifi on the Raspberry Pi and check to see if the settings are working.  Turn off the wifi and turn it back on.

sudo ifdown wlan0

sudo ifup wlan0

Then check your wifi network interface is up and running using ifconfig.  The wifi interface is called wlan0 (wireless LAN 0).

ifconfig wlan0

You will see a block of information about wlan0 like the MAC address, IP addresses and other networking information.

To find out what your IP address is look for “inet addr:” in the second line.  You can show just this line with the following command.

ifconfig wlan0 | grep “inet addr”

You will see your IP, broadcast and mask like this.

inet addr:  Bcast:  Mask: