Overview
Parts List
- Raspberry Pi board (any model or revision). This project has modest requirements and is a great use for older “hand-me-down” Pi boards.
- Adafruit LCD+Keypad Kit for Raspberry Pi. There are a few different versions of this, depending on the “look” you’re after: RGB Positive backlight, RGB Negative, and the more affordable Blue & White. All versions of this kit require some assembly and soldering.
- A 2GB or larger SD memory card (microSD for most recent Raspberry Pi boards).
- A power supply compatible with the USB MicroB connector on the Raspberry Pi; some mobile phone chargers will work, or we offer suitable USB “wall wart” adapters andcables.
- Headphones or amplified speakers (or connect to your living room A/V setup).
- A free account with the Pandora streaming music service.
Optional but Recommended:
- A USB WiFi adapter compatible with the Raspberry Pi (and an existing wireless network, of course). The Raspberry Pi Model B could be used with wired Ethernet, but this makes it less convenient.
- A Pi Box enclosure, or other case with an open top (the Pibow and Pi Shell aren’t suitable — we need full access to the top of the board).
Temporary Items for Setup:
The following are required for assembly and configuration, but do not need to remain permanently attached:
- Monitor (HDMI or composite)
- USB keyboard
- Possibly a powered USB hub
- Soldering iron and solder (for assembling the LCD keypad kit)
Initial System Configuration
This project works well with the new Raspbian “Jessie Lite” distribution; it fits easily on a 2 GB card with room to spare. Start with that! Do not use the non-lite Jessie image, it’s enormous and contains a ton of things we don’t need for this.
Raspberry Pi Downloads Page
While that’s downloading, you can work on assembling the LCD kit.
If you’re new to Raspberry Pi and Linux, we strongly suggest working through the first few guides in the Learn Raspberry Pi tutorial series…know how to “burn” an SD image, perform a first-time setup and get the Raspberry Pi connected to a network. Some familiarity with one of the text editors (such as the simple nano or the more daunting vi or emacs) is also recommended.
Install the Raspbian Jessie Lite image on a 2GB or larger microSD card. You’ll need to connect a monitor and USB keyboard for basic system configuration, but this is only temporary…we’ll set it up to run “headless” later. For networking, connect either an Ethernet cable or a USB WiFi adapter.
At this point you should have an SD card containing the Raspbian Jessie Lite software, and an assembled LCD “Pi Plate.”
You don’t need to install the LCD Plate atop the Pi yet, we’ll do that later. Let’s just get the basics set up.
- Connect a monitor and keyboard to the Raspberry Pi.
- Insert the SD card containing the Raspbian OS.
- Connect a “Micro B” USB cable to the power connector on the Raspberry Pi.
- Plug the other end of the USB cable into a power source: a mobile phone charger, a powered USB hub, or simply a USB port on your computer.
The Raspberry Pi should now boot, and you’ll see the monitor fill with lots of “Unix stuff.”
Linux can be daunting to the uninitiated. Don’t worry about messing something up…if all else fails, you can re-format the SD card and begin again.On first boot, you’ll get a login prompt. Log in as user “pi,” password “raspberry”.
Once you’re logged in successfully and have a command-line prompt, run the system configuration utility:
- sudo raspi–config
The following selections are required:
- Expand Filesystem
- Enable I2C (under “Advanced Options”) and load I2C kernel module by default.
The following are optional, but strongly recommended:
- Change User Password (because everybody knows the default).
- Under “Internationalisation Options,” select “Change Locale,” “Change Timezone” and “Change Keyboard Layout” to suit your location. If your keyboard isn’t producing the expected symbols, this is why.
- Change Hostname (under “Advanced Options”). I named mine “pandora” to distinguish it from other Raspberry Pi systems on the network.
- Enable SSH (also under “Advanced Options”). This allows remote login from another system on the network, for performing administration tasks without a display attached.
- You can disable Overscan (Advanced Options) if you like — we’ll reboot a few times during the setup process, and this provides a little extra screen real estate on HDMI monitors.
Tab over to the “Finish” button, press Return and confirm you’d like to reboot the system when prompted. You’ll need to log in again, using the password you established above.
Several configuration files will now be edited. Our examples show the “nano” text editor being used, as it’s easiest for the uninitiated. Power users can substitute “vi” or their editor of choice.Configure Wireless Networking
First, edit the WPA Supplicant configuration file:
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
The “network” section should be modified as follows:
- ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
- update_config=1
- network={
- ssid=“WIFI_NAME_GOES_HERE”
- psk=“WIFI_PASSWORD_GOES_HERE”
- scan_ssid=1
- }
Edit the ssid and psk strings to match your WiFi network name and password.
Make sure those lines in the network section are indented using tabs, not spaces. It seems to be quite picky about formatting.
If using a WiFi adapter based on the popular Realtek 8192CU chipset, disabling WiFi power management seems to help with reliability:
- echo “options 8192cu rtw_power_mgnt=0 rtw_enusbss=0” | sudo tee —append /etc/modprobe.d/8192cu.conf
Enable I2C Support for the LCD
The LCD doesn’t need to be attached yet, but we can get some setup started…
sudo nano /etc/modules
Add these two lines if not already present:
- i2c–bcm2708
- i2c–dev
Optional: Enable USB Audio
If you plan to use this with a USB Audio Adapter, this guide explains the process. It’s pretty straightforward, a matter of editing one line in a file.
Reboot
Finally, shut down the system:
sudo shutdown -h now
Wait for the system to report that it’s halted before disconnecting power. It should take about 20 seconds.
Following shutdown, insert the WiFi adapter and re-connect power (keep the monitor attached for now).
Is using a Model A board: you’ll need to remove the keyboard to plug in WiFi, or use a powered USB hub temporarily during setup. Without a hub, ssh is now the only way into the system…so if WiFi isn’t working, you’ll need to unplug the adapter, connect a keyboard and check the WiFi configuration.
For all other boards: keyboard can stay attached until you know the networking is properly configured. Log in again and you should be able to access the outside world now:
sudo ping adafruit.com
Do not proceed until internet access is working. If WiFi refuses to cooperate, make sure every step above has been followed carefully. If you’re trying to use a hidden network and it just won’t play nice, change the router configuration to broadcast the network name.
Raspbian Jessie Lite includes the “avahi” package by default, so the system appears on the network as “pandora.local” (or whatever hostname you configured) instead of a numeric IP address. You can easily access the Raspberry Pi remotely using an ssh client from another system on the network. For example, using the Terminal application in Mac OS X, one would type:
ssh pi@pandora.local
You should get a password prompt. Once logged in, you can perform all administration duties remotely (including the steps that follow), and the monitor and keyboard are no longer needed on the Raspberry Pi. It’s easier this way because you can cut-and-paste all the commands with their weird syntaxes.
Install Software Packages
Wireless networking MUST be working before continuing. If your Pi is not on the network yet, work through the prior page to diagnose the issue.Further configuration of the Raspberry Pi will take place over the network using SSH, not the keyboard and mouse.
- The SSH server should already be enabled on the Raspberry Pi — this was done during the initial raspi-config setup.
- On Mac or Linux systems, you can use a Terminal or xterm window.
- For Windows systems, you can download PuTTY.
The terminal command to access the system would be:
ssh pi@pandora.local (or whatever hostname was configured) if using Netatalk
or:
ssh pi@192.168.0.42 (or whatever the system’s actual numeric IP address is)
You’ll be prompted for a password — use the password that you set up in raspi-config, or “raspberry” if you left the default. Additionally, the first time connecting you may be prompted regarding a host key for security…enter Y (or click Yes) when prompted.
Update Installed Software
First, link some of the Adafruit libraries into the radio software directory:
- cd Python–WiFi–Radio
- ln –s ../Adafruit–Raspberry–Pi–Python–Code/Adafruit_CharLCDPlate/*.py .
(Note: there’s a space before the last period above. Don’t miss it. Copy and paste this exact line, if possible.)
Next, we’ll compile pianobar from source code:
- cd ../pianobar
- make
You might get a long list of compiler warnings. That’s fine, as long as the build finishes. Compiler errors, on the other hand, will stop the build process. You might be missing a library from the apt-get sequence above, or something in the software may have changed since these instructions were written, in which case post in the Adafruit Forums for assistance.
Once compiled, install using:
- sudo cp pianobar /usr/local/bin
Don’t worry about configuring this software yet; we’ll proceed there later. Just use the steps above to get it installed for now.
Post a Comment