OK, let's get all the necessary software bits installed and checked out. The first few are covered in other guides, which are linked to from here. It works best to do these in the order shown here, checking that each step works before moving to the next.
Blinka Installation
Follow this guide page for initial Pi setup (including the OS) and Blinka installation:
Be sure the blinkatest.py script from that setup runs as expected before moving on.
PiTFT Setup
This guide uses the PiTFT directly via Python. So follow this setup page from the PiTFT main guide:
The guide covers a couple of TFTs, and the rgb_display_minipitfttest.py test script appears to be configured for the smaller TFT - not the one used in this guide. However, it's a simple fix to change to the 1.3" TFT.
Change these lines:
display = st7789.ST7789( board.SPI(), cs=cs_pin, dc=dc_pin, rst=reset_pin, baudrate=BAUDRATE, width=135, height=240, x_offset=53, y_offset=40, )
to this:
disp = st7789.ST7789( board.SPI(), cs=cs_pin, dc=dc_pin, rst=reset_pin, baudrate=BAUDRATE, width=240, height=240, x_offset=0, y_offset=80, )
FM Radio Setup
To install the CircuitPython library for the Si4713 FM radio transmitter, follow this guide page:
Test using the frequency scan example from that guide. If that runs OK, then it should be installed and working correctly.
USB Audio Adapter Setup
The Pi has built in support for the USB audio adapter, so there's nothing extra needed in terms of software. Simply plug the USB audio adapter into one of the Pi's USB ports and run the following command:
aplay -l
This will list the audio devices that the Pi has. There will likely be more than one, but the USB audio adapter should show up in the list. Look for C-Media USB Headphone Set in the output.
Here's an example:
The USB audio adapter shows up as card 2.
Music Player Software
To serve up audio, we'll use the Music Player Daemon software. To install it, along with a couple of other tools, run the following:
sudo apt-get install mpd mpc ncmpc
This will install:
- mpd - the main music server (daemon)
- mpc - a simple command line tool for controlling mpd
- ncmpc - a simple text based interface music player
After installation, run the following as a simple test:
mpc status
This just queries the current status of the server, which won't be anything exciting at this point. It should look like this:
But that verifies the server has been installed correctly and is running.
Python Library for MPD
The python-mpd2 library allows for controlling mpd playback from within Python. This is another pip install:
sudo pip3 install python-mpd2
Page last edited March 08, 2024
Text editor powered by tinymce.