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!

Make sure you get the version of Raspberry Pi OS with desktop and recommended software. This guide requires software not in the Lite version!

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:

  1. 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)
  2. Visit YouTube in the browser
  3. 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/ to set up the Chromium browser in kiosk mode.

(Alternatively, you can run wget in a Pi terminal to download the script, then bash 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.

If you don't hear anything, make sure you have the audio on/off switch set to "on" and double-check the sound card number for pacmd.

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.

At least with some HDMI monitors, having them plugged in when the Pi starts can interfere with showing an image on the BrainCraft HAT's LCD. If your HAT's LCD is blank, make sure nothing is plugged into HDMI and reboot.

To disable the LCD so that you can use a HDMI monitor again, use these commands:

cd ~/Raspberry-Pi-Installer-Scripts
sudo python3 --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.

If you ever need to make modifications to the Pi, you will need to disable the Overlay File System using raspi-config, or your changes will be lost when you power off.

This guide was first published on Dec 16, 2020. It was last updated on Dec 16, 2020.

This page (Configure your Raspberry Pi) was last updated on Apr 10, 2021.

Text editor powered by tinymce.