Update 'Raspberry Pi'
parent
6283bb51b8
commit
d79f463ed9
334
Raspberry-Pi.md
334
Raspberry-Pi.md
|
@ -1,167 +1,167 @@
|
|||
Raspberry Pi
|
||||
============
|
||||
|
||||
When combining the electronics and software into a Raspberry Pi, Scrapeboard becomes a plug and play device, capable of being played by plugging into a power source and any HDMI display. This is beneficial because it makes the Scrapeboard system more portable.
|
||||
|
||||
This manual covers how to install everything from scratch on an empty SD card using Raspberry Pi OS Lite as the operating system. A wi-fi or LAN connection, external display, and USB keyboard are required.
|
||||
|
||||
Model
|
||||
-----
|
||||
|
||||
The Raspberry Pi model must have 2GB or higher RAM, and only the newest model, Raspberry Pi 4 has been tested. It should have a 4GB or larger micro SD card.
|
||||
|
||||
Operating System
|
||||
----------------
|
||||
|
||||
![Pi imager home screen](../../raw/branch/main/doc/img/pi_imager_home_screen.png)
|
||||
|
||||
1. Get the [Raspberry Pi imager](https://raspberrypi.com/software) software and launch it (note: must be run as authorized user)
|
||||
2. Choose `"Raspberry Pi OS (other)" -> "Raspberry Pi OS Lite (64-bit)"` under `"Operating System"`
|
||||
3. Connect your SD card and choose it under `"Storage"`
|
||||
|
||||
### Imager settings tab
|
||||
|
||||
![Pi imager settings](../../raw/branch/main/doc/img/pi_imager_settings.png)
|
||||
|
||||
1. Click the gear button to open the settings
|
||||
2. Check off "Set hostname" and change to "scrapeboard"
|
||||
3. Check off "Enable SSH" with "Use password authentication"
|
||||
4. Check off "Set username and password" and choose your own username and password
|
||||
5. Check off "Configure wireless LAN" and set the SSID and password for your wi-fi network (if wi-fi is unavailable, you can use the Raspberry Pi's ethernet connection or transfer the Scrapeboard files onto the SD card manually later)
|
||||
6. Check off "Set locale settings" and set to your time zone and keyboard layout
|
||||
|
||||
### Begin installation
|
||||
|
||||
Click "WRITE" in the Imager window
|
||||
|
||||
### Boot
|
||||
|
||||
1. Insert the SD card into the Raspberry Pi
|
||||
2. Connect the Pi to an external HDMI display
|
||||
3. Connect a USB keyboard
|
||||
4. Power up the Pi (note: an [official power adapter](https://raspberrypi.com/products/type-c-power-supply) is recommended)
|
||||
5. Login with the username and password set during installation
|
||||
6. Optional: run `sudo apt update && sudo apt upgrade` to update the operating system
|
||||
7. The system is ready for installing the game software and other software requirements
|
||||
|
||||
Installing the software
|
||||
-----------------------
|
||||
|
||||
Install Python and Git through the package manager
|
||||
|
||||
sudo apt install python3 git
|
||||
|
||||
### Pygame 2
|
||||
|
||||
Raspberry Pi OS Lite is still using Pygame 1 by default. While it is possible to run Scrapeboard with Pygame 1, support may be dropped in the future, so it is recommended to install Pygame 2 manually, following the steps below.
|
||||
|
||||
To set the resolution, edit `/boot/cmdline.txt` by adding a custom video definition to the end of the file
|
||||
|
||||
video=HDMI-A-1:800x450M@60
|
||||
|
||||
Install initial Pygame dependencies
|
||||
|
||||
sudo apt install build-essential libfreetype6-dev libportmidi-dev libjpeg-dev python3-setuptools python3-dev python3-numpy
|
||||
|
||||
Download [SDL2 source](https://github.com/libsdl-org/SDL/releases). For example, this will download version 2.24.2.
|
||||
|
||||
wget https://github.com/libsdl-org/SDL/releases/download/release-2.24.2/SDL2-2.24.2.tar.gz
|
||||
tar -xf SDL2-2.24.2.tar.gz
|
||||
cd SDL2-2.24.2/
|
||||
|
||||
Enable `deb-src` repositories by uncommenting the `deb-src` lines in `/etc/apt/sources.list`.
|
||||
|
||||
Install everything necessary to build SDL2.
|
||||
|
||||
sudo apt update && sudo apt build-dep libsdl2
|
||||
|
||||
Configure, make, and install
|
||||
|
||||
./configure && make && sudo make install
|
||||
|
||||
Download and compile [SDL image][], [SDL ttf][], and [SDL mixer][]
|
||||
|
||||
wget https://github.com/libsdl-org/SDL_image/releases/download/release-2.6.2/SDL2_image-2.6.2.tar.gz
|
||||
wget https://github.com/libsdl-org/SDL_ttf/releases/download/release-2.20.1/SDL2_ttf-2.20.1.tar.gz
|
||||
wget https://github.com/libsdl-org/SDL_mixer/releases/download/release-2.6.2/SDL2_mixer-2.6.2.tar.gz
|
||||
tar -xf SDL2_image-2.6.2.tar.gz
|
||||
cd SDL2_image-2.6.2/
|
||||
./configure && make && sudo make install
|
||||
cd ..
|
||||
tar -xf SDL2_ttf-2.20.1.tar.gz
|
||||
cd SDL2_ttf-2.20.1/
|
||||
./configure && make && sudo make install
|
||||
cd ..
|
||||
tar -xf SDL2_mixer-2.6.2.tar.gz
|
||||
cd SDL2_mixer-2.6.2/
|
||||
./configure && make && sudo make install
|
||||
sudo ldconfig
|
||||
|
||||
Build Pygame
|
||||
|
||||
git clone https://github.com/pygame/pygame
|
||||
cd pygame
|
||||
python3 setup.py -config -auto
|
||||
python3 setup.py install --user
|
||||
|
||||
### Audio configuration
|
||||
|
||||
It may be necessary to configure sound by replacing the contents of `~/.asoundrc` with
|
||||
|
||||
defaults.pcm.card 1
|
||||
defaults.pcm.device 0
|
||||
defaults.ctl.card 1
|
||||
|
||||
Scrapeboard
|
||||
-----------
|
||||
|
||||
Use Git clone with the `--recursive` flag to download both the game and framework
|
||||
|
||||
git clone --recursive https://open.shampoo.ooo/scrape/scrapeboard
|
||||
cd scrapeboard/
|
||||
|
||||
Launch
|
||||
------
|
||||
|
||||
![Launch from command line](../../raw/branch/main/doc/img/launch_from_command_line.png)
|
||||
|
||||
It should be possible to run in keyboard mode and test input with key presses now. The `--pi` flag is used to indicate there is no Arduino attached. The `--kms` flag sets SDL 2 to use the KMS video driver, necessary for Raspberry Pi OS Lite since it doesn't use X-windows.
|
||||
|
||||
./OPEN-GAME --kms --pi
|
||||
|
||||
Set to run at launch
|
||||
--------------------
|
||||
|
||||
First, make the Raspberry Pi skip the login prompt. Use the `raspi-config` script and select `System Options -> Boot / Auto Login -> Console Autologin`.
|
||||
|
||||
To launch Scrapeboard at startup, create a file at `/etc/systemd/system/scrapeboard.service` with the following contents
|
||||
|
||||
[Unit]
|
||||
Description=It is Scrapeboard you slime bag
|
||||
After=multi-user.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/home/tony/scrapeboard/OPEN-GAME --kms --pi --go-to-dir
|
||||
Restart=always
|
||||
RestartSec=5s
|
||||
TimeoutStartSec=2min
|
||||
User=scrapeboard
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
|
||||
and enable it
|
||||
|
||||
sudo systemctl enable scrapeboard.service
|
||||
|
||||
Now Scrapeboard will launch at startup and will restart itself if it ever is closed or crashes, and it can be controlled through `systemd`
|
||||
|
||||
> sudo systemctl start scrapeboard
|
||||
...
|
||||
> sudo systemctl stop scrapeboard
|
||||
|
||||
Use `SHIFT + q` to permanently quit and get back to the Raspberry Pi console. The regular quit button `Q` will cause the game to be relaunched automatically.
|
||||
|
||||
| ⬅ Previous Page | Next Page ➡ |
|
||||
| --------------- | --------------------- |
|
||||
| [[Board]] | [[Improved Platform]] |
|
||||
Raspberry Pi
|
||||
============
|
||||
|
||||
Replacing the computer and Arduino with a Raspberry Pi transforms Scrapeboard into a plug and play device, capable of being played simply by plugging into a power source and any HDMI display. This is beneficial because it makes the Scrapeboard system more portable.
|
||||
|
||||
This chapter explains how to install everything from scratch on an empty SD card using Raspberry Pi OS Lite as the operating system. It also explains how to connect the same circuit to a Raspberry Pi's GPIO pins instead of an Arduino. A wi-fi or LAN connection, external display, and USB keyboard are required.
|
||||
|
||||
Model
|
||||
-----
|
||||
|
||||
The Raspberry Pi model must have 2GB or higher RAM, and only the newest model, Raspberry Pi 4 has been tested. It should have a 4GB or larger micro SD card.
|
||||
|
||||
Operating System
|
||||
----------------
|
||||
|
||||
![Pi imager home screen](../../raw/branch/main/doc/img/pi_imager_home_screen.png)
|
||||
|
||||
1. Get the [Raspberry Pi imager](https://raspberrypi.com/software) software and launch it (note: must be run as authorized user)
|
||||
2. Choose `"Raspberry Pi OS (other)" -> "Raspberry Pi OS Lite (64-bit)"` under `"Operating System"`
|
||||
3. Connect your SD card and choose it under `"Storage"`
|
||||
|
||||
### Imager settings tab
|
||||
|
||||
![Pi imager settings](../../raw/branch/main/doc/img/pi_imager_settings.png)
|
||||
|
||||
1. Click the gear button to open the settings
|
||||
2. Check off "Set hostname" and change to "scrapeboard"
|
||||
3. Check off "Enable SSH" with "Use password authentication"
|
||||
4. Check off "Set username and password" and choose your own username and password
|
||||
5. Check off "Configure wireless LAN" and set the SSID and password for your wi-fi network (if wi-fi is unavailable, you can use the Raspberry Pi's ethernet connection or transfer the Scrapeboard files onto the SD card manually later)
|
||||
6. Check off "Set locale settings" and set to your time zone and keyboard layout
|
||||
|
||||
### Begin installation
|
||||
|
||||
Click "WRITE" in the Imager window
|
||||
|
||||
### Boot
|
||||
|
||||
1. Insert the SD card into the Raspberry Pi
|
||||
2. Connect the Pi to an external HDMI display
|
||||
3. Connect a USB keyboard
|
||||
4. Power up the Pi (note: an [official power adapter](https://raspberrypi.com/products/type-c-power-supply) is recommended)
|
||||
5. Login with the username and password set during installation
|
||||
6. Optional: run `sudo apt update && sudo apt upgrade` to update the operating system
|
||||
7. The system is ready for installing the game software and other software requirements
|
||||
|
||||
Installing the software
|
||||
-----------------------
|
||||
|
||||
Install Python and Git through the package manager
|
||||
|
||||
sudo apt install python3 git
|
||||
|
||||
### Pygame 2
|
||||
|
||||
Raspberry Pi OS Lite is still using Pygame 1 by default. While it is possible to run Scrapeboard with Pygame 1, support may be dropped in the future, so it is recommended to install Pygame 2 manually, following the steps below.
|
||||
|
||||
To set the resolution, edit `/boot/cmdline.txt` by adding a custom video definition to the end of the file
|
||||
|
||||
video=HDMI-A-1:800x450M@60
|
||||
|
||||
Install initial Pygame dependencies
|
||||
|
||||
sudo apt install build-essential libfreetype6-dev libportmidi-dev libjpeg-dev python3-setuptools python3-dev python3-numpy
|
||||
|
||||
Download [SDL2 source](https://github.com/libsdl-org/SDL/releases). For example, this will download version 2.24.2.
|
||||
|
||||
wget https://github.com/libsdl-org/SDL/releases/download/release-2.24.2/SDL2-2.24.2.tar.gz
|
||||
tar -xf SDL2-2.24.2.tar.gz
|
||||
cd SDL2-2.24.2/
|
||||
|
||||
Enable `deb-src` repositories by uncommenting the `deb-src` lines in `/etc/apt/sources.list`.
|
||||
|
||||
Install everything necessary to build SDL2.
|
||||
|
||||
sudo apt update && sudo apt build-dep libsdl2
|
||||
|
||||
Configure, make, and install
|
||||
|
||||
./configure && make && sudo make install
|
||||
|
||||
Download and compile [SDL image][], [SDL ttf][], and [SDL mixer][]
|
||||
|
||||
wget https://github.com/libsdl-org/SDL_image/releases/download/release-2.6.2/SDL2_image-2.6.2.tar.gz
|
||||
wget https://github.com/libsdl-org/SDL_ttf/releases/download/release-2.20.1/SDL2_ttf-2.20.1.tar.gz
|
||||
wget https://github.com/libsdl-org/SDL_mixer/releases/download/release-2.6.2/SDL2_mixer-2.6.2.tar.gz
|
||||
tar -xf SDL2_image-2.6.2.tar.gz
|
||||
cd SDL2_image-2.6.2/
|
||||
./configure && make && sudo make install
|
||||
cd ..
|
||||
tar -xf SDL2_ttf-2.20.1.tar.gz
|
||||
cd SDL2_ttf-2.20.1/
|
||||
./configure && make && sudo make install
|
||||
cd ..
|
||||
tar -xf SDL2_mixer-2.6.2.tar.gz
|
||||
cd SDL2_mixer-2.6.2/
|
||||
./configure && make && sudo make install
|
||||
sudo ldconfig
|
||||
|
||||
Build Pygame
|
||||
|
||||
git clone https://github.com/pygame/pygame
|
||||
cd pygame
|
||||
python3 setup.py -config -auto
|
||||
python3 setup.py install --user
|
||||
|
||||
### Audio configuration
|
||||
|
||||
It may be necessary to configure sound by replacing the contents of `~/.asoundrc` with
|
||||
|
||||
defaults.pcm.card 1
|
||||
defaults.pcm.device 0
|
||||
defaults.ctl.card 1
|
||||
|
||||
Scrapeboard
|
||||
-----------
|
||||
|
||||
Use Git clone with the `--recursive` flag to download both the game and framework
|
||||
|
||||
git clone --recursive https://open.shampoo.ooo/scrape/scrapeboard
|
||||
cd scrapeboard/
|
||||
|
||||
Launch
|
||||
------
|
||||
|
||||
![Launch from command line](../../raw/branch/main/doc/img/launch_from_command_line.png)
|
||||
|
||||
It should be possible to run in keyboard mode and test input with key presses now. The `--pi` flag is used to indicate there is no Arduino attached. The `--kms` flag sets SDL 2 to use the KMS video driver, necessary for Raspberry Pi OS Lite since it doesn't use X-windows.
|
||||
|
||||
./OPEN-GAME --kms --pi
|
||||
|
||||
Set to run at launch
|
||||
--------------------
|
||||
|
||||
First, make the Raspberry Pi skip the login prompt. Use the `raspi-config` script and select `System Options -> Boot / Auto Login -> Console Autologin`.
|
||||
|
||||
To launch Scrapeboard at startup, create a file at `/etc/systemd/system/scrapeboard.service` with the following contents
|
||||
|
||||
[Unit]
|
||||
Description=It is Scrapeboard you slime bag
|
||||
After=multi-user.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/home/tony/scrapeboard/OPEN-GAME --kms --pi --go-to-dir
|
||||
Restart=always
|
||||
RestartSec=5s
|
||||
TimeoutStartSec=2min
|
||||
User=scrapeboard
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
|
||||
and enable it
|
||||
|
||||
sudo systemctl enable scrapeboard.service
|
||||
|
||||
Now Scrapeboard will launch at startup and will restart itself if it ever is closed or crashes, and it can be controlled through `systemd`
|
||||
|
||||
> sudo systemctl start scrapeboard
|
||||
...
|
||||
> sudo systemctl stop scrapeboard
|
||||
|
||||
Use `SHIFT + q` to permanently quit and get back to the Raspberry Pi console. The regular quit button `Q` will cause the game to be relaunched automatically.
|
||||
|
||||
| ⬅ Previous Page | Next Page ➡ |
|
||||
| --------------- | --------------------- |
|
||||
| [[Board]] | [[Improved Platform]] |
|
||||
|
|
Loading…
Reference in New Issue