Plug in the BrainCraft HAT
With the power disconnected, simply align the HAT to the pins on the Raspberry Pi 4 and push down firmly until the connector is fully seated. If you like, use M2.5 screws and stand-offs to secure the HAT. This project does not require that the fan be installed, but installing it won't hurt anything either. We skip the step of installing the "fan service", so the fan won't spin even if you plugged it in.
Install Raspberry Pi OS
For this guide, you'll need to download "Raspberry Pi OS with desktop and recommended software", which is a full-featured desktop operating system. Follow the official instructions to download the OS and copy it to a Micro SD card. For the next steps, hook your Pi up to a monitor and plug in a mouse and keyboard!
Set up networking
During the first boot, you will be prompted to set up networking. If you skipped that step, you can configure your Pi to connect to a wireless network using these instructions. A wired network would also work fine, but we know most of you out there prefer the ease of wireless. Next, set up ssh access using the command line or raspi-config; you'll need it after configuring the display if you want to access the Pi (there's also a way to configure it using a host computer).
Update and upgrade
During the first boot, you will be prompted to update the software. If you skipped that step, you can do it from a terminal window with these commands:
sudo apt-get update
sudo apt-get -y upgrade
Install additional software
In a terminal window, use the following commands to add some software that is required for the next steps:
sudo apt-get install -y python3-pip
sudo pip3 install --upgrade setuptools
Reboot so that all the updates take effect.
Configure the BrainCraft HAT, part 1
Follow these pages of instructions from the BrainCraft HAT guide:
At this point, you should be able to:
- Open the Chrome browser on the Raspberry Pi, (you'll need to have an HDMI screen + keyboard + mouse attached to the computer for this step)
- Visit YouTube in the browser
- Hear the audio stream on headphones or speakers connected to the BrainCraft HAT's 1/8" jack. If not, make sure the audio on/off switch is set to ON. (Head to the HAT guide for more troubleshooting suggestions)
Remember the card number that you found with aplay -l
in the Audio Setup steps? You'll need to set it as your default sound output by running a command in the terminal. Change the "2" in this command to the number you found:
pacmd set-default-sink 2
You will need to restart the browser or the whole system after changing the "default sink" with pactl. Remember that later when you unhook the HDMI monitor this number can change, so you may need to repeat these steps later on.
Install the kiosk-mode script
Using the browser on the Pi, download the kiosk mode script from GitHub. Then, open up a terminal window and run bash Downloads/kiosk-mode.sh
to set up the Chromium browser in kiosk mode.
(Alternatively, you can run wget https://github.com/adafruit/Adafruit_Learning_System_Guides/raw/main/Raspberry_Pi_Braincraft_Radio/setup-kiosk.sh
in a Pi terminal to download the script, then bash setup-kiosk.sh
in the same directory)
Restart the Pi, either via the desktop shutdown menu or sudo reboot
in a terminal.
When you restart, you should get a full screen YouTube window showing the lofi hip hop radio in the upper left corner, and hear the music streaming on your speakers. However, the display will still be on your HDMI monitor. Check that the controls work (left/right to change station, up/down to adjust volume) before moving on to the next steps.
Configure the BrainCraft HAT, part 2
It's time to set up the display. After performing this step, you won't be able to connect your Pi to a HDMI monitor. Don't worry, you can reverse this step if you need to!
Head back to the main guide's Display Module Install page and follow the "1.54 inch TFT kernel module" steps.
Before restarting, unplug the HDMI monitor cable.
When you restart, the heroine and her cat should appear on the LCD of the HAT. If the sound stops after this step, use aplay -l
to check the sound card index again and pacmd set-default-sink #
(where # is the card number like 1, 2, 3 from the first command) to make the browser use that output. You will need to restart the browser or the whole system after changing the "default sink" with pactl.
To disable the LCD so that you can use a HDMI monitor again, use these commands:
cd ~/Raspberry-Pi-Installer-Scripts
sudo python3 adafruit-pitft.py --install-type uninstall --reboot yes
Optional: Configure Overlay (read only) mode
We want to be able to turn off the Pi at any time without risk of damaging the operating system files. This read-only mode is called the "overlay". Connect with ssh, run sudo raspi-config
, choose "performance options" and then "Overlay File System". Choose "Yes" to enable it, and then choose "Yes" again to make the boot filesystem read-only.
Page last edited March 08, 2024
Text editor powered by tinymce.