RPI Spotify Connect Receiver (Part 2)

This is part of a series see part one here

This part of the series is pretty standard for anyone who has set up a Raspberry Pi from scratch before, but thought I’d detail the steps in my own way for any n00bs, hopefully it will help someone.

So now we have our Rpi hardware we need to boot an operating system to actually use it, and for that we need something to read the operating system from. All modern Rpi hardware now uses MicroSD cards which are relatively cheap, as this will be used for boot its best to purchase the fastest sort you can. For this project I chose a 64GB Sandisk MicroSDXC which conforms to the A1 classification for read and write speed.

We need to copy the operating system files to this card using another computer and we will add a couple of our own to make life easier. Firstly insert the microSD card into an adapter to make a full size SD card, this is still the standard for most laptops which I will be using to copy the files.

The Raspberry Pi foundation do a fantastic job of maintaining a debian release specifically for the Rpi hardware called Raspbian. They also release a tool for downloading and copying Raspbian and other operating systems to the SD card. The imager software can be found here

Once installed, select the OS to use, select the SD card to write to and hit write, this will take a few minutes.

Once this has finished, leave the card in the computer, as we want to add a couple of files to make life easier when we boot our Rpi. The first of these is a single empty file just called ssh (with no extension such as .txt). By default the ssh daemon is disabled, with this file it will be enabled on boot allowing us to connect remotely.

Our Rpi zero W does not have an ethernet port allowing us to cable into a switch or router for connectivity. Therefore for network connectivity we need to enable the wireless settings. While I could connect a HDMI monitor and keyboard to the Rpi and configure this at the OS level, I am lazy and will use another file to configure this at boot time.

create a file on the SD card called wpa_supplicant.conf , in this file use the following configuration, swapping out with your own country identifier, wireless SSID and password:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=GB

network={
    ssid="SSID here"
    psk="Password here"
}

once saved, safely eject the microSD card and insert into the Rpi, and attach a microUSB power cable, if all goes well you should see the green LED flicker as it is booting, until you get a stable light.

Give this a few minutes to boot up and connect to the wireless network, as we are using DHCP for IP allocation, the fun part comes next in finding the allocated IP address, which on a home network with many wireless devices is not as easy as it sounds. I find the easiest way to do this is to log into my wireless router and look for devices. Thankfully the new Rpi identifies itself with a meaningful name, and the IP address can be collected.

Once we have this information we can use a secure shell program such as PuTTY to connect to the Rpi using SSH to issue commands remotely.

The default credentials are pi for the username and raspberry for the password. Obviously the first thing we do for any new Pi is to change this.

We do this with the command:

passwd

The next thing to do is to update and upgrade the installed packages to check if there are newer versions which may fix any bugs or security vulnerabilities. This should be done on a regular basis, or added to cron to perform automatically at a set time. To manually update and upgrade, two commands are run one after the other.

sudo apt-get update
sudo apt-get upgrade

As this is a new device we will also update the firmware, this is done with the command:

sudo rpi-update

As suggested a reboot is now needed for all the changes to take effect, this is done with the command:

sudo reboot now

Allow a few minutes and then try to reconnect with the new password you generated earlier. On successful login you should see the Linux kernel version has been upgraded to a much later version.

Your new Rpi is now ready for use.

Related Post

Leave a Reply